wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.4.tgz
tar -zxvf mongodb-linux-x86_64-rhel70-3.2.4.tgz
mv mongodb-linux-x86_64-rhel70-3.2.4 /usr/local/mongodb
mkdir -p data/test/db mkdir -p data/test/logs
touch mongodb.conf vi mongodb.conf
#數據庫路徑 dbpath = /usr/local/mongodb/bin/data/test/db #日誌輸出文件路徑 dbpath = /usr/local/mongodb/bin/data/test/db #設置端口號(默認的端口號是 27017) port = 27017 #設置爲以守護進程的方式運行,即在後臺運行 fork = true #關閉http接口,默認關閉27018端口訪問 nohttpinterface = true
./mongod –config mongodb.conf
啓動成功後,顯示以下linux
about to fork child process, waiting until server is ready for connections. forked process: 28906 child process started successfully, parent exiting
ps aux |grep mongodb
進程信息以下mongodb
root 28906 3.2 0.2 373116 69448 ? Sl 17:58 0:00 ./mongod -config mongodb.conf root 28967 0.0 0.0 112704 968 pts/0 S+ 17:58 0:00 grep --color=auto mongodb
kill -15 PID