MongoDB Master/Slave Configuration
1. Create the file mongodb. repo in the/etc/yum. repos. d/directory on the Master/Slave server, which contains the configuration information of the MongoDB repository. The content is as follows:
[mongodb] name=MongoDB Repository baseurl=http://downloads-distro.mongodb.org/repo/RedHat/os/x86_64/ gpgcheck=0 enabled=1
2. Run the installation command on the Master/Slave server.
yum -y install mongodb-org
3. Customize the db and log storage path on the Master/Slave Server
Create a new database directory and modify permissions
mkdir -p /data0/mongodbchown -R mongod:mongod /data0/mongodb
Modify/etc/mongod. conf on the master server
Logpath =/data0/mongodb/mongod. log
Logappend = true # Use APPEND to write logs
Fork = true # Run as a daemon
Master = true # master database
Dbpath =/data0/mongodb
Pidfilepath =/var/run/mongodb/mongod. pid
Bind_ip = 172.16.225.111 # bind the service IP address. All local IP addresses are not specified by default.
Auth = true # enable user password verification
Modify/etc/mongod. conf from the server
Logpath =/data0/mongodb/mongod. loglogappend = truefork = trueslave = true # slave database source = 172.16.225.111: 27017 # master database IP address and port dbpath =/data0/mongodbpidfilepath =/var/run/mongodb/mongod. pidbind_ip = 172.16.59.20.auth = true
4. The Master/Slave server starts the mongodb service.
/etc/init.d/mongod start
For more MongoDB tutorials, see the following:
CentOS compilation and installation of php extensions for MongoDB and mongoDB
CentOS 6 install MongoDB and server configuration using yum
Install MongoDB2.4.3 in Ubuntu 13.04
MongoDB beginners must read (both concepts and practices)
MongoDB Installation Guide for Ubunu 14.04
MongoDB authoritative Guide (The Definitive Guide) in English [PDF]
Nagios monitoring MongoDB sharded cluster service practice
Build MongoDB Service Based on CentOS 6.5 Operating System
MongoDB details: click here
MongoDB: click here
This article permanently updates the link address: