【问题标题】:(Mac) Cannot start mongo, via "mongod" command(Mac) 无法通过“mongod”命令启动 mongo
【发布时间】:2020-05-17 21:01:09
【问题描述】:

只是想起床并开始使用“mongod”命令...

我已经看过以下内容: Cannot start mongo db Trouble Starting MongoDB (Mac) - Code: 100 ...以及许多其他论坛帖子。

这是我在终端中得到的:

#####-MacBook-Pro-2:p2w4-back_end ashesmachine$ mongod
2020-05-17T13:53:02.341-0700 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-05-17T13:53:02.345-0700 W  ASIO     [main] No TransportLayer configured during NetworkInterface startup
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten] MongoDB starting : pid=57712 port=27017 dbpath=/data/db 64-bit host=#####-MacBook-Pro-2.local
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten] db version v4.2.6
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten] git version: 20364840b8f1af16917e4c23c1b5f5efd8b352f8
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten] allocator: system
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten] modules: none
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten] build environment:
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten]     distarch: x86_64
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten]     target_arch: x86_64
2020-05-17T13:53:02.346-0700 I  CONTROL  [initandlisten] options: {}
2020-05-17T13:53:02.346-0700 I  STORAGE  [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2020-05-17T13:53:02.347-0700 I  NETWORK  [initandlisten] shutdown: going to close listening sockets...
2020-05-17T13:53:02.347-0700 I  -        [initandlisten] Stopping further Flow Control ticket acquisitions.
2020-05-17T13:53:02.347-0700 I  CONTROL  [initandlisten] now exiting
2020-05-17T13:53:02.347-0700 I  CONTROL  [initandlisten] shutting down with code:100

【问题讨论】:

  • 问题在日志中为您逐字逐句说明:NonExistentPath: Data directory /data/db not found
  • 对,我实际上已经尝试过故障排除。创建此路径不适用于“mkdir -p /data/db”命令,甚至无法使用 sudo 命令...
  • 找到你的 mongod.conf 文件。通常在 osx 上它会在 /usr/local/etc/mongod.conf 但您的安装似乎并不反映典型的安装。尝试启动 mongod,指定配置文件的路径:mongod --config /usr/local/etc/mongod.conf 或 mongod.conf 的任何路径。
  • 检查 mongod.conf 中的 dbPath: 变量。将其设置为您的用户有权访问的已知目录。例如,您可以在主目录中创建一个名为mongo_data 的目录。 cd 进入该目录并运行pwd。将 mongod.conf 文件中的 dpPath 设置为刚刚创建的目录的路径,然后尝试启动 mongod。

标签: mongodb macos


【解决方案1】:

您应该在启动 mongodb 之前创建 data/db 目录。类似mkdir -p /data/db

【讨论】:

  • 是的,我已经尝试过了,我收到以下错误:“mkdir: /data/db: Read-only file system”,即使我使用“sudo”
  • 这是什么意思?我该如何解决?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-03-13
  • 2020-05-13
  • 1970-01-01
  • 1970-01-01
  • 2014-07-27
  • 2017-12-22
  • 1970-01-01
相关资源
最近更新 更多