树莓派 mongodb 安装&报错处理
编译过的源码下载地址: https://files.cnblogs.com/files/xueshanshan/mongodb-rpi.zip
adduser –firstuid 100 –ingroup nogroup –shell /etc/false –disabled-password –gecos "" –no-create-home mongodb cp -R mongodb-rpi/mongo /opt chmod +x /opt/mongo/bin/* mkdir /var/log/mongodb chown mongodb:nogroup /var/log/mongodb mkdir /var/lib/mongodb chown mongodb:nogroup /var/lib/mongodb cp mongodb-rpi/debian/init.d /etc/init.d/mongod cp mongodb-rpi/debian/mongodb.conf /etc/ ln -s /opt/mongo/bin/mongod /usr/bin/mongod chmod u+x /etc/init.d/mongod update-rc.d mongod defaults /etc/init.d/mongod start
常用命令:
启动 sudo service mongodb start 查看状态 sudo service mongodb status 停止 sudo service mongodb stop
报错以及解决办法:
mongod.service - LSB: An object/document-oriented database
Loaded: loaded (/etc/init.d/mongod)
Active: active (exited) since 二 2017-07-18 19:17:07 CST; 1 day 21h ago
Process: 444 ExecStart=/etc/init.d/mongod start (code=exited, status=0/SUCCESS)
7月 18 19:17:05 raspberrypi systemd[1]: Starting LSB: An object/document-oriented database...
7月 18 19:17:07 raspberrypi mongod[444]: Starting database: mongodb.
7月 18 19:17:07 raspberrypi systemd[1]: Started LSB: An object/document-oriented database.
7月 19 09:31:42 raspberrypi systemd[1]: Started LSB: An object/document-oriented database.
7月 20 16:20:54 raspberrypi systemd[1]: Started LSB: An object/document-oriented database.
7月 20 16:22:34 raspberrypi mongod[4625]: Starting database: mongodb failed!
7月 20 16:22:34 raspberrypi systemd[1]: mongod.service: control process exited, code=exited
7月 20 16:22:34 raspberrypi systemd[1]: Failed to start LSB: An object/document-oriented dat
解决办法:
cd /var/lib sudo rm -rf ./mongodb sudo mkdir mongodb sudo chown -R mongodb mongodb/ sudo service mongod restart