Home Backend Development PHP Tutorial PHP支持Mongodb副本集联接吗

PHP支持Mongodb副本集联接吗

Jun 13, 2016 pm 12:04 PM
mongodb nbsp

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

如果是集群还得设置下主从。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

10 Ways to Adjust Brightness on Windows 11 10 Ways to Adjust Brightness on Windows 11 Dec 18, 2023 pm 02:21 PM

10 Ways to Adjust Brightness on Windows 11

How to turn off private browsing authentication for iPhone in Safari? How to turn off private browsing authentication for iPhone in Safari? Nov 29, 2023 pm 11:21 PM

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

Which version is generally used for mongodb? Which version is generally used for mongodb? Apr 07, 2024 pm 05:48 PM

Which version is generally used for mongodb?

The difference between nodejs and vuejs The difference between nodejs and vuejs Apr 21, 2024 am 04:17 AM

The difference between nodejs and vuejs

Experience sharing on implementing real-time recommendation system using MongoDB Experience sharing on implementing real-time recommendation system using MongoDB Nov 03, 2023 pm 04:37 PM

Experience sharing on implementing real-time recommendation system using MongoDB

What are the advantages of mongodb database What are the advantages of mongodb database Apr 07, 2024 pm 05:21 PM

What are the advantages of mongodb database

Where is the database created by mongodb? Where is the database created by mongodb? Apr 07, 2024 pm 05:39 PM

Where is the database created by mongodb?

What does mongodb mean? What does mongodb mean? Apr 07, 2024 pm 05:57 PM

What does mongodb mean?

See all articles