The compiled binary version that is downloaded using the MongoDB website, if need to compile requires github download
1. Set the MongoDB program directory to $mongo, base file Settings
mkdir $MONGO/log
mkdir $MONGO/conf/
mkdir-p/data/db/
Touch $MONGO/conf/mongod.conf
2. Modify the configuration file $mongo/conf/mongod.conf
VI $MONGO/conf/mongod.conf
port = 27017 #端口. Default 27017,MONGODB default service TCP port, listening for client connections. If the port setting is less than 1024, such as 1021, you need root permission to start, can not be started with the MongoDB account, (ordinary account even 27017 will not do) otherwise error: [MONGO--port=1021 connection]
logpath = $MONGO/log/mongod.log #日志目录 for easy tracking.
dbpath =/data/db #mongo数据存放目录
fork = True #是否后台运行, set to True. Default is False
3. Start Mongod
mongod-f $MONGO/conf/mongod.conf
4. Watcher Output
If the output is as follows, the Mongod starts successfully
all output going to: $MONGO/log/mongod.log
Child process started successfully, parent exiting
5. Safely stop the Mongod process
The most basic method is to send SIGINT or sigterm signals to the MongoDB server.
If the front-end process runs on the terminal, the direct ctrl-c abort, otherwise, use kill to send the signal to abort.
Kill-2 Mongodpid (SIGINT)
Kill Mongodpid (SIGTERM)
Mongod receive SIGINT or SIGTERM, will safely exit, that is, such as the current operation or file pre-allocation is complete, close all open connections, the cache data flushed to disk, and finally stopped.
WARNING: Never send Sigkill (kill-9) to a running MongoDB. Causes the database to be shut down directly, causing the data file to be corrupted.
On the use of MONGO