-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database Replication - MongoDB ReplicaSets #11
Comments
The -d (detach) flag means the container will run in the background, separately to your shell process. The container external port 30001 is bound back to the internal port of the container 27018 on your host. You’ll be able to connect to your Mongo instance on localhost:30001. If you want to change the port number, modify the first part of the -p flag, such as 9000:27017 to use localhost:9000.
|
Run the second and third containers using the following commands We'll have to change the external ports and database names
|
In order to create the replicaSet we have to login to the first database in an interactive mode and launch the mongo shell Then create a configuration rsconfig={_id:"Dist", |
Use |
FINAL UPDATE!
The -d (detach) flag means the container will run in the background, separately to your shell process. The container external port 30001 is bound back to the internal port of the container 27017 on your host. You’ll be able to connect to your Mongo instance on localhost:30001. If you want to change the port number, modify the first part of the -p flag, such as 9000:27017 to use localhost:9000.
Run the second and third containers using the following commands We'll have to change the external ports and database names
In order to create the replicaSet we have to login to the first database in an interactive mode and launch the mongo shell Then create a configuration rsconfig={_id:"Dist",
|
mongos
directory with foldersdb1
,db2
, anddb3
mongod --replSet Dist --dbpath mongos/db1 --port 27018
mongod --replSet Dist --dbpath mongos/db2 --port 27019
mongod --replSet Dist --dbpath mongos/db3 --port 27020
mongosh --port 27018
rs.initiate(rsconfig)
rs.status()
to make sure it is working well.The text was updated successfully, but these errors were encountered: