Mongo behaviour (PSA) when Primary taken down

I have some questions regarding the best practice of mongo Primary-Secondary-Arbiter.
Right now, i use mongo PSA in my graylog production stage. = mongo-1 (Primary) = mongo-2 (Secondary) = mongo-3 (Arbiter)

root@production-mongo-1:/etc# mongod --version
db version v4.0.27
git version: d47b151b55f286546e7c7c98888ae0577856ca20
Graylog 3.2.4+a407287, codename Ethereal Elk

My config in graylog server.conf:
mongodb_uri = mongodb://,

Now, i have plan to add more CPU and Memory of mongo-1 (Primary). I need to shutdown the VM mongo-1.

According to this Mongo docs, i need to do mongod --shutdown to shutdown gracefully the mongo server.

However, if i shutdown the mongo-1 (Primary);

  • what happen to graylog master and slave if the mongo-1 shutdown-ed ?
  • is it ok for graylog master and slave when mongo-2 (Secondary) promoted to be (Primary) ?
  • will mongo-2 be promoted from Secondary to Primary automatically ? or must be set manually ?
  • or, mongo-3 as Arbiter will promote it automatically and the data sync automatically ?
  • After, mongo-1 upgraded and started on. is mongo-1 promoted back as primary ?

I am not mongo user, sorry if my question is too dumb. Reading replica set docs, but still suffering to understand behaviour for Graylog :joy:

I want to test in staging mongo server, but sometimes i really know first from your pov. Because my test Graylog is like Production needs. Cannot taken down even a minute :rofl:

If you have any steps or personal docs to maintain mongo server, i am so glad to read it. Really want to deep learning for this mongo stuff.

Thank you so much for your time and help.

Hello @merceskoba

Good question.

Back to the basics, Clusters are normally for redundancy incase an issue/s arise. So I would assume if you shutdown a node in the cluster the cluster should still function. Once you bring that node back up, the master should resume.

As for MongoDb, I would look into the MongoDb forum here. I’m quite sure there are some user/s there that do this all the time. Unfortunately, I haven’t done this in a long time but what I can remember, I had Graylog/MongoDb on the same node and I had three nodes. So when I shut down Node-01 my load balancer ( Nginx) re-route to Graylog/MongDb Node-02. Once Node-01 was back up that became my primary again.

To be honest, sometimes just doing it and making a mess can help the learning process :laughing:
In a lab environment create three nodes as shown above and give it a try, see how it function. Keep an eye on the logs, find out how it fails over when shutting down a node, etc…Seeing is believing.

Sorry I cant be more help, if I come across ant documentation Ill post it here.

1 Like

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