gpt4 book ai didi

linux - 无法为旧的 dbPath 启动 mongodb 数据库

转载 作者:太空宇宙 更新时间:2023-11-04 10:23:58 25 4
gpt4 key购买 nike

今天我的 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

mongod命令

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

最佳答案

如控制台输出所示,根本找不到您指定的路径。

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命令 in(使用 pwd 命令检查当前目录)。

关于linux - 无法为旧的 dbPath 启动 mongodb 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42508220/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com