宝塔Linux启动mongodb失败,Linux中MongoDB无法正常启动的问题解决办法!

1、报错,导致mongodb无法正常启动。具体命令如下(注意红色字体,提示日志路径,可查看该日志文件):

[root@oracleLinux ~]# service mongod start

Starting mongod: Fri Jan 24 09:59:59.385

Fri Jan 24 09:59:59.386 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.

Fri Jan 24 09:59:59.387

about to fork child process, waiting until server is ready for connections.

forked process: 2120

all output going to: /var/log/mongo/mongod.log

ERROR: child process failed, exited with error number 100

[失败]

通过输出信息可知,日子文件为/var/log/mongo/mongod.log

错误信息是:

ERROR: child process failed, exited with error number 100

2、查看mongod.log文件内容,具体命令如下:

[root@oracleLinux ~]# cat /var/log/mongo/mongod.log日志内容较长,此处截取了相关的内容如下:

**************

Unclean shutdown detected.

Please visit http://dochub.mongodb.org/core/repair for recovery instructions.

*************

Thu Jan 23 12:34:11.293 [initandlisten] exception in initAndListen: 12596 old lock file, terminating

Thu Jan 23 12:34:11.293 dbexit:

Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to close listening sockets...

Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to flush diaglog...

Thu Jan 23 12:34:11.293 [initandlisten] shutdown: going to close sockets...

Thu Jan 23 12:34:11.293 [initandlisten] shutdown: waiting for fs preallocator...

Thu Jan 23 12:34:11.293 [initandlisten] shutdown: closing all files...

Thu Jan 23 12:34:11.293 [initandlisten] closeAllFiles() finished

Thu Jan 23 12:34:11.293 dbexit: really exiting now

此处是非法关闭mongodb,根据日子文件具体内容中提供的地址(第3行处)获取到修复方式。

a、首先删除/var/lib/mongo/目录下的mongod.lock文件,具体命令如下:

[root@oracleLinux ~]# rm /var/lib/mongo/mongod.lock

b、已repair方式启动mongodb,具体命令如下:

[root@oracleLinux mongo]# mongod -f /etc/mongod.conf --repair

Fri Jan 24 10:38:39.112

Fri Jan 24 10:38:39.113 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.

Fri Jan 24 10:38:39.114

about to fork child process, waiting until server is ready for connections.

forked process: 2237

all output going to: /var/log/mongo/mongod.log

child process started successfully, parent exiting

c、在启动一次mongodb,具体命令如下:

[root@oracleLinux mongo]# mongod -f /etc/mongod.conf

Fri Jan 24 10:41:13.664

Fri Jan 24 10:41:13.665 warning: 32-bit servers don't have journaling enabled by default. Please use --journal if you want durability.

Fri Jan 24 10:41:13.666

about to fork child process, waiting until server is ready for connections.

forked process: 2253

all output going to: /var/log/mongo/mongod.log

child process started successfully, parent exiting

d、查看进程,如果存在mongodb进程,即代表修复成功,具体命令如下:

[root@oracleLinux mongo]# ps -ef | grep mongo

root 2253 1 2 10:41 ? 00:00:02 mongod -f /etc/mongod.conf

root 2268 2079 0 10:43 pts/0 00:00:00 grep mongo

3、开始使用mongodb,具体命令如下:

[root@oracleLinux mongo]# mongo

MongoDB shell version: 2.4.9

connecting to: test

Server has startup warnings:

Fri Jan 24 10:41:13.708 [initandlisten]

Fri Jan 24 10:41:13.708 [initandlisten] ** NOTE: This is a 32 bit MongoDB binary.

Fri Jan 24 10:41:13.708 [initandlisten] ** 32 bit builds are limited to less than 2GB of data (or less with --journal).

Fri Jan 24 10:41:13.708 [initandlisten] ** Note that journaling defaults to off for 32 bit and is currently off.

Fri Jan 24 10:41:13.708 [initandlisten] ** See http://dochub.mongodb.org/core/32bit

Fri Jan 24 10:41:13.708 [initandlisten]

>

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值