今天我的mongodb数据库由于文件系统inode而停止运行。我删除了var / www / html目录中的旧文件并启动了mongodb数据库。但无法开始。我得到了以下错误。
但我创建了另一个dbPath:/ var / lib / mongo2。然后我可以启动mongodb数据库。我无法启动旧的dbPath
我尝试删除/tmp/mongodb-27017.sock。但没有成功
我正在运行centos 7
请帮帮我
由于
[root@CentOS-72-64-minimal ~]# sudo service mongod restart
Restarting mongod (via systemctl): Job for mongod.service failed because the control process exi ted with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.
[FAILED]
[root@CentOS-72-64-minimal ~]# systemctl status mongod.service
● mongod.service - SYSV: Mongo is a scalable, document-oriented database.
Loaded: loaded (/etc/rc.d/init.d/mongod)
Active: failed (Result: exit-code) since Tue 2017-02-28 11:29:15 UTC; 6s ago
Docs: man:systemd-sysv-generator(8)
Process: 6219 ExecStop=/etc/rc.d/init.d/mongod stop (code=exited, status=0/SUCCESS)
Process: 6233 ExecStart=/etc/rc.d/init.d/mongod start (code=exited, status=1/FAILURE)
Main PID: 6118 (code=exited, status=0/SUCCESS)
Feb 28 11:29:15 CentOS-72-64-minimal systemd[1]: Starting SYSV: Mongo is a scalable, documen.....
Feb 28 11:29:15 CentOS-72-64-minimal runuser[6240]: pam_unix(runuser:session): session opene...0)
Feb 28 11:29:15 CentOS-72-64-minimal runuser[6240]: pam_unix(runuser:session): session close...od
Feb 28 11:29:15 CentOS-72-64-minimal mongod[6233]: Starting mongod: [FAILED]
Feb 28 11:29:15 CentOS-72-64-minimal systemd[1]: mongod.service: control process exited, cod...=1
Feb 28 11:29:15 CentOS-72-64-minimal systemd[1]: Failed to start SYSV: Mongo is a scalable, .....
Feb 28 11:29:15 CentOS-72-64-minimal systemd[1]: Unit mongod.service entered failed state.
Feb 28 11:29:15 CentOS-72-64-minimal systemd[1]: mongod.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@CentOS-72-64-minimal ~]# sudo service mongod restart
Restarting mongod (via systemctl): Job for mongod.service failed because the co ntrol process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.
[FAILED]
[root@CentOS-72-64-minimal ~]# mongo
MongoDB shell version: 3.2.7
connecting to: test
2017-02-28T12:26:32.400+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1 :27017, reason: errno:111 Connection refused
2017-02-28T12:26:32.400+0000 E QUERY [thread1] Error: couldn't connect to ser ver 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6
exception: connect failed
2017-02-28T13:25:50.832+0000 I CONTROL [initandlisten] MongoDB starting : pid=31901 port=27017 dbpath=/data/db 64-bit host=CentOS-73-64-minimal
2017-02-28T13:25:50.832+0000 I CONTROL [initandlisten] db version v3.2.12
2017-02-28T13:25:50.832+0000 I CONTROL [initandlisten] git version: ef3e1bc78e997f0d9f22f45aeb1d8e3b6ac14a14
2017-02-28T13:25:50.832+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2017-02-28T13:25:50.833+0000 I CONTROL [initandlisten] allocator: tcmalloc
2017-02-28T13:25:50.833+0000 I CONTROL [initandlisten] modules: none
2017-02-28T13:25:50.833+0000 I CONTROL [initandlisten] build environment:
2017-02-28T13:25:50.833+0000 I CONTROL [initandlisten] distmod: rhel70
2017-02-28T13:25:50.833+0000 I CONTROL [initandlisten] distarch: x86_64
2017-02-28T13:25:50.833+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-02-28T13:25:50.833+0000 I CONTROL [initandlisten] options: {}
2017-02-28T13:25:50.850+0000 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2017-02-28T13:25:50.850+0000 I CONTROL [initandlisten] dbexit: rc: 100
答案 0 :(得分:1)
您指定的路径根本无法在控制台输出中找到。
2017-02-28T13:25:50.850+0000 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
您(或默认脚本)提供的路径为/data/db
。此绝对路径引用根目录中名为data
的文件夹。
确保文件夹/data/db
存在或之前指定了其他路径,以便传递该文件夹。
如果您打算输入相对路径,则应使用此语法:./data/db
将引用当前运行命令的目录中的文件夹data
(使用{{检查当前目录) 1}}命令)。