MongoDB修復config配置節點
生產環境的一套MongoDB發生故障,其中一個config節點的磁碟損壞。
修復流程如下:
修復流程如下:
-
# 登入到config庫,檢視config的節點狀態
-
# 可以看到_id為2的節點狀態是不可訪問的
-
[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
-
}
-
-
# 在故障節點上面重新安裝MongoDB,建立資料檔案目錄
-
[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
-
-
# 配置引數檔案
-
[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節點複製過來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節點狀態
-
# 所有的config節點都恢復正常
-
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
- }
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2155380/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mongodb主從仲裁節點配置MongoDB
- mongoDB當機修復MongoDB
- 【kingsql分享】RAC節點故障修復一例SQL
- MongoDB叢集搭建(包括隱藏節點,仲裁節點)MongoDB
- redis cluster 故障後,主從位於不同節點的修復。Redis
- redis cluster 強制kill某一個節點和shutdown某一個節點後修復過程Redis
- MySQL MGR如何修復資料不一致的節點MySql
- mongodb副本集新增刪除節點MongoDB
- MongoDB單節點部署與基本操作MongoDB
- App.config自定義節點讀取APP
- 如何修復MySQL配置檔案?MySql
- 【Mongodb】 replica set 新增和刪除節點。MongoDB
- mongodb叢集節點故障的切換方法MongoDB
- 【Mongodb】sharding 叢集Add/Remove 節點MongoDBREM
- Perfectly Clear WorkBench for Mac - 影像細節修復軟體Mac
- Perfectly Clear WorkBench for Mac 影像細節修復軟體Mac
- Perfectly Clear WorkBench Mac影像細節修復軟體Mac
- ElasticSearch(單節點)環境配置Elasticsearch
- 雲資料庫MongoDB單節點系列釋出資料庫MongoDB
- Android 修圖(換證件照背景,汙點修復)Android
- redis cluster 故障後,主從位於相同節點的修復(丟失了部分資料)Redis
- 配置dg broker的問題分析及修復
- 單機Linux下搭建MongoDB副本集-三節點LinuxMongoDB
- Centos7.9 部署mongodb高可用叢集 3節點CentOSMongoDB
- mongodb 基於oplog的時間點恢復MongoDB
- MongoDB 資料檔案損壞修復救命repair與致命危險MongoDBAI
- PrestaShop網站漏洞修復如何修復REST網站
- MongoDB副本集新增和刪除仲裁節點一例MongoDB
- MongoDB副本集節點的優先值修改一例MongoDB
- MongoDB分片叢集節點狀態stateStr:RECOVERING解決MongoDB
- 【Mongodb】 replica set 兩種新增節點方法的日誌分析MongoDB
- webstrom配置一鍵修復ESLint的報錯WebEsLint
- 程式執行中的幾個小配置修復
- RAC恢復到單例項節點上單例
- oracle9iRAC恢復一個節點Oracle
- 配置節點間的SSH信任關係
- RAC一個節點恢復另一個節點在帶庫上的備份
- win10電腦藍屏bad_system_config_info的修復方法Win10