Created
June 12, 2020 11:33
-
-
Save phainamikaze/e2f5d5dbde1f999b5733baacd75467f6 to your computer and use it in GitHub Desktop.
mongodb replica
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl rand -base64 741 > mongodb-keyfile | |
rs.initiate( | |
{ | |
_id : "rs0", | |
members: [ | |
{ _id : 0, host : "acs-server-9:27018" }, | |
{ _id : 1, host : "acs-server-9:27019" } | |
] | |
} | |
) | |
rs.status() | |
use admin | |
db.createUser( | |
{ | |
user: "admin", | |
pwd: "xxx", | |
roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] | |
} | |
) | |
db.createUser( { | |
user: "root", | |
pwd: "xxx", | |
roles: [ { role: "root", db: "admin" } ] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment