事象
レプリケーションの状態が以下のようなmemberが存在し
"state" : 3, "stateStr" : "RECOVERING", ... "lastHeartbeatMessage" : "",...
以下のエラーにて事象が解消しない。
REPL [rsBackgroundSync] sync source candidate: xx REPL [replication-0] We are too stale to use xx as a sync source. Blacklisting this sync source because our last fetched timestamp: Timestamp xx is before their earliest timestamp: Timestamp(xx) for 1min until: xx
尚。時刻同期が疑われるメッセージが出ているが各サーバの時刻は同期している。
環境情報
- Mongo v4.0
解決策
PRIMARYより以下でmemberから切り離し
rs.remove("xx")
RECOVERING状態のデータ領域をファイルシステム上からrmコマンドで削除。
削除後に再度memberに追加し
rs.add("xx")
RECOVERING状態のMongoプロセスを再起動すると復旧。
以下、補足です。
補足
上記を実践しました。
すると以下のように新規セッションが別のmemberから発生して
REPL [initandlisten] Initialized the rollback ID to 1 REPL [initandlisten] Did not find local replica set configuration document at startup; NoMatchingDocument: Did not find replica set configuration document in local.system.replset NETWORK [initandlisten] waiting for connections on port 27017 NETWORK [listener] connection accepted from xx #1 (1 connection now open) ...
続いて以下のようにレプリケーションが走り
REPL [replexec-0] transition to STARTUP2 from STARTUP REPL [replexec-0] Starting replication storage thread
レプリケーションが完了すると以下のように復旧しました。
REPL [replication-1] transition to RECOVERING from STARTUP2 REPL [replication-1] Starting replication fetcher thread ... REPL [rsSync-0] Starting oplog application REPL [rsSync-0] transition to SECONDARY from RECOVERING
以上、ご参考になれば幸いです。