Starting or restarting the Mongo service always fails

I installed mongodb, then I created the mongo service:

 [Unit]
    Description=High-performance, schema-free document-oriented database
    After=network.target

    [Service]
    User=mongodb
    ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

    [Install]
    WantedBy=multi-user.target

But when I start the service and then check the status, I always get this error:

 mongodb.service - High-performance, schema-free document-oriented database
   Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2017-04-24 13:08:55 UTC; 6min ago
  Process: 1094 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=48)
 Main PID: 1094 (code=exited, status=48)

Apr 24 13:08:54 ip-172-31-37-163 systemd[1]: Started High-performance, schema-free document-oriented database.
Apr 24 13:08:55 ip-172-31-37-163 systemd[1]: mongodb.service: Main process exited, code=exited, status=48/n/a
Apr 24 13:08:55 ip-172-31-37-163 systemd[1]: mongodb.service: Unit entered failed state.
Apr 24 13:08:55 ip-172-31-37-163 systemd[1]: mongodb.service: Failed with result 'exit-code'.
+6
source share
3 answers

The problem was in the configuration file and change

bindIp: 127.0.0.1, XXXX

to

bindIp: [127.0.0.1, XXXX]

Solution to my problem

+5
source

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

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

My mistake was to separate IP addresses with commas and spaces. Between addresses there should be only commas:

bindIp: 127.0.0.1,X.X.X.X,Y.Y.Y.Y
+1

( sudo), . .

0

Source: https://habr.com/ru/post/1016727/


All Articles