Jump to content
  • 0

Cluster's MongoDB


Pavel Tsukanov
 Share

Question

Hi

I would like to have 2 MongoDB instances with Replica Set enabled https://docs.mongodb.com/manual/replication/
I.e. I would like to have cluster live when one of instances is offline
Is it possible?
We had a case when our Amazon MongoDb instance stopped to work due to a hardware issue and we want to avoid it.

Thank you
Pavel
Link to comment
Share on other sites

  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0
You can do this easily by setting up two separate working clusters and using AWS route 53 for dns routing. It already has health checks and everything you need. If the healthcheck detects a failed cluster it will route traffic to other cluster using same dns. You have to plan how to implement failure indication on your cluster so that route 53 can detect it.
Link to comment
Share on other sites

  • 0

2 clusters are too expensive  (we must have at least 2 always on antmedia servers in clusters + turn servers). Also it's additional business logic for us. 

It's not good solution for Us and I believe for all

I have a big experience with mongo and I believe that adding Replica Set support is not a big task.. 
Compare the next connection strings

mongodb://MongoDb1, MongoDB2/DbName?replicaSet=rs0;readPreference=primary;safe=true for ReplicaSet. Clients will query primary server only.
and
mongodb://MongoDb1/DbName for a single server

If Antmedia server uses the standard MongoDB driver it will work automatically without changing business logic
It needs just add a way to configure the connection string.

 

Link to comment
Share on other sites

  • 0

Hi Pavel,

Ant Media mongodb implemantation is open in the public. Here is the implementation class: https://github.com/ant-media/Ant-Media-Server/blob/master/src/main/java/io/antmedia/datastore/db/MongoStore.java . We are using morphia library to access mongodb through Java.

I am not certain how the replica is being done at the moment, I can carry the replica configuration to the team if it is needed to add an external configuration. Meanwhile if you have experience working with mongodb, any commits are welcomed to make the replica work if you can make it work.

Cheers 

 

Link to comment
Share on other sites

 Share

×
×
  • Create New...