Concepts
PHP Manual

Failover

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.

It is up to the application to handle the error and, if need be, re-issue the query to trigger 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 wrong 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 done by the plugin.

An user who does not change the connection state after opening a connection may activate automatic master failover.

The failover policy is configured in the plugins configuration file by help of the failover configuration directive.


Concepts
PHP Manual