LoginSignup
0
0

AuthenticationFailed: SCRAM authentication failed, storedKey mismatch

Posted at

問題背景

サーバーAのmongodb replica setに、サーバーBにある新しいmongod4をsecondary nodeとして追加した。

そして、mongod4のログを見ると、下記のエラーが出ている。

AuthenticationFailed: SCRAM authentication failed, storedKey mismatch

{"t":{"$date":"2024-04-03T16:44:30.213+09:00"},"s":"I",  "c":"ACCESS",   "id":20249,   "ctx":"conn11504","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-256","speculative":false,"principalName":"__system","authenticationDatabase":"local","remote":"xxx","extraInfo":{},"error":"AuthenticationFailed: SCRAM authentication failed, storedKey mismatch"}}

エラー原因

二つDBが使っているkeyFileが違っていた。

解決案

keyfileを一緒にすればよい。

ただ私の場合は、 md5sum /var/lib/keyfile で確認して、hashが一緒になってるけど、
エラーが解消されず、別の原因があった。

新しいサーバーにDBを構築したとき、keyFileの保存場所を間違っていた。

サーバーAでvi /etc/mongo1.confで見ると、

keyFile: /var/lib/mongo/keyfile

サーバーBでvi /etc/mongo4.confで見ると、

keyFile: /var/lib/keyfile

になっていることがわかった。

保存場所を同じにしたら、問題解消。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0