Sametime chat DR replication | Linux | Required steps for configuring DR setup for MongoDB | Deploy a Geographically Redundant mongoDB Replica Set

Hello All,

I am configuring the DR mongoDB setup for the Sametime chat and getting below errors while adding members in the primary Sametime node of mongoDB

Can you please help if you have done the Sametime DR setup or configured replica sets on MongoDB?

Please note that I tried to add IP in the rs.add but doesn't work. Please help.

rs0:PRIMARY> rs.add('drchat.example.com:27017')
        "errmsg" : "Quorum check failed because not enough voting nodes responded; required 2 but only the following 1 voting nodes responded: ddrsametimechat.pvt.ccilindia.com:27017; the following nodes did not respond affirmatively: drchat:27017 failed uncaught exception: ReferenceError: PRIMARY is not defined :
with Received heartbeat from member with the same member ID as ourself: 0",
        "code" : 74,
@(shell):1:5
        "codeName" : "NodeNotFound",
        "$clusterTime" : {
                "clusterTime" : Timestamp(1649783820, 1),
                "signature" : {
                        "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
                        "keyId" : NumberLong(0)
                }
        }
}

Thank you.

Regards,

Elango

Hello Elango,

Great idea to ask our community here, hopefully we see some helpful comments.

If not already, also check with the MongoDB forum. You will get clues, for example:
You must be getting this while rs.add
Make sure the host you are adding is reachable(ping)

Keith

Hello,

i think your parameter is wrong.

Could you please replace the quotes (') with quotation marks (").

https://www.mongodb.com/docs/manual/reference/method/rs.add/

You don't need to add the port if you use 27017

This is the correct value > rs.add("mysecondhost.dns.org")

Remember that the mongo HA needs at least 3 MongoDB Server/Instances

Also you need to active write-rights on the other two mongo server (secondary)

> use admin

> show dbs

if you get an error enter following command > rs.secondaryOk()

If you like to make one Mongo Server to a master you can change the priority for one server.

Check prioritiy value (default should be 1) for all mebers with > rs.status()

Change e.g. for member 0 with

> cfg=rs.conf()

> cfg.members[0].priority=2

> rs.reconfig(cfg)

@Alexander Novak Thank you so much for your steps. The data sync between DC to DR works properly.

rs.stepDown() - This command is helpful for the takeover/switchover while both are online/active but how can I make the secondary node to primary when the situation of the primary node goes down?

I tried this command ( cfg.members[0].priority=2 ) to make the secondary server to primary while keeping down the primary server but it doesn't help.

I think we need to have 3 nodes for HA - the automatic failover with the arbiter.

We want the manual failover with two nodes and the requirement is that when primary node goes down then the secondary node should become primary using some command. Is it possible, can you please share some commands?

Thank you.

Yes - for proper failover in MongoDB - you need 3 nodes in the MongoDB cluster. See

https://www.mongodb.com/docs/manual/replication/

Hello @Elango Gopal

In the MongoDB HA one server will be the primary and the others the secondary; this means all reads and writes (in the databases and collections) are on the primary and replicated to the secondaries.

If a primary is not reachable anymore, a secondary will take the primary role.

If all MongoDB nodes have the same priority (default is 1), then the primary role will only changed if the primary is not reachable or shutdown.

If you set one server with a higher priority (e.g. 2), this server will gets the primary role again until it comes back.

The failover is controlled by the driver from the client(s), so you don’t need to care about the failover within the mongodb.

https://help.hcltechsw.com/sametime/11.6/admin/configuring_chat_logging_mongodb.html
https://help.hcltechsw.com/sametime/11.6/admin/sametime_meetings.html

Sametime Community
- Add chatlogging.ini parameter: CL_MONGO_URL=mongodb://sametimeUser:sametime@mongodb.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?authSource=admin&replicaSet=rs0

Sametime Proxy
- No changes, proxy will connect to the server listed in the dbconfig.properties field MONGO_HOST and get´s information about the MongoHA servers for failover

Sametime Meeting
- Docker custom.env parameter: MONGO_URL=mongodb://sametimeUser:sametime@mongodb.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?authSource=admin&replicaSet=rs0
- Kubernetes secret parameter MongoConectionURL=mongodb://sametimeUser:sametime@mongodb.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?authSource=admin&replicaSet=rs0

> In our environment (st11.6if1 meeting) we did not get this parameter running; as described in this kb entry https://support.hcltechsw.com/csm?id=kb_article&sysparm_article=KB0092727 the catalog pod is stucked after the change, so we switched back to connect only to one mongodb server – this worked for us
MongoConectionURL=mongodb://sametimeUser:sametime@mongodb.example.com:27017/?authSource=admin&replicaSet=rs0
It seems that the meeting server reads the information about the mongoha from this server, as sametime proxy, but in the mongodb logs on the secondaries we see connections from the meeting server