Oracle 5.0 Reference Manual page 2631

Table of Contents

Advertisement

Mysqlnd replication and load balancing plugin (mysqlnd_ms)
Filter:
object
random
$link = new mysqli("myapp", "root", "", "test");
printf("[%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
$link->query("SELECT 1 FROM DUAL");
?>
The above example will output:
PHP Warning:
mysqli::mysqli(): (HY000/2000): (mysqlnd_ms) Error while
[2000] (mysqlnd_ms) Error while creating filter 'random' . Non-multi fi
PHP Warning:
mysqli::query(): Couldn't fetch mysqli in filter_warning.
The
filter features the random and random once load
random
balancing policies, set through the
versions.
The random policy will pick a random server whenever a read-only
statement is to be executed. The random once strategy picks a
random slave server once and continues using the slave for the rest
of the PHP web request. Random once is a default, if load balancing
is not configured through a filter.
If the
filter is not given any arguments, it stands for random
random
load balancing policy.
Example 20.275. Random load balancing with
{
"myapp": {
"master": {
"master_0": {
"host": "localhost"
}
},
"slave": {
"slave_0": {
"host": "192.168.78.136",
"port": "3306"
},
"slave_1": {
"host": "192.168.78.137",
"port": "3306"
}
},
"filters": [
"random"
]
}
}
Optionally, the
argument can be passed to the filter. If the
sticky
parameter
is set to the string 1, the filter follows the random
sticky
once load balancing strategy.
Example 20.276. Random once load balancing with
filter
{
"filters": {
2611
directive in older
pick[]
filter
random
random

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents