(1) Go to MongoDB Download Center : http://www.mongodb.org/downloadsWe recommend using these binary distributions (binary version is officially recommended) !) (2) according to their actual system environment , download the required files, mine is the Linux 64-bit.
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.2.3.tgz
then unzip :
Tar zxvf mongodb-linux-x86_64-2.2.3.tgz
Move directory to /usr/local/mongodb
Mv-f mongodb-linux-x86_64-2.2.3/*/usr/local/mongodb
Go to the MongoDB directory
Cd/usr/local/mongodb
New Custom Data Catalog
Mkdir-p./data/db/
New log Directory
mkdir 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
Show
View sourceprint?forked process: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 Logs
Tail-f/usr/local/mongodb/logs/mongodb.log
To view or incorrectly view MongoDB processes on the run of MongoDB
PS aux |grep MongoDB
Show
Root 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 primary machine--slave designated as the IP address of the host machine--source Specifies that the log file size does not exceed 64M. Because the resync is extremely operational and time consuming, it is best to avoid resync by setting a large enough oplogsize (the default oplog size is 5% of the free disk size). --logappend log file at the end of the Add--port enable port number--fork run in the background--only specify which database to replicate only--slavedelay refers to the time interval from replication detection--auth Whether authentication permission is required to log on (user name and password)