1.删除mongo路径下/data/mongod.lock
2.删除mongo路径下/data/storage.bson
3.加载数据库文件路径,或者使用配置文件 --config xxx/config.conf
/www/server/mongodb/bin/mongod --bind_ip 0.0.0.0 --dbpath /www/server/mongodb/data
加入systemctl
1./usr/lib/systemd/system
2.vim mongo.service
```
[Unit]
Description=mongodb
After=network.target remote-fs.target nss-lookup.target
[Service]
# Type=forking mongo 不能开这个
ExecStart=/www/server/mongodb/bin/mongod --bind_ip 0.0.0.0 --dbpath /www/server/mongodb/data
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/www/server/mongodb/bin/mongod --shutdown
PrivateTmp=true
[Install]
WantedBy=multi-user.target
```
3.systemctl enable mongo.service
4.systemctl daemon-reload
5.systemctl start mongo.service