Oracle 5.0 Reference Manual page 2581

Table of Contents

Advertisement

"slave": {
}
}
}
The plugin attempts to notify you of invalid configurations. Since 1.5.0 it will throw a warning during
PHP startup if the configuration file cannot be read, is empty or parsing the JSON failed. Depending
on your PHP settings those errors may appear in some log files only. Further validation is done when
a connection is to be established and the configuration file is searched for valid sections. Setting
mysqlnd_ms.force_config_usage
debugging notes
20.7.6.4.2. Running statements
Copyright 1997-2012 the PHP Documentation Group. [2230]
The plugin can be used with any PHP MySQL extension (mysqli, mysql, and PDO_MYSQL) that is
compiled to use the
change the API or behavior of those extensions.
Whenever a connection to MySQL is being opened, the plugin compares the host parameter value of
the connect call, with the section names from the plugin specific configuration file. If, for example, the
plugin specific configuration file has a section
a MySQL connection to the host
Example 20.219. Plugin specific configuration file (mysqlnd_ms_plugin.ini)
{
"myapp": {
"master": {
},
"slave": {
}
}
}
Example 20.220. Opening a load balanced connection
<?php
/* Load balanced following "myapp" section rules from the plugins config file */
$mysqli = new mysqli("myapp", "username", "password", "database");
$pdo = new PDO('mysql:host=myapp;dbname=database', 'username', 'password');
$mysql = mysql_connect("myapp", "username", "password");
?>
The connection examples above will be load balanced. The plugin will send read-only statements to
the MySQL slave server with the IP
connection. All other statements will be directed to the MySQL master server running on the host
Mysqlnd replication and load balancing plugin (mysqlnd_ms)
"slave_0": {
"host": "127.0.0.1",
"port": "3306"
}
may help debugging a faulty setup. Please, see also
[2606].
mysqlnd
library. PECL/mysqlnd_ms plugs into the
myapp
"master_0": {
"host": "localhost",
"socket": "\/tmp\/mysql.sock"
}
"slave_0": {
"host": "192.168.2.27",
"port": "3306"
}
192.168.2.27
then the section should be referenced by opening
myapp
and will listen on port
2561
configuration file
mysqlnd
library. It does not
for the MySQL client
3306

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents