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