Mysqlnd replication and load balancing plugin (
mysqlnd_ms
)
2631
MySQL replication master server and two MySQL replication slaves,
the plugin will open three connections upon the first call to a connect
function although the application might use the master connection
only.
Lazy connections bare a risk if you make heavy use of actions which
change the state of a connection. The plugin does not dispatch
all state changing actions to all connections from the connection
pool. The few dispatched actions are applied to already opened
connections only. Lazy connections opened in the future are not
affected. If, for example, the connection character set is changed
using a PHP MySQL API call, the plugin will change the character
set of all currently opened connection. It will not remember the
character set change to apply it on lazy connections opened in
the future. As a result the internal connection pool would hold
connections using different character sets. This is not desired.
Remember that character sets are taken into account for escaping.
master_on_write
bool
If set, the plugin will use the master server only after the first
statement has been executed on the master. Applications can
still send statements to the slaves using SQL hints to overrule the
automatic decision.
The setting may help with replication lag. If an application runs an
INSERT
the plugin will, by default, use the master to execute all
following statements, including
SELECT
statements. This helps to
avoid problems with reads from slaves which have not replicated the
INSERT
yet.
trx_stickiness
string
Transaction stickiness policy. Supported policies:
disabled
(default),
master
.
Experimental feature.
The setting requires 5.4.0 or newer. If used with PHP older
than 5.4.0, the plugin will emit a warning like
(mysqlnd_ms)
trx_stickiness strategy is not supported before
PHP 5.3.99
.
If no transaction stickiness policy is set or, if setting
trx_stickiness=disabled
, the plugin is not transaction
aware. Thus, the plugin may load balance connections and switch
connections in the middle of a transaction. The plugin is not
transaction safe. SQL hints must be used avoid connection switches
during a transaction.
As of PHP 5.4.0 the mysqlnd library allows the plugin
to monitor the
autocommit
mode set by calls to
the libraries
trx_autocommit()
function. If setting
trx_stickiness=master
and
autocommit
gets disabled by
a PHP MySQL extension invoking the
mysqlnd
library internal
function call
trx_autocommit()
, the plugin is made aware of the
begin of a transaction. Then, the plugin stops load balancing and
directs all statements to the master server until
autocommit
is
enabled. Thus, no SQL hints are required.
An example of a PHP MySQL API function calling the
mysqlnd
library internal function call
trx_autocommit()
is
mysqli_autocommit
.
Содержание 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 ...