Linux平台安装MongoDB常见异常

>>MongoDB Linux安装过程,请进入Linux平台安装MongoDB

1. 异常集锦

1.1 异常一

安装提示

[dddd@e010125001186.bja /opt/mongodb/bin]$ sudo ./mongod --config mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 13151
ERROR: child process failed, exited with error number 100

查看log日志

2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten] MongoDB starting : pid=27082 port=27017 dbpath=/opt/mongodb/data/db 64-bit host=e010125001186.bja
2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten] db version v3.2.0
2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten] modules: none
2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten] build environment:
2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten]     distarch: x86_64
2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2016-01-08T23:44:55.282+0800 I CONTROL  [initandlisten] options: { config: "mongodb.conf", net: { port: 27017 }, processManagement: { fork: true }, storage: { dbPath: "/opt/mongodb/data/db" }, systemLog: { destination: "file", path: "/opt/mongodb/logs/mongodb.log" } }
2016-01-08T23:44:55.311+0800 I STORAGE  [initandlisten] exception in initAndListen: 29 Data directory /opt/mongodb/data/db not found., terminating
2016-01-08T23:44:55.311+0800 I CONTROL  [initandlisten] dbexit:  rc: 100

错误定位

exception in initAndListen: 29 Data directory /opt/mongodb/data/db not found., terminating

处理方式,新建db文件夹

cd /opt/mongodb/data
sudo mkdir db
[dddd@e010125001186.bja /opt/mongodb/data]
$ls
db

重新安装,成功。

[dddd@e010125001186.bja /opt/bin]$ sudo ./mongod --config mongodb.conf
about to fork child process, waiting until server is ready for connections.
forked process: 13216
child process started successfully, parent exiting

1.2 异常二

安装提示

[dddd@e010125001186.bja /opt/mongodb/bin]$ sudo ./mongod --config mongodb.conf
connection: /opt/mongodb/data//WiredTiger.wt: No such file or directory

异常原因
- 应该是上一次安装失败,自己删除了data中的所有文件导致。

处理方式
- 删除掉整个mongodb文件夹,重新解压安装。
- 记住下一次安装失败,不要直接用kill -9 进程号,这样会造成数据库锁死。

你可能感兴趣的:(mongodb,linux,异常)