How can one configure MongoDB sharding using PHP?
I'm working on setting up a MongoDB replica set on EC2. I'd like to configure auto-sharding such that my nodes can easily come up and down.
Is it possible to use the native PHP driver to trigge开发者_如何学编程r sharding and add/remove nodes? If so, how?
Assuming you have your connection to mongos
right, you can use the MongoDB::command() method for that:
$mongo->selectDB('admin')->command(array('addshard'=>'hostname:port'));
精彩评论