Creating an index sometimes blocks new connections. When establishing a connection with the mongodb replica set, the driver first tries to connect and verify each non-hidden node in the cluster. If a node is in the "down" status, it will be skipped. However, if a node is in the "UP" status but holding a write lock, the verification will not be executed and the driver will be suspended.
Creating an index sometimes blocks new connections. When establishing a connection with the mongodb replica set, the driver first tries to connect and verify each non-hidden node in the cluster. If a node is in the "down" status, it will be skipped. However, if a node is in the "UP" status but holding a write lock, the verification will not be executed and the driver will be suspended.
Creating an index sometimes blocks new connections.
When establishing a connection with the mongodb replica set, the driver first tries to connect and verify each non-hidden node in the cluster. If a node is in the "down" status, it will be skipped. However, if a node is in the "UP" status but holding a write lock, the verification will not be executed and the driver will be suspended. Common Faults in index creation before mongodb 2.6. All indexes are created on the front-end or back-end, and on the secondary end, they are created on the front-end. The PHP driver version 1.5.3 will be improved and can be verified to the second node during index creation.
Reduce is_master_interval Value
For applications with high availability requirements, we recommend that you check the configuration settings when the default driver is running. The mongo. is_master_interval option controls how fast recovery is driven when the replica set is re-elected. The default value of the is_master_interval option is 15 s. It sets the time interval for the driver to send an "isMaster" request to each mongod instance. These requests help the driver determine the topology of the replica set. Specifically, the request detects which node is primary and can receive write operations. We recommend that you set this value to 1 or 2 seconds so that the driver can quickly locate the primary node during cluster election or failover. Of course, this also depends on the number of clients and the frequency of ping. Note that when a primary node changes, such as an election or failover, the driver will always receive a "MongoConnectionException" message "No candidate servers found" in seconds ". These exceptions must be handled in your code; otherwise, the application will be terminated.
Understand the connection processing method and configure the connection TimeoutMS
The PHP driver does not use the connection pool. Therefore, we recommend that you create a connection for each PHP process. However, if a web application has many PHP working processes, many new database connections will be created, and the PHP driver cannot share the connections between processes. Therefore, when the network node is slow and the server is busy, PHP applications are particularly vulnerable to initial database connections. In this case, we recommend that you customize the connectionTimeoutMS option and pay attention to the mongo. ping_interval option in php. ini. ConnectionTimeoutMS PHP driver does not display the definition of a default connection timeout. On the contrary, the default value is determined by the default_socket_timeout option in the php. ini file. The default value is 60 seconds. The connection will be closed for 60 seconds, which takes a long time and needs to be reduced. It is strongly recommended that you set the connectionTimeoutMS option in the URI option of the connection string. Set it to a value between 5 and 30 seconds. Mongo. ping_interval mongo. ping_interval the default value is 5 seconds. This option sets the interval at which the driver sends a ping request to each mongod instance to find the "down" node. It is used to track the server blacklist of the driver. Tells the driver which nodes are ignored.