开发者

How can one configure MongoDB sharding using PHP?

开发者 https://www.devze.com 2023-03-13 17:42 出处:网络
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.

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'));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号