Get the App
SLTechnology News&Howtos  ›  Database  › 

Mongodb disaster recovery drill is operated step by step [for planned drills]

Shulou Source: shulou.com Published: 2022-06-01 05:12:32 10月01日 Update

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

Tags: Nodes walkthroughs information status updates slogans data files periods film titles so far configuration steps Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple Linux NVidia Shulou Information