#进官网下载对应版本: https://www.mongodb.com/download-center?jmp=nav#community #解压并启动 tar xvzf mongodb-linux-
#进官网下载对应版本:
https://www.mongodb.com/download-center?jmp=nav#community
#解压并启动
tar xvzf mongodb-linux-x86_64-3.2.10.tgz
在mongod下面创建文件夹./data/db/和/logs
bin/mongod --dbpath=/webao/soft/mongodb/data/db/ --logpath=/webao/soft/mongodb/logs/
#报错FileNotOpen: logpath "/webao/soft/mongodb/logs/" should name a file, not a directory
就是说需要在logs下边创建一个文件,log即可
#再次启动
bin/mongod --dbpath=/webao/soft/mongodb/data/db/ --logpath=/webao/soft/mongodb/logs/log --fork
about to fork child process, waiting until server is ready for connections.forked process: 19233child process started successfully, parent exiting
#设置开机启动
echo "/webao/soft/mongodb/bin/mongod --dbpath=/webao/soft/mongodb/data/db/ --logpath=/webao/soft/mongodb/logs/log --fork" >> /etc/rc.local
#查看日志
tail -f logs/lo
#参考:
https://my.oschina.net/chinaearl/blog/111077