According to your actual system environment, download the required files, mine is the Linux 64-bit.wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.8.tgz
Then unzip:tar zxvf mongodb-linux-x86_64-2.2.3.tgz
Move directory to/usr/local/mongodbmv mongodb-linux-x86_64-2.2.3 /usr/local/mongodb
Go to the MongoDB directorycd /usr/local/mongodb
New Custom Data Catalogmkdir -p ./data/db/
New log Directorymkdir logs
Next Run mode start MongoDB/usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data/db --logpath=/usr/local/mongodb/logs/mongodb.log --fork
Showprocess: 18261all output going to: /usr/local/mongodb/logs/mongodb.loglog file [/usr/local/mongodb/logs/mongodb.log] exists; copied to temporary file [/usr/local/mongodb/logs/mongodb.log.2013-03-01T04-04-28]child process started successfully, parent exiting
To set up boot from:echo "/usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data/db --logpath=/usr/local/mongodb/logs/mongodb.log --fork" >> /etc/rc.local
View MongoDB Logstail -f /usr/local/mongodb/logs/mongodb.log
To view or debug the operation of MongoDB.
View MongoDB Processps aux |grep mongodb
Showroot 18261 0.0 1.4 150392 29948 ? Sl 12:04 0:00 /usr/local/mongodb/bin/mongod --dbpath=/usr/local/mongodb/data/db --logpath=/usr/local/mongodb/logs/mongodb.log --fork
Parameter explanation:--dbpath database path (data file)
--logpath log file path
--master designated as the main machine
--slave specified as Slave machine
--source Specify the IP address of the host machine
--POLOGSIZE specifies that the log file size does not exceed 64M. Because Resync is very large and time-consuming, it is best to avoid resync by setting a sufficiently large oplogsize (the default oplog size is 5% of the size of the free disk).
--logappend log file End add
--port Enable port numbers
--fork running in the background
--ONLY specifies which database to replicate only
--slavedelay refers to the time interval from which replication is detected
--auth If you need to verify permissions login (username and password)