Mysqlnd replication and load balancing plugin (
mysqlnd_ms
)
2612
"random": {
"sticky": "1"
}
}
}
Both the
random
and
roundrobin
filters support setting a
priority, a weight for a server, since PECL/mysqlnd_ms 1.4.0.
If the
weight
argument is passed to the filter, it must assign a
weight for all servers. Servers must be given an alias name in the
slave
respectively
master
server lists. The alias must be used to
reference servers for assigning a priority with
weight
.
Example 20.277. Referencing error
[E_RECOVERABLE_ERROR] mysqli_real_connect(): (mysqlnd_ms) Unknown server 'slave3' in 'random' filter configuration. Stopping in %s on line %d
Using a wrong alias name with
weight
may result in an error
similar to the shown above.
If
weight
is omitted, the default weight of all servers is one.
Example 20.278. Assigning a
weight
for load balancing
{
"myapp": {
"master": {
"master1":{
"host":"localhost",
"socket":"\/var\/run\/mysql\/mysql.sock"
}
},
"slave": {
"slave1": {
"host":"192.168.2.28",
"port":3306
},
"slave2": {
"host":"192.168.2.29",
"port":3306
},
"slave3": {
"host":"192.0.43.10",
"port":3306
},
},
"filters": {
"random": {
"weights": {
"slave1":8,
"slave2":4,
"slave3":1,
"master1":1
}
}
}
}
}
At the average a server assigned a weight of two will be selected
twice as often as a server assigned a weight of one. Different
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...