In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1. Mongodb master-slave configuration
The master and slave are all on the same server, the master is the default port, and the slave is 9999
1) master
/ usr/local/mongodb/bin/mongod-master-dbpath / usr/local/mongodb/data/-logpath / usr/local/mongodb/log/mongodb.log-directoryperdb &
2) slave
/ web/mongodb/bin/mongod-- slave-- source 192.168.103.217 source 27017-- dbpath / web/mongodb/data/-- logpath / web/mongodb/log/mongo.log-- directoryperdb &
2. Mutual principal and subordinate
1) master
/ usr/local/mongodb/bin/mongod-- master-- slave-- source 192.168.103.217 purl 9999-- dbpath / usr/local/mongodb/data/-- logpath / usr/local/mongodb/log/mongodb.log-- directoryperdb &
2) slave
/ web/mongodb/bin/mongod-- port 9999-- master-- slave-- source 192.168.103.217 master-- dbpath / web/mongodb/data/-- logpath / web/mongodb/log/mongo.log-- directoryperdb &
3. Master and slave with authentication
1) master
Add user root,local Library to admin Library add user repl
Use admin
Db.addUser ('root','123')
Db.auth ('root','123')
Use local
Db.addUser ('repl','123')
Db.auth ('repl','123')
/ usr/local/mongodb/bin/mongod-master-auth-dbpath / usr/local/mongodb/data/-logpath / usr/local/mongodb/log/mongodb.log-directoryperdb &
2) slave
Add user root,local Library to admin Library add user repl
Use admin
Db.addUser ('root','123')
Db.auth ('root','123')
Use local
Db.addUser ('repl','123')
Db.auth ('repl','123')
/ web/mongodb/bin/mongod-- port 9999-- slave-- source 192.168.103.217 slave-- auth-- dbpath / web/mongodb/data/-- logpath / web/mongodb/log/mongo.log-- directoryperdb &
4. Test
If master and slave, write on master to see if you can synchronize to slave library.
If you are the master and slave of each other, you will write data on two databases to see if they can be synchronized to another database.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.