這期內(nèi)容當(dāng)中小編將會給大家?guī)碛嘘P(guān)MongoDB中怎么修復(fù)config配置節(jié)點(diǎn),文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
修復(fù)流程如下:
# 登錄到config庫,查看config的節(jié)點(diǎn)狀態(tài)
# 可以看到_id為2的節(jié)點(diǎn)狀態(tài)是不可訪問的
[root@mongos-mq ~]# /opt/mongodb-linux-x86_64-3.2.10/bin/mongo --port 10000 MongoDB shell version: 3.2.10 connecting to: 127.0.0.1:10000/test config_rs:PRIMARY> use admin switched to db admin config_rs:PRIMARY> db.auth("root", "xxx") 1 config_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:10000", "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: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:10000", "configVersion" : 3 }, { "_id" : 2, "name" : "192.168.210.207:10000", "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 } # 在故障節(jié)點(diǎn)上面重新安裝MongoDB,創(chuàng)建數(shù)據(jù)文件目錄 [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 # 配置參數(shù)文件 [root@tomcat-207 opt]# cat /etc/mongodb/config_rs1_10000.conf systemLog: destination: file path: /data/mongodb_data/config_rs1_10000/mongod.log processManagement: fork: true net: bindIp: 0.0.0.0 port: 10000 security: keyFile: /data/mongodb_data/keyfile storage: dbPath: /data/mongodb_data/config_rs1_10000 directoryPerDB: true operationProfiling: slowOpThresholdMs: 100 mode: slowOp replication: replSetName: config_rs sharding: clusterRole: configsvr # 從其他config節(jié)點(diǎn)拷貝過來keyfile文件 [root@mongos-mq opt]# scp /data/mongodb_data/keyfile root@192.168.210.207:/data/mongodb_data/ # 啟動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: 3744 child process started successfully, parent exiting # 查看config節(jié)點(diǎn)狀態(tài) # 所有的config節(jié)點(diǎn)都恢復(fù)正常 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: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:10000", "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.208:10000", "configVersion" : 3 }, { "_id" : 2, "name" : "192.168.210.207:10000", "health" : 1, "state" : 2, "stateStr" : "SECONDARY", "uptime" : 1588, "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.691Z"), "pingMs" : NumberLong(0), "syncingTo" : "192.168.210.209:10000", "configVersion" : 3 } ], "ok" : 1 }
上述就是小編為大家分享的MongoDB中怎么修復(fù)config配置節(jié)點(diǎn)了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道。
當(dāng)前名稱:MongoDB中怎么修復(fù)config配置節(jié)點(diǎn)-創(chuàng)新互聯(lián)
當(dāng)前鏈接:http://aaarwkj.com/article36/ppopg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、搜索引擎優(yōu)化、網(wǎng)站排名、定制網(wǎng)站、網(wǎng)站內(nèi)鏈、做網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容