MongoDB Configuration Master-slave replication is much simpler than MySQL
1, install, start with the configuration file
2. Modify the configuration file
Configuration of the Master
[Email protected] mongodb]# cat/etc/mongod.conf
port=27017
Dbpath=/usr/local/mongodb/data
Logpath=/usr/local/mongodb/logs
Logappend=true
Journal=true
Fork=true
Master=true
From the configuration
[Email protected] home]# cat/etc/mongod.conf
port=27017
Dbpath=/usr/local/mongod/data
Logpath=/usr/local/mongod/logs
Logappend=true
Journal=true
Fork=true
Slave=true
source=192.168.56.105:27017
Two configurations to do so.
Then load the configuration again and there's no problem.
View Master-Slave status
Db.printreplicationinfo (): View the status of the primary node
Db.printslavereplicationinfo (): View the status from a node
MongoDB Configuration Master-slave replication