MongoDB issue after replica Set migration

Hi, I run Graylog 2.5 on 4 nodes with the following setup:
4 docker containers:

  1. Graylog (2.5)
  2. Mongo (3.6.19)
  3. Elastic ( Coordinating only node 6.8.5 )
    I have made dump of mongodb using mongodump and then restored it to separate mongodb cluster and replica set using mongorestore, ( mongodb 3.6.21)
    I have validated on mongo that all previous users with their passwords and roles do exist on a new mongodb cluster/replicaset
    After that i have changed setting of mongo_db uri to point to the new replica set.
    Graylog starts succesfully, i see all streams/dashboards/extractors there, and i see that nodes continue to ingest messages to elastic. I am unable to see ANY messages in any streams. On mongodb containers. on the new cluster i see the following in logs:

2021-02-05T21:04:12.902+0000 I ACCESS [conn130] Unauthorized: not authorized on admin to execute command { serverStatus: true, $db: “admin” }
2021-02-05T21:04:35.706+0000 I ACCESS [conn119] Unauthorized: not authorized on admin to execute command { serverStatus: true, $db: “admin” }
2021-02-05T21:04:54.774+0000 I ACCESS [conn113] Unauthorized: not authorized on admin to execute command { serverStatus: true, $db: “admin” }

When switching mongo_uri back to old cluster, all messages are visible again. Please give me direction

@nix-power

does the Graylog user has the proper rights? We covered that int he docs a little hidden:

https://docs.graylog.org/en/4.0/pages/configuration/multinode_setup.html#mongodb-replica-set

These are permissions for the user Graylog connects to mongodb (db-admin)

     rs01:PRIMARY> use admin
switched to db admin
rs01:PRIMARY> db.getUsers()
[
	{
		"_id" : "admin.db-admin",
		"userId" : UUID("9bcc0e9a-437c-43f0-a006-6f5f25818b0b"),
		"user" : "db-admin",
		"db" : "admin",
		"roles" : [
			{
				"role" : "readWrite",
				"db" : "admin"
			},
			{
				"role" : "dbAdmin",
				"db" : "admin"
			}
		]
	},
	{
		"_id" : "admin.root",
		"user" : "root",
		"db" : "admin",
		"roles" : [
			{
				"role" : "root",
				"db" : "admin"
			}
		]
	}
]

Unless you changed it, the MongoDB database for Graylog is called graylog. Can db-admin access the graylog db?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.