Answer the question
In order to leave comments, you need to log in
How to setup MongoDB Replica Set authorization properly?
I read the Mongolian docks, but I can’t understand the moment with access to the replica by login / password.
How to organize it correctly? Do I need to set logins and passwords separately for all replicas (different or the same?) or do it on the master, and this data is replicated?
Answer the question
In order to leave comments, you need to log in
A small manual on authorization in a replica:
1) Run the first node, authorization must be disabled!
2) Create admin and superuser:
use admin
db.createUser( {
user: "siteUserAdmin",
pwd: "<password>",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
});
db.createUser( {
user: "siteRootAdmin",
pwd: "<password>",
roles: [ { role: "root", db: "admin" } ]
});
auth=true
keyFile=/путь-до-файла-mongodb-keyfile
replSet=Название-реплики
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question