rancidfishbreath
rancidfishbreath

Reputation: 3994

How to query from nearest shard/replica set

We are looking at CQRS and are evaluating MongoDB as our query database. We have several branch offices with very poor internet connections (256 - 768 mbs DSL) that cannot be upgraded (remote rural locations with no ISP options). The thought was that we could put a box running MongoDB in each branch office and use some sort of clustering so that reads would become very fast since they were accessed over the LAN.

I do not need fail over or high availability.

How do I setup MongoDB so that computers in the branch office talk to the Mongodb instance in the branch office? Note this will be read only.

If MongoDB cannot support this workflow then I am open to suggestions for alternate document based databases that can support this.

Upvotes: 1

Views: 262

Answers (2)

mpobrien
mpobrien

Reputation: 4962

You can add a secondary to the MongoDB replica set for each geographical location. Then you can connect to each secondary directly by specifying the hostname of the mongo instance that's local to where you are connecting from, and then issue the slaveOk() command to allow it to be queried. Replication will keep the secondaries in sync with the primary as closely as possible. Writes/updates will still need to be handled by the primary of the replica set, however.

Upvotes: 2

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230326

CouchDB was built for this: occasionally connected document databases.

You can copy a database to your laptop, take it on a plane, modify it there and when you'll have network again, you'll be able to synchronize it with master database. The same works for remote offices.

I strongly suggest that you check it out.

Upvotes: 0

Related Questions