crizstian / mongo-replica-with-docker

How to deploy a MongoDB Replica Set using Docker
109 stars 66 forks source link

Not replicating mongo nodes #1

Open saidur2k opened 7 years ago

saidur2k commented 7 years ago

$ bash < create-replica-set.sh ··························· ·· swtiching >>>> manager1 server ·· ··························· Host does not exist: "manager1" ·· creating container >>>> mongoNode1 ·· ·· configuring container >>>> mongoNode1 ·· mongo_storage 881e0d7644968562eed5cea3fd17967ef30449593b344e1d0a58008463b37f1c ·· copying files to container >>>> mongoNode1 ·· ·· removing container >>>> mongoNode1 ·· mongoNode1 --add-host manager1:192.168.99.100 --add-host worker1:192.168.99.101 --add-host worker2:192.168.99.102 ·· recreating container >>>> mongoNode1 ·· eb5d089344730622f749adea5b33d567315de98980eda3081d208e26e9eb895d Host does not exist: "manager1" IP == PORT == 27017

waiting for mongodb <<<<< :27017 is available after 0 seconds ······························· · CONTAINER manager1 CREATED ·· ······························· MongoDB shell version v3.4.2 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.4.2 { "ok" : 0, "errmsg" : "No host described in new configuration 1 for replica set rs1 maps to this node", "code" : 93, "codeName" : "InvalidReplicaSetConfig" } bye MongoDB shell version v3.4.2 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.4.2 admin 2017-02-20T05:38:29.974+0000 E QUERY [thread1] Error: couldn't add user: not master : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DB.prototype.createUser@src/mongo/shell/db.js:1290:15 @(shell):1:1 Error: Authentication failed. 0 2017-02-20T05:38:29.992+0000 E QUERY [thread1] Error: couldn't add user: not master : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DB.prototype.createUser@src/mongo/shell/db.js:1290:15 @(shell):1:1 bye MongoDB shell version v3.4.2 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.4.2 2017-02-20T05:38:32.135+0000 E QUERY [thread1] Error: Authentication failed. : DB.prototype._authOrThrow@src/mongo/shell/db.js:1459:20 @(auth):6:1 @(auth):1:2 exception: login failed ······························· · REPLICA SET READY TO ADD NODES ·· ·······························

crizstian commented 7 years ago

Hello saidur2k, this happening because of some problems with your docker binaries, if you have docker for mac or docker for windows, you need to restart the docker application, and try to execute the script again, in case of getting the same error after restarting the docker binaries, you may need to restart the computer.

thats how i resolved those issues when appeared to me.

saidur2k commented 7 years ago

Hi @Crizstian,

Still getting this issue after restarting the computer:

saidur@admins-mbp:~/Development/mongo-replica-with-docker (master) $ bash < create-replica-set.sh ··························· ·· swtiching >>>> manager1 server ·· ··························· Host does not exist: "manager1" ·· creating container >>>> mongoNode1 ·· ·· configuring container >>>> mongoNode1 ·· mongo_storage Unable to find image 'mongo:latest' locally docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled (Client.Timeout exceeded while awaiting headers). See 'docker run --help'. Error response from daemon: No such container: mongoNode1 ·· copying files to container >>>> mongoNode1 ·· no such directory no such directory no such directory Error response from daemon: No such container: mongoNode1 Error response from daemon: No such container: mongoNode1 Error response from daemon: No such container: mongoNode1 ·· removing container >>>> mongoNode1 ·· Error response from daemon: No such container: mongoNode1 Host does not exist: "manager1" Host does not exist: "worker1" Host does not exist: "worker2" ·· recreating container >>>> mongoNode1 ·· invalid argument "manager1:" for --add-host: invalid IP address in add-host: "" See 'docker run --help'. Host does not exist: "manager1" IP == PORT == 27017

waiting for mongodb

And it just sits there

crizstian commented 7 years ago

This is because the docker binaries is not creating the manager1 docker-machine if you make docker-machine ls you will see that there will print an error in the manager1, and thats because the docker binaries is not creating it because some error happened during the creation, the solution that i encounter when this problem has presented to me was first, restarting the docker for mac binaries and try to create again the docker-machines, and if that didn't work, go the preferences of docker and reset it to the factory defaults, and try to create the machines, and if that didn't work, i restart my computer. this is more a docker binaries problem then the create-replica-set bash script.