I am having a service file for mongodb at /lib/systemd/system/mongod.service
and my file contains following data as below
[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
So while Running the Command as below
sudo /usr/bin/mongod --quiet --fork --config /etc/mongod.conf
my command running successfully but coming to Service File it is getting Error due to No Root Access.
So i want to run my systemd service file as root access.Any Suggestion would be appreciated and thanks in advance
Solved the Issue to Run the Service as daemon , i have to give full privileges to Mongodb database and Log path for User=mongodb & Group=mongodb by running below commands
sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown -R mongodb:mongodb /var/log/mongodb