Mongodb disaster recovery drill is operated step by step [for planned drills]
Remove rs.remove the mongo member planned as a disaster recovery drill from the replication set ("hostname:port")
Connect to the mongod disaster recovery node and change it from other state to primary
Cfg = rs.conf ()
Cfg.members = [{
"_ id": 10
"host": "hostname:port"
"arbiterOnly": false
"buildIndexes": true
"hidden": false
"priority": 1
"tags": {
}
"slaveDelay": NumberLong (0)
"votes": 1
}]
Rs.reconfig (cfg, {force:true})
Rs.conf ()
Check the admin library system.version and delete the {_ id: "minOpTimeRecovery"} record if it exists.
3. Connect to the config disaster recovery node and change it from other state to primary
Cfg = rs.conf ()
Cfg.members = [{
"_ id": 10
"host": "hostname:port"
"arbiterOnly": false
"buildIndexes": true
"hidden": false
"priority": 1
"tags": {
}
"slaveDelay": NumberLong (0)
"votes": 1
}]
Rs.reconfig (cfg, {force:true})
Rs.conf ()
4. # # Update sharding information
Use config
Db.shards.update ({_ id: "shard name"}, {$set: {"host": "disaster recovery node hostname: data node port number"})
5. Update the config connection node information in the mongos configuration file and modify it to the config node information of the disaster recovery walkthrough
6. The mongos of this period is ok, and this is the end of the drill done.
-The End