Is it possible to stop the balancer using drivers (pymongo) ?

185 views
Skip to first unread message

Simon T.

unread,
Dec 13, 2012, 9:50:42 AM12/13/12
to mongod...@googlegroups.com
Hi guys,

I know it is possible to use pymongo to execute db commands. But what about other functions like the one belonging to the "sh" object (when connecting as admin). Is it possible to invoke them using the command function ? I've try to look through the shell to see what the sh.stopBalancer was made of in case it was a direct call to a "db" command, but it is not the case.

An other solution I thought would maybe to use the drivers "eval" function to call it server-side, something like:
db.eval(pymongo.code.Code('sh.stopBalancer()'))

But that would be in case I cannot have an access with the drivers.

Thanks

Simon

Bernie Hackett

unread,
Dec 13, 2012, 11:48:19 AM12/13/12
to mongod...@googlegroups.com
Yes. Read this section of the MongoDB manual and just translate the javascript to python:


The second half of that is what you need, but the for loop to check that any in-progress migrations have finished is also important.



Simon

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Reply all
Reply to author
Forward
0 new messages