尝试从主节点同步时,添加的副本集成员在检测到以前的数据时失败

问题描述 投票:0回答:1

通过删除每个主机上的本地数据库来删除任何旧副本的数据后,启动具有不同 replSetName 的新副本。

尝试添加另一个成员,当尝试从主副本同步并死亡时,它会找到先前副本的历史记录:

    {"t":{"$date":"2024-12-18T21:44:33.984+00:00"},"s":"I",  "c":"REPL",     "id":21358,   "ctx":"ReplCoord-0","msg":"Replica set state transition","attr":{"newState":"STARTUP2","oldState":"STARTUP"}}
    {"t":{"$date":"2024-12-18T21:44:33.985+00:00"},"s":"I",  "c":"REPL",     "id":21306,   "ctx":"ReplCoord-0","msg":"Starting replication storage threads"}
    {"t":{"$date":"2024-12-18T21:44:33.986+00:00"},"s":"I",  "c":"REPL",     "id":21827,   "ctx":"ReplCoord-1","msg":"Updating term","attr":{"oldTerm":0,"newTerm":1}}
    {"t":{"$date":"2024-12-18T21:44:33.986+00:00"},"s":"I",  "c":"REPL",     "id":21215,   "ctx":"ReplCoord-1","msg":"Member is in new state","attr":{"hostAndPort":"giftbutton.com:27017","newState":"PRIMARY"}}
    {"t":{"$date":"2024-12-18T21:44:33.986+00:00"},"s":"I",  "c":"NETWORK",  "id":6788700, "ctx":"conn3","msg":"Received first command on ingress connection since session start or auth handshake","attr":{"elapsedMillis":98}}
    {"t":{"$date":"2024-12-18T21:44:33.987+00:00"},"s":"I",  "c":"REPL",     "id":4280513, "ctx":"ReplCoord-0","msg":"Initial sync required. Attempting to start initial sync...","attr":{"lastOpTime":{"ts":{"$timestamp":{"t":0,"i":0}},"t":-1},"isInitialSyncFlagSet":false}}
    {"t":{"$date":"2024-12-18T21:44:33.988+00:00"},"s":"F",  "c":"REPL",     "id":9184100, "ctx":"ReplCoord-0","msg":"Previous data detected when attempting to start initial sync. Remove existing data in order to complete initial sync."}
    {"t":{"$date":"2024-12-18T21:44:33.988+00:00"},"s":"F",  "c":"ASSERT",   "id":23091,   "ctx":"ReplCoord-0","msg":"Fatal assertion","attr":{"msgid":9184100,"file":"src/mongo/db/repl/replication_coordinator_impl.cpp","line":974}}
    {"t":{"$date":"2024-12-18T21:44:33.988+00:00"},"s":"F",  "c":"ASSERT",   "id":23092,   "ctx":"ReplCoord-0","msg":"\n\n***aborting after fassert() failure\n\n"}

如何彻底删除该成员之前的副本集历史记录?为什么它会找到不同 replSetName 的副本集的先前历史记录??

任何副本集内容都保存在本地数据库中,在未启用复制的情况下运行时已被删除。历史记录还保存在哪里?

任何想法都值得赞赏。

mongodb mongodb-replica-set
1个回答
0
投票

建议的建议很明显,但它正在解决问题。

停止在不复制的情况下添加成员,转到其存储目录并删除所有内容。然后重新启动复制

storage:
  dbPath: /var/lib/mongodb
© www.soinside.com 2019 - 2024. All rights reserved.