|
MongoDB Database Management
Configuring a Replica Set: Adding the First Member
How do you start?
.
- Backup any existing data
- Recommended: start with a fresh MongoDB installation
How do you configure replica set names?
.
- Add an entry to DNS or the local "/etc/hosts" file
- Example: mongo0rs0.company.com = replica set rs0, 1st server
- Make sure you can connect to the secondaries
How do you configure the mongod.conf file?
.
- Set the parameters as appropriate to your system
- Comment out bind_ip to allow MongoDB to respond to all network cards
- You must configure the replSet parameter
- Example: replSet=rs0
- Do not set priority here!
- Master/Slave configuration is not recommended: use replica sets
What is the startup sequence?
.
- Restart MongoDB
- Access the mongo shell
- Authenticate if necessary
- Initialize: rs.initiate()
How do you know the replica set is running?
.
- Access the mongo shell
- The command prompt should reflect the status
- View status: rs.status()
- View config: rs.conf()
|
|