mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-25 14:12:13 +00:00
MEDIUM: checks: Make post-41 the default mode for mysql checks
MySQL 4.1 is old enough to be the default mode for mysql checks. So now, once a username is defined, post-41 mode is automatically used. To do mysql checks on previous MySQL version, the argument "pre-41" must be used. Note, it is a compatibility breakage for everyone using an antique and unsupported MySQL version.
This commit is contained in:
parent
784063eeb2
commit
62f79fe68a
@ -7745,14 +7745,15 @@ no option logasap
|
||||
logging.
|
||||
|
||||
|
||||
option mysql-check [ user <username> [ post-41 ] ]
|
||||
option mysql-check [ user <username> [ { post-41 | pre-41 } ] ]
|
||||
Use MySQL health checks for server testing
|
||||
May be used in sections : defaults | frontend | listen | backend
|
||||
yes | no | yes | yes
|
||||
Arguments :
|
||||
<username> This is the username which will be used when connecting to MySQL
|
||||
server.
|
||||
post-41 Send post v4.1 client compatible checks
|
||||
post-41 Send post v4.1 client compatible checks (the default)
|
||||
pre-41 Send pre v4.1 client compatible checks
|
||||
|
||||
If you specify a username, the check consists of sending two MySQL packet,
|
||||
one Client Authentication packet, and one QUIT packet, to correctly close
|
||||
|
@ -89,13 +89,13 @@ haproxy h1 -conf {
|
||||
backend be2
|
||||
log ${S2_addr}:${S2_port} daemon
|
||||
option log-health-checks
|
||||
option mysql-check user user
|
||||
option mysql-check user user pre-41
|
||||
server srv ${h1_mysql1_addr}:${h1_mysql1_port} check inter 1s rise 1 fall 1
|
||||
|
||||
backend be3
|
||||
log ${S3_addr}:${S3_port} daemon
|
||||
option log-health-checks
|
||||
option mysql-check user user post-41
|
||||
option mysql-check user user
|
||||
server srv ${h1_mysql2_addr}:${h1_mysql2_port} check inter 1s rise 1 fall 1
|
||||
|
||||
backend be4
|
||||
|
14
src/checks.c
14
src/checks.c
@ -6852,21 +6852,21 @@ int proxy_parse_mysql_check_opt(char **args, int cur_arg, struct proxy *curpx, s
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (*args[cur_arg+2]) {
|
||||
if (strcmp(args[cur_arg+2], "post-41") != 0) {
|
||||
ha_alert("parsing [%s:%d] : keyword '%s' only supports option 'post-41' (got '%s').\n",
|
||||
file, line, args[cur_arg], args[cur_arg+2]);
|
||||
goto error;
|
||||
}
|
||||
if (!*args[cur_arg+2] || strcmp(args[cur_arg+2], "post-41") == 0) {
|
||||
packetlen = userlen + 7 + 27;
|
||||
mysql_req = mysql41_req;
|
||||
mysql_rsname = mysql41_rsname;
|
||||
}
|
||||
else {
|
||||
else if (strcmp(args[cur_arg+2], "pre-41") == 0) {
|
||||
packetlen = userlen + 7;
|
||||
mysql_req = mysql40_req;
|
||||
mysql_rsname = mysql40_rsname;
|
||||
}
|
||||
else {
|
||||
ha_alert("parsing [%s:%d] : keyword '%s' only supports 'post-41' and 'pre-41' (got '%s').\n",
|
||||
file, line, args[cur_arg], args[cur_arg+2]);
|
||||
goto error;
|
||||
}
|
||||
|
||||
hdr[0] = (unsigned char)(packetlen & 0xff);
|
||||
hdr[1] = (unsigned char)((packetlen >> 8) & 0xff);
|
||||
|
Loading…
Reference in New Issue
Block a user