Mysqlnd replication and load balancing plugin (
mysqlnd_ms
)
2614
List of filter arguments.
Keyword
Description
Version
weight
Assigns a load balancing weight/priority to a
server. Please, find a description
above
.
Since 1.4.0.
Filter:
user
object
The
user
replaces
mysqlnd_ms_set_user_pick_server
function, which was removed in 1.1.0-beta. The filter sets a callback
for user-defined read/write splitting and server selection.
The plugins built-in read/write query split mechanism
decisions can be overwritten in two ways. The easiest
way is to prepend a query string with the SQL hints
MYSQLND_MS_MASTER_SWITCH
,
MYSQLND_MS_SLAVE_SWITCH
or
MYSQLND_MS_LAST_USED_SWITCH
. Using SQL hints one can
control, for example, whether a query shall be send to the MySQL
replication master server or one of the slave servers. By help of
SQL hints it is not possible to pick a certain slave server for query
execution.
Full control on server selection can be gained using a callback
function. Use of a callback is recommended to expert users only
because the callback has to cover all cases otherwise handled by
the plugin.
The plugin will invoke the callback function for selecting a server
from the lists of configured master and slave servers. The callback
function inspects the query to run and picks a server for query
execution by returning the hosts URI, as found in the master and
slave list.
If the lazy connections are enabled and the callback chooses a
slave server for which no connection has been established so
far and establishing the connection to the slave fails, the plugin
will return an error upon the next action on the failed connection,
for example, when running a query. It is the responsibility of
the application developer to handle the error. For example, the
application can re-run the query to trigger a new server selection
and callback invocation. If so, the callback must make sure to select
a different slave, or check slave availability, before returning to the
plugin to prevent an endless loop.
Example 20.280. Setting a callback
{
"myapp": {
"master": {
"master_0": {
"host": "localhost"
}
},
"slave": {
"slave_0": {
"host": "192.168.78.136",
"port": "3306"
}
},
"filters": {
"user": {
"callback": "pick_server"
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...