First step: We put MongoDB on multiple servers on 10.12.0.3 and 10.14.0.1.
Step two: Start MongoDB on 10.12.0.3, designate the database as the primary database
Start the master first:
25019 --fork--logpath/var/log/mongo/mongdb1.log--dbpath/data/db/ --master
Start again from:
10.12. 0.3:25019 --dbpath/opt/product/mongodb/data
The syncing from host:10.12.0.3:25019 instructions have been copied from the primary database.
FAQ Processing:
Issue one: Perform synchronization from the server, error: ErrMsg: "Not authorized the admin to execute command"
Cause: The master boot carries the--auth. MONGO is not authenticated by default. Remove the problem after solving.
Issue two: [Replslave]--source 192.168.1.32:25019! = 19.168.1.30:25019 from local.sources collection
Cause: At the very beginning, we have specified master's host and port for Slave, which is inserted into the Local.sources collection. So, change the master port to 10000.
Mongodb Master-Slave synchronization