Skip to content

Instantly share code, notes, and snippets.

@Christilut
Created May 7, 2019 11:44
Show Gist options
  • Save Christilut/041bebf652de7c200b274553c44b7849 to your computer and use it in GitHub Desktop.
Save Christilut/041bebf652de7c200b274553c44b7849 to your computer and use it in GitHub Desktop.
mongodb local replicaset

Install 4.x Community edition: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/

  • Set /etc/mongod.conf

  • sudo service mongod restart

Enter mongo shell: mongo

Enter command: rs.initiate({_id: "replocal", members: [{_id: 0, host: "127.0.0.1:27017"}] }) that should return ok: 1

You should now have a replica set with only a primary node, check this with rs.status()

storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
net:
port: 27017
bindIp: 127.0.0.1
processManagement:
timeZoneInfo: /usr/share/zoneinfo
replication:
replSetName: replocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment