Oracle 5.0 Reference Manual page 2638

Table of Contents

Advertisement

Mysqlnd replication and load balancing plugin (mysqlnd_ms)
Filter:
object
node_groups
exactly one node for statement execution. A multi filter is typically
placed at the top of the filter chain. The
filter is another example of a multi filter.
The return value of the callback set for
array with two elements. The first element holds a list of selected
master servers. The second element contains a list of selected
slave servers. The lists shall contain the keys of the slave and
master servers as found in the slave and master lists passed to the
callback. The below example returns random master and slave lists
extracted from the functions input.
Example 20.282. Returning random masters and slaves
<?php
function pick_server($connected, $query, $masters, $slaves, $last_used_conn
{
$picked_masters = array()
foreach ($masters as $key => $value) {
if (mt_rand(0, 2) > 1)
$picked_masters[] = $key;
}
$picked_slaves = array()
foreach ($slaves as $key => $value) {
if (mt_rand(0, 2) > 1)
$picked_slaves[] = $key;
}
return array($picked_masters, $picked_slaves);
}
?>
The plugin will issue an error of type
the callback fails to return a server list. The error may read
(mysqlnd_ms) User multi filter callback has not
returned a list of servers to use. The callback
must return an array in %s on line
server list is not empty but has invalid servers key/ids in it, an error
of type
E_RECOVERABLE
like
(mysqlnd_ms) User multi filter callback has
returned an invalid list of servers to use. Server
id is negative in %s on line
Whether an error is emitted in case of an empty slave or master list
depends on the configuration. If an empty master list is returned for
a write operation, it is likely that the plugin will emit a warning that
may read
(mysqlnd_ms) Couldn't find the appropriate
master connection. 0 masters to choose from.
Something is wrong in %s on line
up error of type
E_ERROR
and an empty slave list the behavior depends on the fail over
configuration. If fail over to master is enabled, no error should
appear. If fail over to master is deactivated the plugin will emit a
warning that may read
(mysqlnd_ms) Couldn't find the
appropriate slave connection. 0 slaves to choose
from. Something is wrong in %s on line
The
filter lets you group cluster nodes and query
node_groups
selected groups, for example, to support data partitioning. Data
partitioning can be required for manual sharding, primary copy
based clusters running multiple masters, or to avoid hot spots in
2618
quality_of_service
user_multi
E_RECOVERABLE
%d. In case the
will the thrown with an error message
%d, or similar.
%d. Typically a follow
will happen. In case of a read operation
must be an an
if
%d.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents