linux - 在 CentOS 7 上更改 MongoDB 的默认 dbPath 时出错

标签 linux mongodb azure centos centos7

我们如何更改 mongod.conf 文件中的 dbPath、path 等选项。 我用的是centos 7。 每次我更改默认 dbPath 并尝试重新启动 mongod 服务时,它都会失败。(它可以与默认配置选项配合使用,例如 ->

storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
systemLog:
  destination: file
  logAppend: true
  path: /var/log/mongodb/mongod.log
)

我尝试使用 chown mongod:mongod /path/to/data 更改新目录的权限和chmod 0755 /path/to/data

每次我收到错误(在 mongod.log 文件中)-> 2017-03-27T06:03:27.182+0000 I STORAGE [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /path/to/data, terminating

最佳答案

我必须配置/etc/sysconfig/selinux 文件。 改变 SELINUX=enforcingSELINUX=disabled 以允许 MongoDB 在 CentOS 上启动。 您必须重新启动系统才能使更改生效。

关于linux - 在 CentOS 7 上更改 MongoDB 的默认 dbPath 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43015604/

相关文章:

azure - 如何在azure存储位置创建子容器

azure - 从我的列表中删除不需要的 Azure AD 目录

python - 任务失败,因为返回代码为 -1,而预期为 0 - Bamboo

linux - 如何编写 shell 脚本从我的密码文件中输入无线连接密码?

c++ - 如何拦截 GNOME 中的键盘快捷键

c# - 检索对象集合

mongodb - 数组的最小值和最大值?

linux - 为什么使用 __get_free_pages() 以 10 或 11 的顺序分配页面通常会失败?

python - 使用 Spark-DataFrame 将 HDFS 保存到 MongoDB

Azure数据流如何获取最大id并仅返回具有最大id的行