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

How to repair config configuration Node in MongoDB

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how to repair config configuration nodes in MongoDB. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

The repair process is as follows:

# Log in to the config library to view the node status of config

# you can see that the node status with an id of 2 is inaccessible

[root@mongos-mq ~] # / opt/mongodb-linux-x86_64-3.2.10/bin/mongo-- port 10000MongoDB shell version: 3.2.10connecting to: 127.0.0.1:10000/testconfig_rs:PRIMARY > use adminswitched to db adminconfig_rs:PRIMARY > db.auth ("root", "xxx") 1config_rs:PRIMARY > rs.status () {"set": "config_rs", "date": ISODate ("2018-05-30T04:53:21.081Z") "myState": 1, "term": NumberLong (1), "configsvr": true, "heartbeatIntervalMillis": NumberLong (2000), "members": [{"_ id": 0, "name": "192.168.210.208 configsvr", "health": 1, "state": 1 StateStr: "PRIMARY", "uptime": 1112804, "optime": {"ts": Timestamp (1527656000, 1), "t": NumberLong (1)}, "optimeDate": ISODate ("2018-05-30T04:53:20Z"), "electionTime": Timestamp (1526543249, 2) "electionDate": ISODate ("2018-05-17T07:47:29Z"), "configVersion": 3, "self": true}, {"_ id": 1, "name": "192.168.210.209 state 10000", "health": 1, "state": 2 StateStr: SECONDARY, uptime: 1111358, optime: {"ts": Timestamp (1527656000, 1), "t": NumberLong (1)}, "optimeDate": ISODate ("2018-05-30T04:53:20Z") "lastHeartbeat": ISODate ("2018-05-30T04:53:20.836Z"), "lastHeartbeatRecv": ISODate ("2018-05-30T04:53:19.329Z"), "pingMs": NumberLong (0), "syncingTo": "192.168.210.208 30T04:53:20.836Z", "configVersion": 3} {"_ id": 2, "name": "192.168.210.207health", "health": 0, "state": 8, "stateStr": "(not reachable/healthy)", "uptime": 0 "optime": {"ts": Timestamp (0,0), "t": NumberLong (- 1)}, "optimeDate": ISODate ("1970-01-01T00:00:00Z"), "lastHeartbeat": ISODate ("2018-05-30T04:53:20.850Z") "lastHeartbeatRecv": ISODate ("2018-05-26T09:07:27.318Z"), "pingMs": NumberLong (0), "lastHeartbeatMessage": "Connection refused", "configVersion":-1}], "ok": 1} # reinstall MongoDB on the failed node Create a data file directory [root@tomcat-207 opt] # tar xfz mongodb-linux-x86_64-3.2.10.tgz [root @ tomcat-207 opt] # mkdir-p / data/mongodb_data/config_rs1_10000# configuration parameter file [root@tomcat-207 opt] # cat / etc/mongodb/config_rs1_10000.conf systemLog: destination: file path: / data/mongodb_data/config_rs1_10000/mongod.logprocessManagement: fork: Truenet: bindIp: 0.0.0.0 port: 10000security: keyFile: / data/mongodb_data/keyfilestorage: dbPath: / data/mongodb_data/config_rs1_10000 directoryPerDB: trueoperationProfiling: slowOpThresholdMs: 100mode: slowOpreplication: replSetName: config_rssharding: clusterRole: configsvr# copy the keyfile file from other config nodes [root@mongos-mq opt] # scp / data/mongodb_data/keyfile root@192.168.210.207: / data/mongodb_data/# starts Mongo [root @ mongos-mq opt] # / opt/mongodb-linux-x86_64-3.2.10/bin/mongod-f / etc/mongodb/config_rs1_10000.conf about to fork child process Waiting until server is ready for connections.forked process: 3744child process started successfully, parent exiting# View config Node status # all config nodes are back to normal config_rs:PRIMARY > rs.status () {"set": "config_rs", "date": ISODate ("2018-05-30T05:29:40.103Z"), "myState": 1, "term": NumberLong (1), "configsvr": true, "heartbeatIntervalMillis": NumberLong (2000) "members": [{"_ id": 0, "name": "192.168.210.208 state 10000", "health": 1, "state": 1, "stateStr": "PRIMARY", "uptime": 1114983 Optime: {"ts": Timestamp (1527658178, 4), "t": NumberLong (1)}, "optimeDate": ISODate ("2018-05-30T05:29:38Z"), "electionTime": Timestamp (1526543249, 2), "electionDate": ISODate ("2018-05-17T07:47:29Z") "configVersion": 3, "self": true}, {"_ id": 1, "name": "192.168.210.209 name", "health": 1, "state": 2, "stateStr": "SECONDARY", "uptime": 1113537 "optime": {"ts": Timestamp (1527658178, 4), "t": NumberLong (1)}, "optimeDate": ISODate ("2018-05-30T05:29:38Z"), "lastHeartbeat": ISODate ("2018-05-30T05:29:39.535Z") "lastHeartbeatRecv": ISODate ("2018-05-30T05:29:39.941Z"), "pingMs": NumberLong (0), "syncingTo": "192.168.210.20830T05:29:39.941Z", "configVersion": 3}, {"_ id": 2, "name": "192.168.210.207V10 000" "health": 1, "state": 2, "stateStr": "SECONDARY", "uptime": 1588, "optime": {"ts": Timestamp (1527658178), "t": NumberLong (1)} "optimeDate": ISODate ("2018-05-30T05:29:38Z"), "lastHeartbeat": ISODate ("2018-05-30T05:29:39.535Z"), "lastHeartbeatRecv": ISODate ("2018-05-30T05:29:39.691Z"), "pingMs": NumberLong (0), "syncingTo": "192.168.210.20910000" "configVersion": 3}], "ok": 1} above is how to fix the config configuration node in the MongoDB shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

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

Wechat

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

12
Report