Oracle 5.0 Reference Manual page 2608

Table of Contents

Advertisement

The above example will output something similar to:
[1045] Access denied for user 'username'@'localhost' (using password: YES)
PHP Warning:
PHP Warning:
SUCCESS, [0] ''
version = 5.6.2-m5-log
In some cases, it may not be easily possible to retrieve all errors that occur on all network connections
through a connection handle. For example, let's assume a connection handle represents a pool of three
open connections. One connection to a master and two connections to the slaves. The application
changes the current database using the user API call mysqli_select_db, which then calls the
mysqlnd library function to change the schemata. mysqlnd_ms monitors the function, and tries to
change the current database on all connections to harmonize their state. Now, assume the master
succeeds in changing the database, and both slaves fail. Upon the initial error from the first slave, the
plugin will set an appropriate error on the connection handle. The same is done when the second slave
fails to change the database. The error message from the first slave is lost.
Such cases can be debugged by either checking for errors of the type
other option, investigation of the
20.7.6.5.5. Failover
Copyright 1997-2012 the PHP Documentation Group. [2230]
By default, connection failover handling is left to the user. The application is responsible for checking
return values of the database functions it calls and reacting to possible errors. If, for example, the
plugin recognizes a query as a read-only query to be sent to the slave servers, and the slave server
selected by the plugin is not available, the plugin will raise an error after not executing the statement.
Default: manual failover
It is up to the application to handle the error and, if required, re-issue the query to trigger the
selection of another slave server for statement execution. The plugin will make no attempts to failover
automatically, because the plugin cannot ensure that an automatic failover will not change the state
of the connection. For example, the application may have issued a query which depends on SQL user
variables which are bound to a specific connection. Such a query might return incorrect results if the
plugin would switch the connection implicitly as part of automatic failover. To ensure correct results,
the application must take care of the failover, and rebuild the required connection state. Therefore, by
default, no automatic failover is performed by the plugin.
A user that does not change the connection state after opening a connection may activate automatic
failover. Please note, that automatic failover logic is limited to connection attempts. Automatic failover
is not used for already established connections. There is no way to instruct the plugin to attempt
failover on a connection that has been connected to MySQL already in the past.
Automatic failover
The failover policy is configured in the plugins configuration file, by using the
directive.
Automatic and silent failover can be enabled through the
failover can either be configured to try exactly one master after a slave failure or, alternatively, loop
over slaves and masters before returning an error to the user. The number of connection attempts can
be limited and failed hosts can be excluded from future load balancing attempts. Limiting the number
of retries and remembering failed hosts are considered experimental features, albeit being reasonable
stable. Syntax and semantics may change in future versions.
Mysqlnd replication and load balancing plugin (mysqlnd_ms)
mysqli::query(): php_network_getaddresses: getaddrinfo failed: Name or service not known in %
mysqli::query(): [2002] php_network_getaddresses: getaddrinfo failed: Name or service not kno
mysqlnd_ms debug and trace
log.
failover
configuration directive. Automatic
2588
(see above) or, if no
E_WARNING
failover
configuration

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents