Can't get MongoDB to work in HA

Running a standard MongoDB 6 replicaset in PSA configuration (one primary, one secondary and an arbiter). Whenever one Mongo server is taken offline, sending messages in RC stops working - entered message is left greyed out until the server is back running.

My MongoDB connectionstring is in style of: "mongodb://user:pw@primary,secondary/rocketchat?authSource=admin&replicaset=rs0
Oplog is similar but local db.

With this setup, whenever one Mongo server is taken down and I try to send a message, I get a “changing streams failed” error in RC docker logs.
When I add the arbiter into the MongoDB URI, this error no longer occurs but the writes into the DB also stop when one server is taken offline.

I’m scratching my head - what could cause this issue?

Server Setup Information

  • Version of Rocket.Chat Server: 6.13.1
  • Operating System: Ubuntu
  • Deployment Method: docker
  • Number of Running Instances: 1
  • DB Replicaset Oplog: yes
  • NodeJS Version: appropriate for the RC version
  • MongoDB Version: 6.0.19
  • Proxy: haproxy
  • Firewalls involved: none

So what is your server history? Has this always happened? Recently? Just deployed?

Before reporting issues please test on latest code with latest configs.

Your version is EOL in April and if there are issues they will not be backported.

My MongoDB connection string is in style of: … is similar but local db.

Similar, what actually is it ? We can’t help you without.

This is also really more a Mongo issue than a Rocket issue.

https://docs.rocket.chat/docs/mongodb-configuration

I have encountered the same issue before.

In my case, the issue was improved by configuring one primary and two secondaries.

However, this is just for reference. Please follow the instructions of the Community Liaison Adviser.

1 Like

This is a fresh testing installation.

Oplog string is: “mongodb://user:pw@primary,secondary/local?authSource=admin&replicaset=rs0”

One thing I could never figure out was whether the rocketchat databaseuser and oplog databaseusers can share the same user? Or should they be seperate users?

I’ve noticed that there are some pretty old topics here covering the same thing. If it hasn’t been fixed on the RC side thus far, so it must be a MongoDB thing?

Thanks but don’t trust this guy :wink: I help where i can but this is not my sphere of expertise (what is?!)

I’m sure you are probably correct here.

I’ve noticed that there are some pretty old topics here covering the same thing. If it hasn’t been fixed on the RC side thus far, so it must be a MongoDB thing?

I don’t think it is broken on the Rocket side as lots of people use these sorts of configs. As above.

It is understanding how it works for you with Mongo.

BTW Thanks for chipping in!!

Changing MongoDB PSA to PSS solved the issue.

1 Like