Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report