1. Start MongoDB in master mode first
2. Import the data files of the main library:
/data/mongodb-3.0.12/bin/mongorestore/data/tmp/mongodbbak/
3. Close the Mongdb:
Kill-2 PID
4. Modify the configuration file, set the boot from the mode, and set the main library's IP and port, note first talnet test the main library's IP and port is unblocked
5.
6. Start from the database
7. Check ps–ef| grep MONGO, NETSTAT–TLUNP and tail–f logfile
[Email protected] mongodb]# tail-f/data/logs/mongologs/mongodb.log
2018-06-08t16:43:34.705+0800 I REPL [replslave] syncing from host:112.25.75.57:27017
2018-06-08t16:43:35.713+0800 I REPL [replslave] syncing from host:112.25.75.57:27017
2018-06-08t16:43:36.721+0800 I REPL [replslave] syncing from host:112.25.75.57:27017
2018-06-08t16:43:37.730+0800 I REPL [replslave] syncing from host:112.25.75.57:27017
8. Open the MONGO client to view the database status:
./mongo into the shell
Rs.slaveok ()
Show DBS
Exit
#查看主从同步延时 #
Rs.slaveok ();
Db.printreplicationinfo ();
Quit ();
MongoDB from library configuration