mongodb启动失败汇总

1、新安装mongodb,执行sudo service mongod start(sudo service mongod restart),都报启动失败。

    查看/var/log/mongodb/mongod.log:

2015-07-27T11:49:10.476+0800 I CONTROL  ***** SERVER RESTARTED *****
2015-07-27T11:49:10.548+0800 E NETWORK  [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 192.168.1.235:27017
2015-07-27T11:49:10.548+0800 E NETWORK  [initandlisten]   addr already in use
2015-07-27T11:49:10.549+0800 W -        [initandlisten] Detected unclean shutdown - /var/lib/mongo/mongod.lock is not empty.
2015-07-27T11:49:10.582+0800 I STORAGE  [initandlisten] exception in initAndListen: 98 Unable to lock file: /var/lib/mongo/mongod.lock errno:11 Resource temporarily unavailable. Is a mongod instance already running?, terminating
2015-07-27T11:49:10.582+0800 I CONTROL  [initandlisten] dbexit:  rc: 100
2015-07-27T11:56:46.954+0800 I CONTROL  ***** SERVER RESTARTED *****
2015-07-27T11:56:47.017+0800 E NETWORK  [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 192.168.1.235:27017
2015-07-27T11:56:47.017+0800 E NETWORK  [initandlisten]   addr already in use
2015-07-27T11:56:47.018+0800 W -        [initandlisten] Detected unclean shutdown -/var/lib/mongo/mongod.lock is not empty.
2015-07-27T11:56:47.018+0800 I STORAGE  [initandlisten] exception in initAndListen: 98 Unable to lock file: /var/lib/mongo/mongod.lock errno:11 Resource temporarily unavailable. Is a mongod instance already running?, terminating
2015-07-27T11:56:47.018+0800 I CONTROL  [initandlisten] dbexit:  rc: 100


     解决步骤

      1、删除日志文件/var/log/mongodb/mongod.log

rm /var/log/mongodb/mongod.log

      2、删除lock文件

rm /var/log/mongodb/mongod.log

      3、执行修复

sudo /usr/bin/mongod --repair --dbpath /var/lib/mongodb / --repairpath /tmp/mongodb




你可能感兴趣的:(MongoDB)