My mongo.conf:
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
# network interfaces
net:
port: 27017
bindIp: [127.0.0.1, 172.24.16.25] # Listen to local interface only, comment to listen on all interfaces.
security:
authorization: enabled
keyFile: '~/rsKeyFile'
Issue: When i perform service mongod restart after adding keyFile in mongo.conf as shown above
keyFile: '~/rsKeyFile'
My service fails when i check service mongod status it says:
"/etc/mongod.conf" 47L, 851C written
[root@788978-APP06 ~]# service mongod restart
Redirecting to /bin/systemctl restart mongod.service
[root@788978-APP06 ~]# service mongod status
Redirecting to /bin/systemctl status mongod.service
â mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2017-05-18 06:19:43 PDT; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 24066 ExecStart=/usr/bin/mongod $OPTIONS run (code=exited, status=1/FAILURE)
Process: 24064 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 24060 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
Process: 24056 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
Main PID: 24066 (code=exited, status=1/FAILURE)
May 18 06:19:43 788978-APP06.dgsworld.com systemd[1]: Starting High-performance, schema-free document-oriented database...
May 18 06:19:43 788978-APP06.dgsworld.com systemd[1]: Started High-performance, schema-free document-oriented database.
May 18 06:19:43 788978-APP06.dgsworld.com mongod[24066]: about to fork child process, waiting until server is ready for connections.
May 18 06:19:43 788978-APP06.dgsworld.com mongod[24066]: forked process: 24069
May 18 06:19:43 788978-APP06.dgsworld.com mongod[24066]: ERROR: child process failed, exited with error number 1
May 18 06:19:43 788978-APP06.dgsworld.com systemd[1]: mongod.service: main process exited, code=exited, status=1/FAILURE
May 18 06:19:43 788978-APP06.dgsworld.com systemd[1]: Unit mongod.service entered failed state.
May 18 06:19:43 788978-APP06.dgsworld.com systemd[1]: mongod.service failed.
I have 777 permissions on my rsKeyFile but still its not working, when i comment key fine in mongo.conf like given below and try restarting mongod service it works perfectly fine and show this Active: active (running) since Thu 2017-05-18 06:23:51 PDT; 2s ago status.
#keyFile: '~/rsKeyFile'
I am following this https://docs.mongodb.com/manual/tutorial/deploy-replica-set/
Please help, thanks in advance!!