{"id":6751,"date":"2017-06-03T17:56:49","date_gmt":"2017-06-03T09:56:49","guid":{"rendered":"http:\/\/rmohan.com\/?p=6751"},"modified":"2017-06-03T17:56:49","modified_gmt":"2017-06-03T09:56:49","slug":"mongodb-replication-set-settings-replication-sets","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6751","title":{"rendered":"MongoDB replication set settings Replication Sets"},"content":{"rendered":"<p>MongoDB replication set settings Replication Sets<\/p>\n<p>Master-Slave Master-slave replication: -master only need to add a parameter when a service starts, while another service plus -slave and -source parameters, you can achieve synchronization.<\/p>\n<p>The latest version of MongoDB is no longer recommended for this program.<\/p>\n<p>Replica Sets replication set: MongoDB version 1.6 for developers of new features replica set, which is stronger than some of the previous replication function, increased fault automatic switching and automatic restoration member nodes, exactly the same data between various DB, greatly reducing maintenance success. auto shard has been clearly stated does not support replication paris, we recommended replica set, replica set failover is completely automatic.<\/p>\n<p>Replica Sets structure is very similar to a cluster, if one node failure occurs, the other nodes will immediately take over the business without having to shut down operations.<\/p>\n<p>??MongoDB<\/p>\n<p>    [root@node1 ~]# vim \/etc\/yum.repos.d\/Mongodb.repo<\/p>\n<p>    [mongodb-org-3.4]<br \/>\n name=MongoDB Repository<br \/>\n baseurl=https:\/\/repo.mongodb.org\/yum\/RedHat\/$releasever\/mongodb-org\/3.4\/x86_64\/<br \/>\n gpgcheck=1<br \/>\n enabled=1<br \/>\n gpgkey=https:\/\/www.mongodb.org\/static\/pgp\/server-3.4.asc<\/p>\n<p>    [root@node1 ~]# yum install -y mongodb-org<\/p>\n<p>    [root@node1 ~]# service mongod start<br \/>\n Starting mongod:                                          [  OK  ]<\/p>\n<p>    [root@node1 ~]# ps aux|grep mong<br \/>\n mongod    1361  5.7 14.8 351180 35104 ?        Sl  01:26  0:01 \/usr\/bin\/mongod -f \/etc\/mongod.conf<\/p>\n<p>    [root@node1 ~]# mkdir -p \/mongodb\/data<br \/>\n [root@node1 ~]# chown -R mongod:mongod \/mongodb\/<br \/>\n [root@node1 ~]# ll \/mongodb\/<br \/>\n total 4<br \/>\n drwxr-xr-x 2 mongod mongod 4096 May 18 02:04 data<\/p>\n<p>    [root@node1 ~]# grep -v &#8220;^#&#8221; \/etc\/mongod.conf |grep -v &#8220;^$&#8221;<br \/>\n systemLog:<br \/>\n  destination: file<br \/>\n  logAppend: true<br \/>\n  path: \/var\/log\/mongodb\/mongod.log<br \/>\n storage:<br \/>\n  dbPath: \/mongodb\/data<br \/>\n  journal:<br \/>\n    enabled: true<br \/>\n processManagement:<br \/>\n  fork: true  # fork and run in background<br \/>\n  pidFilePath: \/var\/run\/mongodb\/mongod.pid  # location of pidfile<br \/>\n net:<br \/>\n  port: 27017<br \/>\n  bindIp: 0.0.0.0 # Listen to local interface only, comment to listen on all interfaces.<\/p>\n<p>    [root@node1 ~]# service mongod start<br \/>\n Starting mongod:                                          [  OK  ]<\/p>\n<p>    node2?node2<\/p>\n<p> Replication Sets<\/p>\n<p> &#8211;oplogSize<br \/>\n &#8211;dbpath<br \/>\n &#8211;logpath<br \/>\n &#8211;port<br \/>\n &#8211;replSet<br \/>\n &#8211;replSet test\/<br \/>\n &#8211;maxConns<br \/>\n &#8211;fork<br \/>\n &#8211;logappend<br \/>\n &#8211;keyFile    <\/p>\n<p>v3.4.4<\/p>\n<p>    [root@node1 ~]# vim \/etc\/mongod.conf<br \/>\n replication:<br \/>\n    oplogSizeMB: 1024<br \/>\n    replSetName: rs0<\/p>\n<p>    Keyfile<\/p>\n<p>    openssl rand -base64 756 > <path-to-keyfile>\n chmod 400 <path-to-keyfile>\n<p> Configuration File<br \/>\n If using a configuration file, set the security.keyFile option to the keyfile\u2019s path, and the replication.replSetName option to the replica set name:<br \/>\n security:<br \/>\n  keyFile: <path-to-keyfile>\n replication:<br \/>\n  replSetName: <replicaSetName><\/p>\n<p> Command Line<br \/>\n If using the command line option, start the mongod with the &#8211;keyFile and &#8211;replSet parameters:<\/p>\n<p> mongod &#8211;keyFile <path-to-keyfile> &#8211;replSet <replicaSetName><\/p>\n<p>     Replication Sets?<\/p>\n<p>    [root@node1 ~]# openssl rand -base64 756 > \/mongodb\/mongokey<br \/>\n    [root@node1 ~]# cat \/mongodb\/mongokey<br \/>\n gxpcgjyFj2qE8b9TB\/0XbdRVYH9VDb55NY03AHwxCFU58MUjJMeez844i1gaUo\/t<br \/>\n &#8230;..<br \/>\n &#8230;..<\/p>\n<p>    [root@node1 ~]# chmod 400 \/mongodb\/mongokey<br \/>\n [root@node1 ~]# chown mongod:mongod \/mongodb\/mongokey<br \/>\n [root@node1 ~]# ll \/mongodb\/<br \/>\n total 8<br \/>\n drwxr-xr-x 4 mongod mongod 4096 May 19 18:39 data<br \/>\n -r&#8212;&#8212;&#8211; 1 mongod mongod 1024 May 19 18:29 mongokey<\/p>\n<p>    [root@node1 ~]# vim \/etc\/mongod.conf<br \/>\n    #security:<br \/>\n security:<br \/>\n  keyFile: \/mongodb\/mongokey<\/p>\n<p> #operationProfiling:<\/p>\n<p> #replication:<br \/>\n replication:<br \/>\n  oplogSizeMB: 1024<br \/>\n  replSetName: rs0<\/p>\n<p>    [root@node1 ~]# service mongod restart<br \/>\n Stopping mongod:                                          [  OK  ]<br \/>\n Starting mongod:                                          [  OK  ]<\/p>\n<p>    [root@node1 ~]# iptables -I INPUT 4 -m state &#8211;state NEW -p tcp &#8211;dport 27017  -j ACCEPT<\/p>\n<p>    hosts<br \/>\n    [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/etc\/hosts root@node2.rmohan.com:\/mongodb\/<br \/>\n    [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/etc\/hosts root@node3.rmohan.com:\/mongodb\/<\/p>\n<p>    [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/mongodb\/mongokey root@node3.rmohan.com:\/mongodb\/<br \/>\n    [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/mongodb\/mongokey root@node3.rmohan.com:\/mongodb\/<\/p>\n<p>    [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/etc\/mongod.conf root@node2.rmohan.com:\/etc\/<br \/>\n    [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/etc\/mongod.conf root@node3.rmohan.com:\/etc\/<\/p>\n<p>rsync?openssh-clients<\/p>\n<p>    [root@node1 ~]# mongo<br \/>\n    > help<br \/>\n db.help()                    help on db methods<br \/>\n db.mycoll.help()            help on collection methods<br \/>\n sh.help()                    sharding helpers<br \/>\n rs.help()                    replica set helpers<br \/>\n    &#8230;..<\/p>\n<p>    > rs.help()<br \/>\n    rs.status()                                { replSetGetStatus : 1 } checks repl set status<br \/>\n rs.initiate()                              { replSetInitiate : null } initiates set with default settings<br \/>\n rs.initiate(cfg)                          { replSetInitiate : cfg } initiates set with configuration cfg<br \/>\n rs.conf()                                  get the current configuration object from local.system.replset<br \/>\n    &#8230;..<\/p>\n<p>    > rs.status()<br \/>\n {<br \/>\n  &#8220;info&#8221; : &#8220;run rs.initiate(&#8230;) if not yet done for the set&#8221;,<br \/>\n  &#8220;ok&#8221; : 0,<br \/>\n  &#8220;errmsg&#8221; : &#8220;no replset config has been received&#8221;,<br \/>\n  &#8220;code&#8221; : 94,<br \/>\n  &#8220;codeName&#8221; : &#8220;NotYetInitialized&#8221;<br \/>\n    }<\/p>\n<p>    > rs.initiate()<br \/>\n {<br \/>\n  &#8220;info2&#8221; : &#8220;no configuration specified. Using a default configuration for the set&#8221;,<br \/>\n  &#8220;me&#8221; : &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n  &#8220;ok&#8221; : 1<br \/>\n }<\/p>\n<p>    rs0:OTHER><br \/>\n rs0:PRIMARY> rs.status()<br \/>\n {<br \/>\n  &#8220;set&#8221; : &#8220;rs0&#8221;,<br \/>\n  &#8220;date&#8221; : ISODate(&#8220;2017-05-18T17:00:49.868Z&#8221;),<br \/>\n  &#8220;myState&#8221; : 1,<br \/>\n  &#8220;term&#8221; : NumberLong(1),<br \/>\n  &#8220;heartbeatIntervalMillis&#8221; : NumberLong(2000),<br \/>\n  &#8220;optimes&#8221; : {<br \/>\n   &#8220;lastCommittedOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495126845, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(1)<br \/>\n   },<br \/>\n   &#8220;appliedOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495126845, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(1)<br \/>\n   },<br \/>\n   &#8220;durableOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495126845, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(1)<br \/>\n   }<br \/>\n  },<br \/>\n  &#8220;members&#8221; : [<br \/>\n   {<br \/>\n    &#8220;_id&#8221; : 0,<br \/>\n    &#8220;name&#8221; : &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n    &#8220;health&#8221; : 1,<br \/>\n    &#8220;state&#8221; : 1,<br \/>\n    &#8220;stateStr&#8221; : &#8220;PRIMARY&#8221;,<br \/>\n    &#8220;uptime&#8221; : 1239,<br \/>\n    &#8220;optime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495126845, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(1)<br \/>\n    },<br \/>\n    &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-18T17:00:45Z&#8221;),<br \/>\n    &#8220;infoMessage&#8221; : &#8220;could not find member to sync from&#8221;,<br \/>\n    &#8220;electionTime&#8221; : Timestamp(1495126824, 2),<br \/>\n    &#8220;electionDate&#8221; : ISODate(&#8220;2017-05-18T17:00:24Z&#8221;),<br \/>\n    &#8220;configVersion&#8221; : 1,<br \/>\n    &#8220;self&#8221; : true<br \/>\n   }<br \/>\n  ],<br \/>\n  &#8220;ok&#8221; : 1<br \/>\n }<\/p>\n<p>    rs0:PRIMARY> rs.add(&#8220;node2.rmohan.com&#8221;)<br \/>\n { &#8220;ok&#8221; : 1 }<br \/>\n rs0:PRIMARY> rs.add(&#8220;node3.rmohan.com&#8221;)<br \/>\n { &#8220;ok&#8221; : 1 }<br \/>\n    rs0:PRIMARY> rs.status()<br \/>\n {<br \/>\n  &#8220;set&#8221; : &#8220;rs0&#8221;,<br \/>\n  &#8220;date&#8221; : ISODate(&#8220;2017-05-18T17:08:47.724Z&#8221;),<br \/>\n  &#8220;myState&#8221; : 1,<br \/>\n  &#8220;term&#8221; : NumberLong(1),<br \/>\n  &#8220;heartbeatIntervalMillis&#8221; : NumberLong(2000),<br \/>\n  &#8220;optimes&#8221; : {<br \/>\n   &#8220;lastCommittedOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495127325, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(1)<br \/>\n   },<br \/>\n   &#8220;appliedOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495127325, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(1)<br \/>\n   },<br \/>\n   &#8220;durableOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495127325, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(1)<br \/>\n   }<br \/>\n  },<br \/>\n  &#8220;members&#8221; : [<br \/>\n   {<br \/>\n    &#8220;_id&#8221; : 0,<br \/>\n    &#8220;name&#8221; : &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n    &#8220;health&#8221; : 1,              \/\/<br \/>\n    &#8220;state&#8221; : 1,              \/\/1???PRIMARY?slave<br \/>\n    &#8220;stateStr&#8221; : &#8220;PRIMARY&#8221;,    \/\/<br \/>\n    &#8220;uptime&#8221; : 1717,<br \/>\n    &#8220;optime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495127325, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(1)<br \/>\n    },<br \/>\n    &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-18T17:08:45Z&#8221;),<br \/>\n    &#8220;electionTime&#8221; : Timestamp(1495126824, 2),<br \/>\n    &#8220;electionDate&#8221; : ISODate(&#8220;2017-05-18T17:00:24Z&#8221;),<br \/>\n    &#8220;configVersion&#8221; : 3,<br \/>\n    &#8220;self&#8221; : true<br \/>\n   },<br \/>\n   {<br \/>\n    &#8220;_id&#8221; : 1,<br \/>\n    &#8220;name&#8221; : &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n    &#8220;health&#8221; : 1,<br \/>\n    &#8220;state&#8221; : 2,<br \/>\n    &#8220;stateStr&#8221; : &#8220;SECONDARY&#8221;,<br \/>\n    &#8220;uptime&#8221; : 64,<br \/>\n    &#8220;optime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495127325, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(1)<br \/>\n    },<br \/>\n    &#8220;optimeDurable&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495127325, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(1)<br \/>\n    },<br \/>\n    &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-18T17:08:45Z&#8221;),<br \/>\n    &#8220;optimeDurableDate&#8221; : ISODate(&#8220;2017-05-18T17:08:45Z&#8221;),<br \/>\n    &#8220;lastHeartbeat&#8221; : ISODate(&#8220;2017-05-18T17:08:46.106Z&#8221;),<br \/>\n    &#8220;lastHeartbeatRecv&#8221; : ISODate(&#8220;2017-05-18T17:08:47.141Z&#8221;),<br \/>\n    &#8220;pingMs&#8221; : NumberLong(0),<br \/>\n    &#8220;syncingTo&#8221; : &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n    &#8220;configVersion&#8221; : 3<br \/>\n   },<br \/>\n   {<br \/>\n    &#8220;_id&#8221; : 2,<br \/>\n    &#8220;name&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n    &#8220;health&#8221; : 1,<br \/>\n    &#8220;state&#8221; : 2,<br \/>\n    &#8220;stateStr&#8221; : &#8220;SECONDARY&#8221;,<br \/>\n    &#8220;uptime&#8221; : 55,<br \/>\n    &#8220;optime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495127325, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(1)<br \/>\n    },<br \/>\n    &#8220;optimeDurable&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495127325, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(1)<br \/>\n    },<br \/>\n    &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-18T17:08:45Z&#8221;),<br \/>\n    &#8220;optimeDurableDate&#8221; : ISODate(&#8220;2017-05-18T17:08:45Z&#8221;),<br \/>\n    &#8220;lastHeartbeat&#8221; : ISODate(&#8220;2017-05-18T17:08:46.195Z&#8221;),<br \/>\n    &#8220;lastHeartbeatRecv&#8221; : ISODate(&#8220;2017-05-18T17:08:46.924Z&#8221;),<br \/>\n    &#8220;pingMs&#8221; : NumberLong(0),<br \/>\n    &#8220;syncingTo&#8221; : &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n    &#8220;configVersion&#8221; : 3<br \/>\n   }<br \/>\n  ],<br \/>\n  &#8220;ok&#8221; : 1<br \/>\n }<\/p>\n<p>    rs0:PRIMARY> db.isMaster()<br \/>\n {<br \/>\n  &#8220;hosts&#8221; : [<br \/>\n   &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n   &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n   &#8220;node3.rmohan.com:27017&#8221;<br \/>\n  ],<br \/>\n  &#8220;setName&#8221; : &#8220;rs0&#8221;,<br \/>\n  &#8220;setVersion&#8221; : 3,<br \/>\n  &#8220;ismaster&#8221; : true,<br \/>\n  &#8220;secondary&#8221; : false,<br \/>\n  &#8220;primary&#8221; : &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n  &#8220;me&#8221; : &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n  &#8220;electionId&#8221; : ObjectId(&#8220;7fffffff0000000000000001&#8221;),<br \/>\n  &#8220;lastWrite&#8221; : {<br \/>\n   &#8220;opTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495127705, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(1)<br \/>\n   },<br \/>\n   &#8220;lastWriteDate&#8221; : ISODate(&#8220;2017-05-18T17:15:05Z&#8221;)<br \/>\n  },<br \/>\n  &#8220;maxBsonObjectSize&#8221; : 16777216,<br \/>\n  &#8220;maxMessageSizeBytes&#8221; : 48000000,<br \/>\n  &#8220;maxWriteBatchSize&#8221; : 1000,<br \/>\n  &#8220;localTime&#8221; : ISODate(&#8220;2017-05-18T17:15:11.146Z&#8221;),<br \/>\n  &#8220;maxWireVersion&#8221; : 5,<br \/>\n  &#8220;minWireVersion&#8221; : 0,<br \/>\n  &#8220;readOnly&#8221; : false,<br \/>\n  &#8220;ok&#8221; : 1<br \/>\n }<\/p>\n<p>    rs0:PRIMARY> use testdb<br \/>\n    rs0:PRIMARY> show collections<br \/>\n testcoll<br \/>\n rs0:PRIMARY> db.testcoll.find()<br \/>\n { &#8220;_id&#8221; : ObjectId(&#8220;591dd9f965cc255a5373aefa&#8221;), &#8220;name&#8221; : &#8220;tom&#8221;, &#8220;age&#8221; : 25 }<\/p>\n<p>    node2:<br \/>\n    rs0:SECONDARY> rs.slaveOk()<br \/>\n rs0:SECONDARY> show dbs<br \/>\n admin  0.000GB<br \/>\n local  0.000GB<br \/>\n testdb  0.000GB<br \/>\n rs0:SECONDARY> use testdb<br \/>\n switched to db testdb<br \/>\n rs0:SECONDARY> show collections<br \/>\n testcoll<br \/>\n rs0:SECONDARY> db.testcoll.find()<br \/>\n { &#8220;_id&#8221; : ObjectId(&#8220;591dd9f965cc255a5373aefa&#8221;), &#8220;name&#8221; : &#8220;tom&#8221;, &#8220;age&#8221; : 25 }<br \/>\n rs0:SECONDARY> <\/p>\n<p>    node3:<\/p>\n<p>    rs0:SECONDARY> rs.slaveOk()<br \/>\n rs0:SECONDARY> show dbs<br \/>\n admin  0.000GB<br \/>\n local  0.000GB<br \/>\n testdb  0.000GB<br \/>\n rs0:SECONDARY> use testdb<br \/>\n switched to db testdb<br \/>\n rs0:SECONDARY> show collections<br \/>\n testcoll<br \/>\n rs0:SECONDARY> db.testcoll.find()<br \/>\n { &#8220;_id&#8221; : ObjectId(&#8220;591dd9f965cc255a5373aefa&#8221;), &#8220;name&#8221; : &#8220;tom&#8221;, &#8220;age&#8221; : 25 }<br \/>\n rs0:SECONDARY><\/p>\n<p>    rs0:PRIMARY> use local<br \/>\n switched to db local<br \/>\n rs0:PRIMARY> show collections<br \/>\n me<br \/>\n oplog.rs<br \/>\n replset.election<br \/>\n replset.minvalid<br \/>\n startup_log<br \/>\n system.replset<br \/>\n rs0:PRIMARY> db.oplog.rs.find()<br \/>\n { &#8220;ts&#8221; : Timestamp(1495126824, 1), &#8220;h&#8221; : NumberLong(&#8220;3056083863196084673&#8221;), &#8220;v&#8221; : 2, &#8220;op&#8221; : &#8220;n&#8221;, &#8220;ns&#8221; : &#8220;&#8221;, &#8220;o&#8221; : { &#8220;msg&#8221; : &#8220;initiating set&#8221; } }<br \/>\n { &#8220;ts&#8221; : Timestamp(1495126825, 1), &#8220;t&#8221; : NumberLong(1), &#8220;h&#8221; : NumberLong(&#8220;7195178065440751511&#8221;), &#8220;v&#8221; : 2, &#8220;op&#8221; : &#8220;n&#8221;, &#8220;ns&#8221; : &#8220;&#8221;, &#8220;o&#8221; : { &#8220;msg&#8221; : &#8220;new primary&#8221; } }<br \/>\n { &#8220;ts&#8221; : Timestamp(1495126835, 1), &#8220;t&#8221; : NumberLong(1), &#8220;h&#8221; : NumberLong(&#8220;5723995478292318850&#8221;), &#8220;v&#8221; : 2, &#8220;op&#8221; : &#8220;n&#8221;, &#8220;ns&#8221; : &#8220;&#8221;, &#8220;o&#8221; : { &#8220;msg&#8221; : &#8220;periodic noop&#8221; } }<br \/>\n { &#8220;ts&#8221; : Timestamp(1495126845, 1), &#8220;t&#8221; : NumberLong(1), &#8220;h&#8221; : NumberLong(&#8220;-3772304067699003381&#8221;), &#8220;v&#8221; : 2, &#8220;op&#8221; : &#8220;n&#8221;, &#8220;ns&#8221; : &#8220;&#8221;, &#8220;o&#8221;<\/p>\n<p>    rs0:PRIMARY> db.printReplicationInfo()<br \/>\n configured oplog size:  1024MB<br \/>\n log length start to end: 2541secs (0.71hrs)<br \/>\n oplog first event time:  Fri May 19 2017 01:00:24 GMT+0800 (CST)<br \/>\n oplog last event time:  Fri May 19 2017 01:42:45 GMT+0800 (CST)<br \/>\n now:                    Fri May 19 2017 01:42:48 GMT+0800 (CST)<br \/>\n rs0:PRIMARY><\/p>\n<p> db.oplog.rs.find()?<br \/>\n db.printReplicationInfo()?<br \/>\n    db.printSlaveReplicationInfo()?<\/p>\n<p> rs0:PRIMARY> db.printSlaveReplicationInfo()<br \/>\n source: node2.rmohan.com:27017<br \/>\n  syncedTo: Fri May 19 2017 01:47:15 GMT+0800 (CST)<br \/>\n  0 secs (0 hrs) behind the primary<br \/>\n source: node3.rmohan.com:27017<br \/>\n  syncedTo: Fri May 19 2017 01:47:15 GMT+0800 (CST)<br \/>\n  0 secs (0 hrs) behind the primary <\/p>\n<p>    db.system.replset.find()?<\/p>\n<p>    rs0:PRIMARY> db.system.replset.find()<br \/>\n { &#8220;_id&#8221; : &#8220;rs0&#8221;, &#8220;version&#8221; : 3, &#8220;protocolVersion&#8221; : NumberLong(1), &#8220;members&#8221; : [ { &#8220;_id&#8221; : 0, &#8220;host&#8221; : &#8220;node1.rmohan.com:27017&#8221;, &#8220;arbiterOnly&#8221; : false, &#8220;buildIndexes&#8221; : true, &#8220;hidden&#8221; : false, &#8220;priority&#8221; : 1, &#8220;tags&#8221; : {  }, &#8220;slaveDelay&#8221; : NumberLong(0), &#8220;votes&#8221; : 1 }, { &#8220;_id&#8221; : 1, &#8220;host&#8221; : &#8220;node2.rmohan.com:27017&#8221;, &#8220;arbiterOnly&#8221; : false, &#8220;buildIndexes&#8221; : true, &#8220;hidden&#8221; : false, &#8220;priority&#8221; : 1, &#8220;tags&#8221; : {  }, &#8220;slaveDelay&#8221; : NumberLong(0), &#8220;votes&#8221; : 1 }, { &#8220;_id&#8221; : 2, &#8220;host&#8221; : &#8220;node3.rmohan.com:27017&#8221;, &#8220;arbiterOnly&#8221; : false, &#8220;buildIndexes&#8221; : true, &#8220;hidden&#8221; : false, &#8220;priority&#8221; : 1, &#8220;tags&#8221; : {  }, &#8220;slaveDelay&#8221; : NumberLong(0), &#8220;votes&#8221; : 1 } ], &#8220;settings&#8221; : { &#8220;chainingAllowed&#8221; : true, &#8220;heartbeatIntervalMillis&#8221; : 2000, &#8220;heartbeatTimeoutSecs&#8221; : 10, &#8220;electionTimeoutMillis&#8221; : 10000, &#8220;catchUpTimeoutMillis&#8221; : 2000, &#8220;getLastErrorModes&#8221; : {  }, &#8220;getLastErrorDefaults&#8221; : { &#8220;w&#8221; : 1, &#8220;wtimeout&#8221; : 0 }, &#8220;replicaSetId&#8221; : ObjectId(&#8220;591dd3284fc6957e660dc933&#8221;) } }<\/p>\n<p>  rs0:PRIMARY> db.system.replset.find().forEach(printjson)  <\/p>\n<p>    1 node3<\/p>\n<p>    rs0:SECONDARY> rs.freeze(30)<br \/>\n    { &#8220;ok&#8221; : 1 }<\/p>\n<p>    2?node1 PRIMARY<br \/>\n    rs0:PRIMARY> rs.stepDown(30)<br \/>\n 2017-05-19T02:09:27.945+0800 E QUERY    [thread1] Error: error doing query: failed: network error while attempting to run command &#8216;replSetStepDown&#8217; on host &#8216;127.0.0.1:27017&#8217;  :<br \/>\n DB.prototype.runCommand@src\/mongo\/shell\/db.js:132:1<br \/>\n DB.prototype.adminCommand@src\/mongo\/shell\/db.js:150:16<br \/>\n rs.stepDown@src\/mongo\/shell\/utils.js:1261:12<br \/>\n @(shell):1:1<br \/>\n 2017-05-19T02:09:27.947+0800 I NETWORK  [thread1] trying reconnect to 127.0.0.1:27017 (127.0.0.1) failed<br \/>\n 2017-05-19T02:09:27.949+0800 I NETWORK  [thread1] reconnect 127.0.0.1:27017 (127.0.0.1) ok<\/p>\n<p>    30<br \/>\n rs0:SECONDARY> rs.status()<br \/>\n {<br \/>\n  &#8220;set&#8221; : &#8220;rs0&#8221;,<br \/>\n  &#8220;date&#8221; : ISODate(&#8220;2017-05-18T18:12:09.732Z&#8221;),<br \/>\n  &#8220;myState&#8221; : 2,<br \/>\n  &#8220;term&#8221; : NumberLong(2),<br \/>\n  &#8220;syncingTo&#8221; : &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n  &#8220;heartbeatIntervalMillis&#8221; : NumberLong(2000),<br \/>\n  &#8220;optimes&#8221; : {<br \/>\n   &#8220;lastCommittedOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495131128, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(2)<br \/>\n   },<br \/>\n   &#8220;appliedOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495131128, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(2)<br \/>\n   },<br \/>\n   &#8220;durableOpTime&#8221; : {<br \/>\n    &#8220;ts&#8221; : Timestamp(1495131128, 1),<br \/>\n    &#8220;t&#8221; : NumberLong(2)<br \/>\n   }<br \/>\n  },<br \/>\n  &#8220;members&#8221; : [<br \/>\n   {<br \/>\n    &#8220;_id&#8221; : 0,<br \/>\n    &#8220;name&#8221; : &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n    &#8220;health&#8221; : 1,<br \/>\n    &#8220;state&#8221; : 2,<br \/>\n    &#8220;stateStr&#8221; : &#8220;SECONDARY&#8221;,<br \/>\n    &#8220;uptime&#8221; : 5519,<br \/>\n    &#8220;optime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495131128, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(2)<br \/>\n    },<br \/>\n    &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-18T18:12:08Z&#8221;),<br \/>\n    &#8220;syncingTo&#8221; : &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n    &#8220;configVersion&#8221; : 3,<br \/>\n    &#8220;self&#8221; : true<br \/>\n   },<br \/>\n   {<br \/>\n    &#8220;_id&#8221; : 1,<br \/>\n    &#8220;name&#8221; : &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n    &#8220;health&#8221; : 1,<br \/>\n    &#8220;state&#8221; : 1,<br \/>\n    &#8220;stateStr&#8221; : &#8220;PRIMARY&#8221;,<br \/>\n    &#8220;uptime&#8221; : 3866,<br \/>\n    &#8220;optime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495131118, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(2)<br \/>\n    },<br \/>\n    &#8220;optimeDurable&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495131118, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(2)<br \/>\n    },<br \/>\n    &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-18T18:11:58Z&#8221;),<br \/>\n    &#8220;optimeDurableDate&#8221; : ISODate(&#8220;2017-05-18T18:11:58Z&#8221;),<br \/>\n    &#8220;lastHeartbeat&#8221; : ISODate(&#8220;2017-05-18T18:12:08.333Z&#8221;),<br \/>\n    &#8220;lastHeartbeatRecv&#8221; : ISODate(&#8220;2017-05-18T18:12:08.196Z&#8221;),<br \/>\n    &#8220;pingMs&#8221; : NumberLong(0),<br \/>\n    &#8220;electionTime&#8221; : Timestamp(1495130977, 1),<br \/>\n    &#8220;electionDate&#8221; : ISODate(&#8220;2017-05-18T18:09:37Z&#8221;),<br \/>\n    &#8220;configVersion&#8221; : 3<br \/>\n   },<br \/>\n   {<br \/>\n    &#8220;_id&#8221; : 2,<br \/>\n    &#8220;name&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n    &#8220;health&#8221; : 1,<br \/>\n    &#8220;state&#8221; : 2,<br \/>\n    &#8220;stateStr&#8221; : &#8220;SECONDARY&#8221;,<br \/>\n    &#8220;uptime&#8221; : 3857,<br \/>\n    &#8220;optime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495131118, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(2)<br \/>\n    },<br \/>\n    &#8220;optimeDurable&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495131118, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(2)<br \/>\n    },<br \/>\n    &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-18T18:11:58Z&#8221;),<br \/>\n    &#8220;optimeDurableDate&#8221; : ISODate(&#8220;2017-05-18T18:11:58Z&#8221;),<br \/>\n    &#8220;lastHeartbeat&#8221; : ISODate(&#8220;2017-05-18T18:12:08.486Z&#8221;),<br \/>\n    &#8220;lastHeartbeatRecv&#8221; : ISODate(&#8220;2017-05-18T18:12:08.116Z&#8221;),<br \/>\n    &#8220;pingMs&#8221; : NumberLong(0),<br \/>\n    &#8220;syncingTo&#8221; : &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n    &#8220;configVersion&#8221; : 3<br \/>\n   }<br \/>\n  ],<br \/>\n  &#8220;ok&#8221; : 1<br \/>\n }<br \/>\n rs0:SECONDARY><\/p>\n<p>      [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/etc\/hosts root@node2.rmohan.com:\/etc\/<\/p>\n<p>      [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/mongodb\/mongokey root@node4.rmohan.com:\/mongodb\/<\/p>\n<p>      [root@node1 ~]# rsync -avH &#8211;progress &#8216;-e ssh -p 22&#8217; \/etc\/mongod.conf root@node4.rmohan.com:\/etc\/<\/p>\n<p>      [root@node4 ~]# iptables -I INPUT 4 -m state &#8211;state NEW -p tcp &#8211;dport 27017  -j ACCEPT<\/p>\n<p>      rs0:PRIMARY> rs.add(&#8220;node4.rmohan.com&#8221;)<br \/>\n  { &#8220;ok&#8221; : 1 }<\/p>\n<p>      rs0:PRIMARY> rs.status()<br \/>\n  {<br \/>\n   &#8220;set&#8221; : &#8220;rs0&#8221;,<br \/>\n   &#8220;date&#8221; : ISODate(&#8220;2017-05-19T12:12:57.697Z&#8221;),<br \/>\n   &#8220;myState&#8221; : 1,<br \/>\n   &#8220;term&#8221; : NumberLong(8),<br \/>\n   &#8220;heartbeatIntervalMillis&#8221; : NumberLong(2000),<br \/>\n   &#8220;optimes&#8221; : {<br \/>\n    &#8220;lastCommittedOpTime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(8)<br \/>\n    },<br \/>\n    &#8220;appliedOpTime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(8)<br \/>\n    },<br \/>\n    &#8220;durableOpTime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(8)<br \/>\n    }<br \/>\n   },<br \/>\n   &#8220;members&#8221; : [<br \/>\n    {<br \/>\n     &#8220;_id&#8221; : 0,<br \/>\n     &#8220;name&#8221; : &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n     &#8220;health&#8221; : 1,<br \/>\n     &#8220;state&#8221; : 2,<br \/>\n     &#8220;stateStr&#8221; : &#8220;SECONDARY&#8221;,<br \/>\n     &#8220;uptime&#8221; : 159,<br \/>\n     &#8220;optime&#8221; : {<br \/>\n      &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n      &#8220;t&#8221; : NumberLong(8)<br \/>\n     },<br \/>\n     &#8220;optimeDurable&#8221; : {<br \/>\n      &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n      &#8220;t&#8221; : NumberLong(8)<br \/>\n     },<br \/>\n     &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-19T12:12:51Z&#8221;),<br \/>\n     &#8220;optimeDurableDate&#8221; : ISODate(&#8220;2017-05-19T12:12:51Z&#8221;),<br \/>\n     &#8220;lastHeartbeat&#8221; : ISODate(&#8220;2017-05-19T12:12:56.111Z&#8221;),<br \/>\n     &#8220;lastHeartbeatRecv&#8221; : ISODate(&#8220;2017-05-19T12:12:57.101Z&#8221;),<br \/>\n     &#8220;pingMs&#8221; : NumberLong(0),<br \/>\n     &#8220;syncingTo&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n     &#8220;configVersion&#8221; : 4<br \/>\n    },<br \/>\n    {<br \/>\n     &#8220;_id&#8221; : 1,<br \/>\n     &#8220;name&#8221; : &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n     &#8220;health&#8221; : 1,<br \/>\n     &#8220;state&#8221; : 2,<br \/>\n     &#8220;stateStr&#8221; : &#8220;SECONDARY&#8221;,<br \/>\n     &#8220;uptime&#8221; : 189,<br \/>\n     &#8220;optime&#8221; : {<br \/>\n      &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n      &#8220;t&#8221; : NumberLong(8)<br \/>\n     },<br \/>\n     &#8220;optimeDurable&#8221; : {<br \/>\n      &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n      &#8220;t&#8221; : NumberLong(8)<br \/>\n     },<br \/>\n     &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-19T12:12:51Z&#8221;),<br \/>\n     &#8220;optimeDurableDate&#8221; : ISODate(&#8220;2017-05-19T12:12:51Z&#8221;),<br \/>\n     &#8220;lastHeartbeat&#8221; : ISODate(&#8220;2017-05-19T12:12:56.111Z&#8221;),<br \/>\n     &#8220;lastHeartbeatRecv&#8221; : ISODate(&#8220;2017-05-19T12:12:57.103Z&#8221;),<br \/>\n     &#8220;pingMs&#8221; : NumberLong(0),<br \/>\n     &#8220;syncingTo&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n     &#8220;configVersion&#8221; : 4<br \/>\n    },<br \/>\n    {<br \/>\n     &#8220;_id&#8221; : 2,<br \/>\n     &#8220;name&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n     &#8220;health&#8221; : 1,<br \/>\n     &#8220;state&#8221; : 1,<br \/>\n     &#8220;stateStr&#8221; : &#8220;PRIMARY&#8221;,<br \/>\n     &#8220;uptime&#8221; : 191,<br \/>\n     &#8220;optime&#8221; : {<br \/>\n      &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n      &#8220;t&#8221; : NumberLong(8)<br \/>\n     },<br \/>\n     &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-19T12:12:51Z&#8221;),<br \/>\n     &#8220;electionTime&#8221; : Timestamp(1495195800, 1),<br \/>\n     &#8220;electionDate&#8221; : ISODate(&#8220;2017-05-19T12:10:00Z&#8221;),<br \/>\n     &#8220;configVersion&#8221; : 4,<br \/>\n     &#8220;self&#8221; : true<br \/>\n    },<br \/>\n    {<br \/>\n     &#8220;_id&#8221; : 3,<br \/>\n     &#8220;name&#8221; : &#8220;node4.rmohan.com:27017&#8221;,<br \/>\n     &#8220;health&#8221; : 1,<br \/>\n     &#8220;state&#8221; : 2,<br \/>\n     &#8220;stateStr&#8221; : &#8220;SECONDARY&#8221;,<br \/>\n     &#8220;uptime&#8221; : 71,<br \/>\n     &#8220;optime&#8221; : {<br \/>\n      &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n      &#8220;t&#8221; : NumberLong(8)<br \/>\n     },<br \/>\n     &#8220;optimeDurable&#8221; : {<br \/>\n      &#8220;ts&#8221; : Timestamp(1495195971, 1),<br \/>\n      &#8220;t&#8221; : NumberLong(8)<br \/>\n     },<br \/>\n     &#8220;optimeDate&#8221; : ISODate(&#8220;2017-05-19T12:12:51Z&#8221;),<br \/>\n     &#8220;optimeDurableDate&#8221; : ISODate(&#8220;2017-05-19T12:12:51Z&#8221;),<br \/>\n     &#8220;lastHeartbeat&#8221; : ISODate(&#8220;2017-05-19T12:12:56.122Z&#8221;),<br \/>\n     &#8220;lastHeartbeatRecv&#8221; : ISODate(&#8220;2017-05-19T12:12:56.821Z&#8221;),<br \/>\n     &#8220;pingMs&#8221; : NumberLong(1),<br \/>\n     &#8220;syncingTo&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n     &#8220;configVersion&#8221; : 4<br \/>\n    }<br \/>\n   ],<br \/>\n   &#8220;ok&#8221; : 1<br \/>\n  }<\/p>\n<p>  rs0:SECONDARY> rs.slaveOk()<br \/>\n  rs0:SECONDARY> show dbs<br \/>\n  admin  0.000GB<br \/>\n  local  0.000GB<br \/>\n  testdb  0.000GB<br \/>\n  rs0:SECONDARY> use testdb<br \/>\n  switched to db testdb<br \/>\n  rs0:SECONDARY> show collections<br \/>\n  testcoll<br \/>\n  rs0:SECONDARY> db.testcoll.find()<br \/>\n  { &#8220;_id&#8221; : ObjectId(&#8220;591dd9f965cc255a5373aefa&#8221;), &#8220;name&#8221; : &#8220;tom&#8221;, &#8220;age&#8221; : 25 }<br \/>\n  rs0:SECONDARY><br \/>\n  rs0:SECONDARY> db.isMaster()<br \/>\n  {<br \/>\n   &#8220;hosts&#8221; : [<br \/>\n    &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n    &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n    &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n    &#8220;node4.rmohan.com:27017&#8221;<br \/>\n   ],<br \/>\n   &#8220;setName&#8221; : &#8220;rs0&#8221;,<br \/>\n   &#8220;setVersion&#8221; : 4,<br \/>\n   &#8220;ismaster&#8221; : false,<br \/>\n   &#8220;secondary&#8221; : true,<br \/>\n   &#8220;primary&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n   &#8220;me&#8221; : &#8220;node4.rmohan.com:27017&#8221;,<br \/>\n   &#8220;lastWrite&#8221; : {<br \/>\n    &#8220;opTime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495196261, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(8)<br \/>\n    },<br \/>\n    &#8220;lastWriteDate&#8221; : ISODate(&#8220;2017-05-19T12:17:41Z&#8221;)<br \/>\n   },<br \/>\n   &#8220;maxBsonObjectSize&#8221; : 16777216,<br \/>\n   &#8220;maxMessageSizeBytes&#8221; : 48000000,<br \/>\n   &#8220;maxWriteBatchSize&#8221; : 1000,<br \/>\n   &#8220;localTime&#8221; : ISODate(&#8220;2017-05-19T12:17:44.104Z&#8221;),<br \/>\n   &#8220;maxWireVersion&#8221; : 5,<br \/>\n   &#8220;minWireVersion&#8221; : 0,<br \/>\n   &#8220;readOnly&#8221; : false,<br \/>\n   &#8220;ok&#8221; : 1<br \/>\n  }<br \/>\n  rs0:SECONDARY><\/p>\n<p>    2?<\/p>\n<p>        rs0:PRIMARY> rs.remove(&#8220;node4.rmohan.com:27017&#8221;)<br \/>\n  { &#8220;ok&#8221; : 1 }<\/p>\n<p>        rs0:PRIMARY> db.isMaster()<br \/>\n  {<br \/>\n   &#8220;hosts&#8221; : [<br \/>\n    &#8220;node1.rmohan.com:27017&#8221;,<br \/>\n    &#8220;node2.rmohan.com:27017&#8221;,<br \/>\n    &#8220;node3.rmohan.com:27017&#8221;<br \/>\n   ],<br \/>\n   &#8220;setName&#8221; : &#8220;rs0&#8221;,<br \/>\n   &#8220;setVersion&#8221; : 5,<br \/>\n   &#8220;ismaster&#8221; : true,<br \/>\n   &#8220;secondary&#8221; : false,<br \/>\n   &#8220;primary&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n   &#8220;me&#8221; : &#8220;node3.rmohan.com:27017&#8221;,<br \/>\n   &#8220;electionId&#8221; : ObjectId(&#8220;7fffffff0000000000000008&#8221;),<br \/>\n   &#8220;lastWrite&#8221; : {<br \/>\n    &#8220;opTime&#8221; : {<br \/>\n     &#8220;ts&#8221; : Timestamp(1495196531, 1),<br \/>\n     &#8220;t&#8221; : NumberLong(8)<br \/>\n    },<br \/>\n    &#8220;lastWriteDate&#8221; : ISODate(&#8220;2017-05-19T12:22:11Z&#8221;)<br \/>\n   },<br \/>\n   &#8220;maxBsonObjectSize&#8221; : 16777216,<br \/>\n   &#8220;maxMessageSizeBytes&#8221; : 48000000,<br \/>\n   &#8220;maxWriteBatchSize&#8221; : 1000,<br \/>\n   &#8220;localTime&#8221; : ISODate(&#8220;2017-05-19T12:22:19.874Z&#8221;),<br \/>\n   &#8220;maxWireVersion&#8221; : 5,<br \/>\n   &#8220;minWireVersion&#8221; : 0,<br \/>\n   &#8220;readOnly&#8221; : false,<br \/>\n   &#8220;ok&#8221; : 1<br \/>\n  }<br \/>\n  rs0:PRIMARY><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MongoDB replication set settings Replication Sets<\/p>\n<p>Master-Slave Master-slave replication: -master only need to add a parameter when a service starts, while another service plus -slave and -source parameters, you can achieve synchronization.<\/p>\n<p>The latest version of MongoDB is no longer recommended for this program.<\/p>\n<p>Replica Sets replication set: MongoDB version 1.6 for developers of new [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6751"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6751"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6751\/revisions"}],"predecessor-version":[{"id":6752,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6751\/revisions\/6752"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}