Auth mechnism failing in mongodb?

mongod.conf에서 아래 항목을 사용하여 mongod를 시작하려고 할 때, mongod가 실행되지 않고 다음과 같은 오류가 발생합니다:
mongod.service : main process exited, code=exited, status=2/INVALIDARGUMENT

mongod.conf에서 authenticationMechanisms: SCRAM-SHA-1 항목을 주석 처리하면 정상적으로 mongod가 실행됩니다.

security:
    authorization: enabled
    clusterAuthMode: keyFile
    keyFile:/st/mongodb/mongodb-keyfile
    authenticationMechanisms: SCRAM-SHA-1

parameter issue is fixed now: but in log we are getting this error below:-

"C": "ACCESS", "id": 507, "ctx": "conn20", "msg": "Failed to authenticate", "attr""{"client": "10.0.3.12:554","isSpeculative":"true,"isClusterMember":false,"mechanism":"SCRAM-SHA-256","user":"Mtxader","db":
"MtxDatabase", "error": "MechanismUnavailable: unable to use scram-sha-256 based authentication for user without any SCRAM-SHA-256 credentials registerd". "result":334,"metrics":{"conversation_duration":{"micros"99,"summary":{"o":{"step":1,"step_total":2,"duration_micros":48}}}

authenticationMechanisms는 보안 설정이 아니라 서버 파라미터입니다. 설정 파일에서 setParameter를 사용하세요.

사용자를 생성할 때는 createUser 데이터베이스 명령어를 사용하여 인증 메커니즘을 지정할 수 있습니다.

기존 사용자에 대해서는 updateUser 데이터베이스 명령어를 사용하여 해당 값을 변경할 수 있습니다.

1 Like

환경 설정에 여러가지 errors가 있을 수 있습니다. 관련해서 검색한 내용을 넣어봤어요. 참고바랍니다.

  • Option authenticationMechanisms does not exist and SCRAM-SHA-1 is deprecated anyway
  • You must have a space between the colon and the value
  • Option clusterAuthMode must be keyFile, not KeyFile