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