I’m having problems connecting a Graylog docker to a MongoDB replica set.
I’ve built a MongoDB replica set with 3 servers (1 primary - 2 secondary). But when I execute the command “docker run”, the installation did not connect to MongoDB correctly. I’ve made a test with a single MongoDB and the same “docker run” of Graylog and it worked.
2019-04-04 15:15:04,951 INFO : org.graylog2.bootstrap.ServerBootstrap - Graylog server up and running.
But when I execute the same command with a replica set configured, I get this message:
2019-04-04 15:58:01,220 ERROR: org.graylog2.filters.ExtractorFilter - Unable to load extractors for all inputs
com.mongodb.MongoQueryException: Query failed with error code 13 and error message ‘command find requires authentication’ on server mongo:27017
I’ve configured the connection string with user and password created on admin database, but nothing happened.
And mongo -u admin -p admin admin
// Are you sure you use the user admin with password admin, and you store the graylog related information in admin database?
#Authenticate against the MongoDB server #mongodb_uri = mongodb://grayloguser:secret@mongo:27017/graylog #mongodb_uri = mongodb://root:admin20@server-1:27017/admin (used to test the connection - not successful)
#Use a replica set instead of a single host #mongodb_uri = mongodb://grayloguser:secret@mongo:27017,mongo:27018,mongo:27019/graylog
mongodb_uri = mongodb://admin:admin@server-1:27017,server-2:27017,server-3:27017/admin?replicaSet=rs_graylog_sistemas
Both users (root and admin) are configured with role “root” from ADMIN database.
root@server-2:/# mongo -u admin -p admin admin
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27017/admin?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“d3d01022-d638-4226-bfe4-8877b4c8ab8e”) }
MongoDB server version: 4.0.5
Welcome to the MongoDB shell.
For interactive help, type “help”.
For more comprehensive documentation, see http://docs.mongodb.org/
Questions? Try the support group http://groups.google.com/group/mongodb-user
Server has startup warnings:
2019-04-04T14:00:24.450-0300 I STORAGE [initandlisten]
2019-04-04T14:00:24.450-0300 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-04-04T14:00:24.450-0300 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-04-04T14:00:25.888-0300 I CONTROL [initandlisten]
2019-04-04T14:00:25.888-0300 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2019-04-04T14:00:25.888-0300 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-04-04T14:00:25.888-0300 I CONTROL [initandlisten]
2019-04-04T14:00:25.888-0300 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2019-04-04T14:00:25.888-0300 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-04-04T14:00:25.888-0300 I CONTROL [initandlisten]
Enable MongoDB’s free cloud-based monitoring service, which will then receive and display metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
rs_graylog_sistemas:SECONDARY>
From MongoDB Master Server
root@server-1:/# mongo -u admin -p admin admin
MongoDB shell version v4.0.5
connecting to: mongodb://127.0.0.1:27017/admin?gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“140e4d98-d485-44f7-b02a-25f8b9278654”) }
MongoDB server version: 4.0.5
Server has startup warnings:
2019-04-04T14:00:18.381-0300 I STORAGE [initandlisten]
2019-04-04T14:00:18.381-0300 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-04-04T14:00:18.381-0300 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-04-04T14:00:19.540-0300 I CONTROL [initandlisten]
2019-04-04T14:00:19.540-0300 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2019-04-04T14:00:19.540-0300 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-04-04T14:00:19.540-0300 I CONTROL [initandlisten]
2019-04-04T14:00:19.540-0300 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2019-04-04T14:00:19.540-0300 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2019-04-04T14:00:19.540-0300 I CONTROL [initandlisten]
Enable MongoDB’s free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
2019-04-17 16:21:06,096 INFO : org.graylog2.indexer.fieldtypes.IndexFieldTypePollerPeriodical - Cluster not connected yet, delaying index field type initialization until it is reachable.
2019-04-17 16:21:06,110 ERROR: org.graylog2.indexer.cluster.Cluster - Couldn’t read cluster health for indices [graylog_*] (n/a)
2019-04-17 16:21:06,115 INFO : org.graylog2.periodical.IndexerClusterCheckerThread - Indexer not fully initialized yet. Skipping periodic cluster check.
2019-04-17 16:21:06,115 INFO : org.graylog2.periodical.IndexRetentionThread - Elasticsearch cluster not available, skipping index retention checks.
2019-04-17 16:21:06,307 INFO : org.graylog2.migrations.V20161130141500_DefaultStreamRecalcIndexRanges - Cluster not connected yet, delaying migration until it is reachable.
2019-04-17 16:21:20,820 INFO : org.graylog2.periodical.IndexRangesCleanupPeriodical - Skipping index range cleanup because the Elasticsearch cluster is unreachable or unhealthy
2019-04-17 16:45:05,900 WARN : org.graylog2.initializers.BufferSynchronizerService - Elasticsearch is unavailable. Not waiting to clear buffers and caches, as we have no healthy cluster.
I can connect and check the settings on ELS cluster.
It’s the same configuration I use on the other graylog structure, but without docker. I use RPM files for everything
1 Graylog installed with MongoDB local and 3 ELS in cluster mode in another network.