Mongo service start or restart always fail

The problem was in config file and changing

bindIp: 127.0.0.1, X.X.X.X

to

bindIp: [127.0.0.1, X.X.X.X]

Solved my issue


In MongoDB 3.6 the brackets proposed by @Chlebta did not work for me, returning the error:

mongod.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

My mistake was separating the IP addresses with commas and spaces. There has to be only commas between the addresses:

bindIp: 127.0.0.1,X.X.X.X,Y.Y.Y.Y

Try changing the owner permissions

chown -R mongodb:mongodb /var/lib/mongodb

chown mongodb:mongodb /tmp/mongodb-27017.sock