Mysqlnd replication and load balancing plugin (
mysqlnd_ms
)
2648
MYSQLND_MS_QOS_CONSISTENCY_SESSION
or
MYSQLND_MS_QOS_CONSISTENCY_STRONG
.
service_level_option
An option to parameterize the requested service level. The
option can either be
MYSQLND_MS_QOS_OPTION_GTID
or
MYSQLND_MS_QOS_OPTION_AGE
.
The option
MYSQLND_MS_QOS_OPTION_GTID
can be used to refine
the service level
MYSQLND_MS_QOS_CONSISTENCY_SESSION
. It must be combined with a fourth function parameter, the
option_value
. The
option_value
shall be a global transaction
ID obtained from
mysqlnd_ms_get_last_gtid
. If set, the plugin
considers both master servers and asynchronous slaves for session
consistency (read your writes). Otherwise, only masters are used
to achieve session consistency. A slave is considered up-to-date
and checked if it has already replicated the global transaction ID
from
option_value
. Please note, searching appropriate slaves is
an expensive and slow operation. Use the feature sparsely, if the
master cannot handle the read load alone.
The
MYSQLND_MS_QOS_OPTION_AGE
option can be combined
with the
MYSQLND_MS_QOS_CONSISTENCY_EVENTUAL
service
level, to filter out asynchronous slaves that lag more seconds
behind the master than
option_value
. If set, the plugin will
only consider slaves for reading if
SHOW SLAVE STATUS
reports
Slave_IO_Running=Yes
,
Slave_SQL_Running=Yes
and
Seconds_Behind_Master <= option_value
. Please note,
searching appropriate slaves is an expensive and slow operation.
Use the feature sparsely in version 1.2.0. Future versions may
improve the algorithm used to identify candidates. Please, see
the MySQL reference manual about the precision, accuracy and
limitations of the MySQL administrative command
SHOW SLAVE
STATUS
.
option_value
Parameter value for the service level option. See also the
service_level_option
parameter.
Return Values
Returns
TRUE
if the connections service level has been switched to the requested. Otherwise, returns
FALSE
Notes
Note
mysqlnd_ms_set_qos
requires PHP >= 5.4.0 and PECL mysqlnd_ms >=
1.2.0. Internally, it is using a
mysqlnd
library C functionality not available with
PHP 5.3.
Examples
Example 20.302.
mysqlnd_ms_set_qos
example
<?php
/* Open mysqlnd_ms connection using mysqli, PDO_MySQL or mysql extension */
$mysqli = new mysqli("myapp", "username", "password", "database");
if (!$mysqli)
/* Of course, your error handling is nicer... */
die(sprintf("[%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
/* Session consistency: read your writes */
Содержание 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 ...