1. Download the installation file of the binary plate:
file version: mongodb-linux-x86_64-2.6.11.tgz
: https://www.mongodb.org/downloads
version of the Consolidated profile template and Server installation files: mongodb-linux-x86_64-2.6.11.tar.gz
2. unzip the binary plate installation file:
# CD/USR/LOCAL/SRC
# tar Xzvfmongodb-linux-x86_64-2.6.11.tar.gz
# Mvmongodb-linux-x86_64-2.6.11/usr/local/mongodb
#/usr/local/mongodb/bin/mongo--version
MongoDB shellversion:2.6.11
3. Set Environment variables:
# Vi/etc/profile
Exportpath=/usr/local/mongodb/bin: $PATH
# Source/etc/profile
4. Create a data store directory:
# Mkdir-p/data/mongod
## in this example, the master-slave mode is used to start the server daemon directly as a parameter.
5. Start the primary server:
#/usr/local/mongodb/bin/mongod--dbpath=/data/mongod--logpath=/usr/local/mongodb/mongod.log--master--oplogSize --logappend--port=27017--fork
# vi/etc/rc.local
/usr/local/mongodb/bin/mongod--dbpath=/data/mongod--logpath=/usr/local/mongodb/mongod.log--master--oplogSize --logappend--port=27017--fork
6. start from the server:
#/usr/local/mongodb/bin/mongod--dbpath=/data/mongod--logpath=/usr/local/mongodb/mongod.log--slave-- source10.6.1.77--slavedelay--autoresync--logappend--port=27017--fork
# netstat-ant
TCP 0 0 10.6.1.78:35833 10.6.1.77:27017 established
# Vi/usr/local/mongodb/mongod.log
2015-09-24t17:56:31.542+0800[replslave] Repl:syncing from host:10.6.1.77
2015-09-24t17:56:31.544+0800[replslave] repl:applied 1 operations
2015-09-24t17:56:31.544+0800[replslave] Repl:syncedTo:Sep 2417:56:20 5603c8c4:1
2015-09-24t17:56:31.544+0800[replslave] waiting until:1443088601 to continue
2015-09-24t17:56:31.544+0800[replslave] Repl:sleep sec before next pass
# vi/etc/rc.local
/usr/local/mongodb/bin/mongod--dbpath=/data/mongod--logpath=/usr/local/mongodb/mongod.log--slave-- source10.6.1.77--slavedelay--autoresync--logappend--port=27017--fork
## If you use single-server mode , you can add /usr/local/mongodb/support-files in the profile template and server installation files:
# cp/usr/local/mongodb/support-files/mongod.conf/etc/mongod.conf
# vi/etc/mongod.conf
Logpath=/usr/local/mongodb/mongod.log
port=27017
Dbpath=/data/mongod
Pidfilepath=/usr/local/mongodb/mongod.pid
# Cp/usr/local/mongodb/support-files/init.d-mongod/etc/rc.d/init.d/mongod
# chmod 755/etc/rc.d/init.d/mongod
# chkconfig Mongodon
# Vi/etc/rc.d/init.d/mongod
Mongod=${mongod-/usr/local/mongodb/bin/mongod}
Mongo_user=root
Mongo_group=root
Killproc-p "$PIDFILE"-D 300/usr/local/mongodb/bin/mongod
# service Mongodstart
# MONGO
This article from the "Technical Backup" blog, reproduced please contact the author!
CENTOS 6.5 x64 installed in the environment of the two-plate Mongodb-2.6.11