mongodb - mongodb on Ubuntu 18.04 Bionic systemctl 处理 mongod.service / mongodb.service
问题描述
我在mongod.service
使用systemctl
. 它现在已经设置好了,只是它抱怨有其他东西在占用它的端口,尽管实际上什么都没有。我想罪魁祸首如下:(mongodb
而不是mongod.service
)有一个失败的服务,其错误是“找不到文件”。我需要设置或删除缺少的mongodb.service
吗?我看到有一个/lib/systemd/system/mongod.service
,但该目录中没有一个mongodb.service
。
下面是其中的一些配置/etc/mongod.conf
storage:
dbPath: /data/db
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
我还设置sudo chown -R mongodb:mongodb /data/db
了哪些修复的错误,但现在我得到了/data/db/WiredTiger.turtle: handle-open: open: Permission denied
sudo chown -R mongodb:mongodb /data/db/WiredTiger.turtle
...在我认为该文件已生成并且错过了获得权限之后,是的 mongod 正在运行。
我刚刚阅读了文档:The Linux package init scripts do not expect storage.dbPath to change from the defaults. If you use the Linux packages and change storage.dbPath, you will have to use your own init scripts and disable the built-in scripts.
我相信我最初更改了 dbPath ...
解决方案
检查 mongodb 是否正在运行
sudo service mongodb status
如果显示不活动,请使用以下命令激活
sudo service mongodb start
推荐阅读
- csv - 读入火花数据框时如何从csv文件中删除列
- javascript - 如何使用随机方法调用属性?
- google-cloud-platform - GKE 上的 Kubernetes 无法挂载卷
- angular - ng2-auto-complete 反应形式的默认选择
- deep-learning - 设置 requires_grad=True 后的不同结果
- android - 带有 android:process 的服务没有 startService
- python - 在python中没有可见窗口的OpenGL渲染视图
- javascript - 在angular js中多选一个与之关联的值
- javascript - 如何在没有 ID 的情况下隐藏子 div
- jquery - jQuery 上的 .not(this) 仍然可以识别 this(current row selected) 为什么会这样?