can’t start mongodb service

Stopped the mongod service manually and tried to start the service again which failed to start. Looked into the error log to see what caused the service to fail. Attached below is the error recorded in the error log, which was quite confusing and got me thinking how come permission where removed.

[root@lx1 /]# cd /var/log/mongodb
[root@lx1 mongodb]# ls
mongod.log
[root@lx1 mongodb]# vi mongod.log
2016-06-20T09:02:27.083-0400 I CONTROL  [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2016-06-20T09:02:27.156-0400 I -        [initandlisten] Detected data files in /mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2016-06-20T09:02:27.156-0400 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2016-06-20T09:02:28.348-0400 E STORAGE  [initandlisten] WiredTiger (13) [1466427748:348540][2621:0x7fd977062d40], txn-recover: /mongodb/journal/WiredTigerLog.0000000013: handle-open: open: Permission denied
2016-06-20T09:02:28.348-0400 E STORAGE  [initandlisten] WiredTiger (13) [1466427748:348691][2621:0x7fd977062d40], txn-recover: Recovery failed: Permission denied
2016-06-20T09:02:28.457-0400 I -        [initandlisten] Assertion: 28595:13: Permission denied
2016-06-20T09:02:28.457-0400 I STORAGE  [initandlisten] exception in initAndListen: 28595 13: Permission denied, terminating
2016-06-20T09:02:28.458-0400 I CONTROL  [initandlisten] dbexit:  rc: 100

After further investigation, I removed the mongod.pid and mongod.log and granted the permission again to mongod on to the data folder. Post which, I was to start the service

[root@lx1 mongodb]# chown -R mongod:mongod /mongodb
[root@lx1 mongodb]# service mongod start
Starting mongod:                                           [  OK  ]

Leave a Reply

Your email address will not be published. Required fields are marked *