【发布时间】:2017-06-13 04:59:08
【问题描述】:
我在 /lib/systemd/system/mongod.service 有一个 mongodb 的服务文件
我的文件包含以下数据
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
Documentation=https://docs.mongodb.org/manual
[Service]
User=mongodb
Group=mongodb
ExecStart=/usr/bin/mongod --quiet --fork --config /etc/mongod.conf
# file size
LimitFSIZE=infinity
# cpu time
LimitCPU=infinity
# virtual memory size
LimitAS=infinity
# open files
LimitNOFILE=64000
# processes/threads
LimitNPROC=64000
# total threads (user+kernel)
TasksMax=infinity
TasksAccounting=false
# Recommended limits for for mongod as specified in
# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
[Install]
WantedBy=multi-user.target
所以在运行如下命令时
sudo /usr/bin/mongod --quiet --fork --config /etc/mongod.conf
我的命令运行成功,但进入服务文件时由于没有 Root 访问权限而出现错误。
所以我想以 root 访问权限运行我的 systemd 服务文件。任何建议将不胜感激,并在此先感谢
【问题讨论】:
-
这真的应该在dba,stackexchange.com 上询问,这是关于数据库管理和配置的问题和答案。 StackOverflow 适用于:基于“编程”的问题,而这不是。请将您的帖子移至相应的网站,而不是在此处发布。
-
我不是在问数据库@Neil Lunn,我问的是关于 systemd 服务文件以及如何以 root 访问权限运行它的问题,感谢您回复我的帖子
-
哪个不是是一个编程问题。所以你在错误的网站上发帖。现在明白了吗?
-
错误是什么,您用来将 mongo 作为 systemd 服务运行的命令是什么?而且,为了挑剔,这些文件被称为单元文件,就像在 systemd 单元中一样。我不确定服务文件是正确的术语。
-
我使用
sudo systemctl start mongod.service启动和sudo systemctl status mongod.service
标签: mongodb root ubuntu-16.04 systemd systemctl