Skip to content

Instantly share code, notes, and snippets.

@giobyte8
Created November 30, 2014 00:42
Show Gist options
  • Save giobyte8/aedef191574d1f69dd6a to your computer and use it in GitHub Desktop.
Save giobyte8/aedef191574d1f69dd6a to your computer and use it in GitHub Desktop.
After run mongodb_create_replica_set.sh we need config the replica, run this with a command like: mongo --port 27017 < mongodb_init_replica.js
/**
* We should config the replica after start the 3 servers
* run this with a command like:
* mongo --port 27017 < mongodb_init_replica.js
*/
config = { _id: "m101", members:[
{ _id : 0, host : "localhost:27017"},
{ _id : 1, host : "localhost:27018"},
{ _id : 2, host : "localhost:27019"} ]
};
rs.initiate(config);
rs.status();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment