can't start mongodb when open auth on mongod.conf
Asked Answered
B

2

5

i can't start mongod when i uncomment "security:authorization:enabled" options on /etc/mongod.conf ? on mongodb 3.4.2 on centos6.5;

this is the commond print out :

sudo service mongod restart
Stopping mongod:                                           [  OK  ]
Starting mongod:                                           [FAILED]

this is my mongod.conf file: here is the commond print out :

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# 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: 58018
  bindIp: 127.0.0.1  # Listen to local interface only, comment to listen on all interfaces.

#security:                <---uncomment here will start failed
#  authorization:enabled  <---uncomment here will start failed
#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:
Brooder answered 24/2, 2017 at 0:46 Comment(0)
D
8

Everything is okay you are just missing a space before enabled keyword . Space is very important before enabled

```

security:
  authorization: enabled

```

Replace your snippet with the above snippet for security . It is hard to find and hopefully will help somebody .

Decrepit answered 21/7, 2017 at 7:38 Comment(1)
I had this in my cfg, but in 1 line and didn't work. With this format (in 2 lines) it's working. So strange thoughStarofbethlehem
M
1

I'm using 'MongoDB server version: 3.6.5' and this one worked for me:

security.authorization: enabled
Marti answered 13/6, 2018 at 12:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.