PHP支持Mongodb副本集联接吗
Jun 13, 2016 pm 12:04 PM
PHP支持Mongodb副本集连接吗?
如题。
因为只有对一个库的权限,所以指定了dbname
连接如下:
$con = new Mongo("mongodb://user:[email protected]:27010,192.168.0.2:27010,192.168.0.3:27010/dbname");
现在报错了。
不知道PHP支持副本集连接吗?
常规来说,如果第一个ip连接上的话,那后面两个会忽略,如果第一个ip连不上的话,会自动连第二个或第三个。可是现在为什么有时候会报错?
------解决方案--------------------
$this->connection->setSlaveOkay(true);
如果是集群还得设置下主从。

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

10 Ways to Adjust Brightness on Windows 11

How to turn off private browsing authentication for iPhone in Safari?

Which version is generally used for mongodb?

The difference between nodejs and vuejs

Experience sharing on implementing real-time recommendation system using MongoDB

What are the advantages of mongodb database

Where is the database created by mongodb?
