Mongodb adds and removes instances of Arbiter nodes

  • 2020-05-13 03:45:42
  • OfStack

Increase Arbiter

Add configuration files mongod1,mongod2,mongod3 for shard1, shard2, shard33 set sets arbiter.


replSet=shard1
replSet=shard2
replSet=shard3

Start the mongod instance.
Connection Primary.

rs.addArb( " 192.168.1.50:10001 " )
rs.addArb( " 192.168.1.50:10002 " )
rs.addArb( " 192.168.1.50:10003 " )

Remove Arbiter

rs.remove( " 192.168.1.50:10001 " )

Note: it is best to stop the service when removing nodes to prevent special unknown state.

Note:Before running the rs.remove() operation, you must shut down the replica set member that you're removing.
Changed in version 2.2: This procedure is no longer required when using rs.remove(), but it remains good practice.


Related articles: