Maison >développement back-end >tutoriel php >mongod --config /usr/local/etc/mongod.conf 无法启动
问题描述:
<code> 使用命令:mongod --config /usr/local/etc/mongod.conf 无法启动mongodb,也不打印任何信息。之前用的都好好的,请问是什么原因呢? </code>
输入mongod 打印:
<code>liudeMacBook-Air:~ liu$ mongod 2016-05-09T15:05:42.632+0800 I CONTROL [initandlisten] MongoDB starting : pid=867 port=27017 dbpath=/data/db 64-bit host=liudeMacBook-Air.local 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] db version v3.2.3 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] allocator: system 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] modules: none 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] build environment: 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] distarch: x86_64 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] target_arch: x86_64 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] options: {} 2016-05-09T15:05:42.633+0800 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] dbexit: rc: 100</code>
环境:osx(mac)
问题描述:
<code> 使用命令:mongod --config /usr/local/etc/mongod.conf 无法启动mongodb,也不打印任何信息。之前用的都好好的,请问是什么原因呢? </code>
输入mongod 打印:
<code>liudeMacBook-Air:~ liu$ mongod 2016-05-09T15:05:42.632+0800 I CONTROL [initandlisten] MongoDB starting : pid=867 port=27017 dbpath=/data/db 64-bit host=liudeMacBook-Air.local 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] db version v3.2.3 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] allocator: system 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] modules: none 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] build environment: 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] distarch: x86_64 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] target_arch: x86_64 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] options: {} 2016-05-09T15:05:42.633+0800 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2016-05-09T15:05:42.633+0800 I CONTROL [initandlisten] dbexit: rc: 100</code>
环境:osx(mac)
从错误消息来看,很明确地说明了/data/db
不存在,应该先检查这点。
2016-05-09T15:05:42.633+0800 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
如有必要先建立这个目录再试
<code>sudo mkdir /data/db </code>