@
@
@chistya2017-09-21 17:50:59
linux
@chistya, 2017-09-21 17:50:59

Why does enabling authorization in mongodb create multiple processes when mongos starts?

Good afternoon.
When setting up mongodb, I encountered the following problem.
In /etc/mongod.conf I prescribe the inclusion of authorization:

spoiler
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
net:
port: 27018
bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
security:
authorization: enabled

Config /etc/mongos.conf:
spoiler
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
net:
port: 27017
bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
sharding:
configDB: rs0/192.168.56.101:27019

I start both processes. All OK. But when trying to access the mongo console, the following error appears:
spoiler
MongoDB shell version: 3.2.16
connecting to: test
2017-09-21T17:42:57.997+0300 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-09-21T17:42:57.997+0300 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
[email protected]/mongo/shell/mongo.js:229:14
@(connect):1:6
exception: connect failed

With the authorization option enabled through ps auxf, I see three mongos processes, while with the option disabled, there is only one.
As I understand it, the problem is that three processes are trying to use the same port.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chistya, 2017-09-27
_

When setting up replicas and shards, ip addresses of nodes were used, and hostnames were used in certificates. Because of what there were errors in the logs: The server certificate does not match the host name. Hostname: 192.168.56.101 does not match CN: vboxcentos1. Added the parameter allowInvalidHostnames: true to the config.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question