Skip to content

Instantly share code, notes, and snippets.

@toomore
Created May 20, 2012 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toomore/2759642 to your computer and use it in GitHub Desktop.
Save toomore/2759642 to your computer and use it in GitHub Desktop.
MongoDB Master/Slave pymongo Tutorial
from pymongo import Connection
from pymongo.master_slave_connection import MasterSlaveConnection
Master = Connection()
Slaves = [Connection('127.0.0.1', 27018), Connection('127.0.0.1', 27019)]
db = MasterSlaveConnection(Master, Slaves).YOUR_dbs
print db.collection_names()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment