Created
May 2, 2017 02:24
-
-
Save Gary-Ascuy/75af6716831b5c6f34915ed72d7009cb to your computer and use it in GitHub Desktop.
This file contains 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
# pull mongodb image from Docker hub | |
docker pull mongo:3.2 | |
# run mongodb container | |
docker run -d --restart=always \ | |
-v /root/database/:/data/db \ | |
--name mongodb \ | |
mongo:3.2 mongod --smallfiles --nohttpinterface --replSet rs0 | |
# configure replica set, and create oplog user | |
docker exec -it mongodb mongo | |
# in the mongo console, remember use better password | |
use admin | |
rs.initiate() | |
db.createUser({user: "oplogger", pwd: "master", roles: [{role: "read", db: "local"}]}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment