环境信息
生产环境
| 节点名称 | 节点IP | 节点角色 |
|---|---|---|
| redis51 | 172.16.1.51 | MongoDB分片集群 |
| redis52 | 172.16.1.52 | MongoDB分片集群 |
| redis53 | 172.16.1.53 | MongoDB分片集群 |
新集群环境
| 节点名称 | 节点IP | 节点角色 |
|---|---|---|
| mongo1 | 172.16.1.41 | MongoDB分片集群 |
| mongo2 | 172.16.1.43 | MongoDB分片集群 |
| mongo3 | 172.16.1.47 | MongoDB分片集群 |
备份数据
查询数据库数据条目
mongos> use xxx; |
备份数据库
mongodump -u root -p "xxxxxxxx" -h 172.16.1.53 --port 27000 --authenticationDatabase admin --db xxxxx -o xxxxx |
恢复数据
数据恢复到数据库
mongorestore --host 172.16.1:27000 --username root --password xxxxxxxx --authenticationDatabase admin --db llm_workflow_backup --dir llm_workflow/ |
恢复完成检查数据库
mongo --host 192.168.2.21:27000 --username root --password xxxxxxx --authenticationDatabase admin |
检查数据库表
mongos> use xxxxx |
确认备份数据和恢复数据保持一致
mongos> db.getCollectionNames().forEach(function(c) { print("Collection: " + c + ", Count: " + db.getCollection(c).countDocuments({})); }); |

