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:email@example.com:53117,flop.mongolab.com:54117/testdb
- A real-time visualization of the cluster flippin’ and floppin’ with streaming database server logs
- 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:
- Open http://mongolab.org/flip-flop in one window
- 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
- 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!
Your friends at MongoLab