NoSQL Zone is brought to you in partnership with:

Dave has posted 1 posts at DZone. View Full User Profile

Introducting a MongoDB Replica Set Demonstration and Experimentation Service

05.01.2013
| 3133 views |
  • submit to reddit

Greetings adventurers!

A lot of our users upgrade from single-node databases to replica set clusters without fully understanding how their driver, and therefore their application, will react to failover. In fact, we get so many questions about best practices with MongoDB replica sets that we thought it could be cool to host a replica set that anyone can connect to using their MongoDB driver of choice.

Today we invite you to check out flip-flop, a MongoDB Replica Set demonstration and experimentation service.  The flip-flop service consists of:

  • A live replica set that fails-over (i.e. “flips” and “flops”) every 60 seconds.  This cluster is always running and available to all at the following address:
Connection URI:
1
mongodb://testdbuser:testdbpass@flip.mongolab.com:53117,flop.mongolab.com:54117/testdb
  • A set of example client scripts (currently just in Python) that simulate client interactions with the cluster that you can use as a starting point for your own experimentation

The flip-flop service is also great for those of you working on third-party drivers. Gustavo Niemeyer, author of mgo, a MongoDB driver for the Go language, told us flip-flop helped him find and quickly fix a small bug in the driver: “This is brilliant. I actually managed to find an edge case coding a trivial example against it due to the timing of the server re-election.” Pretty cool!

How to get started with flip-flop:

  1. Open http://mongolab.org/flip-flop in one window
  2. Download and run our sample Python script (requires pymongo 2.4+) in a second window
sudo pip install pymongo
curl https://gist.github.com/mongolab-org/5347810/raw/766f8266db377e462f90e5c1389be6211fbd2db6/watch-flip-flop.py > watch-flip-flop.py
python watch-flip-flop.py
  1. Watch this script gracefully recover from failover as the cluster flips and flops every 60 seconds.

We hope you all find this service informative and useful. As you play around with flip-flop, please do let us know what you think!

Sincerely,

Your friends at MongoLab







Published at DZone with permission of its author, Dave Walker. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)