in the PHP手册 http://www.php.net/manual/en/mongo.construct.php,它有这个例子:
<?php
// pass a comma-separated list of server names to the constructor
$m1 = new Mongo("mongodb://sf2.example.com,ny1.example.com", array("replicaSet" => true));
// you only need to pass a single seed, the driver will derive the full list and
// find the master from this seed
$m2 = new Mongo("mongodb://ny1.example.com", array("replicaSet" => true));
?>
- 然而,$m1 返回什么?
- 如果我想找出主控,并进行复制,以便主控负责写入,而复制之一是读取连接,我应该找出并应该做什么的最佳方法是什么?
- 我可以拥有与每个副本不同的持久值吗?或者他们必须共享相同的连接通道?
关于 #2 的更多内容:Mongo 类自动找出主节点和辅助节点,然后将写入发送到主节点(如果设置了slaveOkay,则将读取内容发送到辅助节点)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)