option originalto X X X X
option persist (*) X - X X
option redispatch (*) X - X X
+option redis-check X - X X
option smtpchk X - X X
option socket-stats (*) X X X -
option splice-auto (*) X X X X
See also : "redispatch", "retries", "force-persist"
+option redis-check
+ Use redis health checks for server testing
+ May be used in sections : defaults | frontend | listen | backend
+ yes | no | yes | yes
+ Arguments : none
+
+ It is possible to test that the server correctly talks REDIS protocol instead
+ of just testing that it accepts the TCP connection. When this option is set,
+ a PING redis command is sent to the server, and the response is analyzed to
+ find the "+PONG" response message.
+
+ Example :
+ option redis-check
+
+ See also : "option httpchk"
+
+
option smtpchk
option smtpchk <hello> <domain>
Use SMTP health checks for server testing
curproxy->options2 &= ~PR_O2_MYSQL_CHK;
curproxy->options2 &= ~PR_O2_PGSQL_CHK;
curproxy->options2 &= ~PR_O2_LDAP_CHK;
+ curproxy->options2 &= ~PR_O2_REDIS_CHK;
curproxy->options |= PR_O_HTTP_CHK;
if (!*args[2]) { /* no argument */
curproxy->check_req = strdup(DEF_CHECK_REQ); /* default request */
curproxy->options2 &= ~PR_O2_MYSQL_CHK;
curproxy->options2 &= ~PR_O2_PGSQL_CHK;
curproxy->options2 &= ~PR_O2_LDAP_CHK;
+ curproxy->options2 &= ~PR_O2_REDIS_CHK;
curproxy->options2 |= PR_O2_SSL3_CHK;
}
else if (!strcmp(args[1], "smtpchk")) {
curproxy->options2 &= ~PR_O2_MYSQL_CHK;
curproxy->options2 &= ~PR_O2_PGSQL_CHK;
curproxy->options2 &= ~PR_O2_LDAP_CHK;
+ curproxy->options2 &= ~PR_O2_REDIS_CHK;
curproxy->options |= PR_O_SMTP_CHK;
if (!*args[2] || !*args[3]) { /* no argument or incomplete EHLO host */
curproxy->options &= ~PR_O_SMTP_CHK;
curproxy->options2 &= ~PR_O2_SSL3_CHK;
curproxy->options2 &= ~PR_O2_LDAP_CHK;
+ curproxy->options2 &= ~PR_O2_REDIS_CHK;
curproxy->options2 &= ~PR_O2_MYSQL_CHK;
curproxy->options2 |= PR_O2_PGSQL_CHK;
}
}
+ else if (!strcmp(args[1], "redis-check")) {
+ /* use REDIS PING request to check servers' health */
+ if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[1], NULL))
+ err_code |= ERR_WARN;
+
+ free(curproxy->check_req);
+ curproxy->check_req = NULL;
+ curproxy->options &= ~PR_O_HTTP_CHK;
+ curproxy->options &= ~PR_O_SMTP_CHK;
+ curproxy->options2 &= ~PR_O2_SSL3_CHK;
+ curproxy->options2 &= ~PR_O2_MYSQL_CHK;
+ curproxy->options2 &= ~PR_O2_PGSQL_CHK;
+ curproxy->options2 &= ~PR_O2_LDAP_CHK;
+ curproxy->options2 |= PR_O2_REDIS_CHK;
+
+ curproxy->check_req = (char *) malloc(sizeof(DEF_REDIS_CHECK_REQ) - 1);
+ memcpy(curproxy->check_req, DEF_REDIS_CHECK_REQ, sizeof(DEF_REDIS_CHECK_REQ) - 1);
+ curproxy->check_len = sizeof(DEF_REDIS_CHECK_REQ) - 1;
+ }
+
else if (!strcmp(args[1], "mysql-check")) {
/* use MYSQL request to check servers' health */
if (warnifnotcap(curproxy, PR_CAP_BE, file, linenum, args[1], NULL))
curproxy->options &= ~PR_O_SMTP_CHK;
curproxy->options2 &= ~PR_O2_SSL3_CHK;
curproxy->options2 &= ~PR_O2_LDAP_CHK;
+ curproxy->options2 &= ~PR_O2_REDIS_CHK;
curproxy->options2 &= ~PR_O2_PGSQL_CHK;
curproxy->options2 |= PR_O2_MYSQL_CHK;
curproxy->options2 &= ~PR_O2_SSL3_CHK;
curproxy->options2 &= ~PR_O2_MYSQL_CHK;
curproxy->options2 &= ~PR_O2_PGSQL_CHK;
+ curproxy->options2 &= ~PR_O2_REDIS_CHK;
curproxy->options2 |= PR_O2_LDAP_CHK;
curproxy->check_req = (char *) malloc(sizeof(DEF_LDAP_CHECK_REQ) - 1);
(s->proxy->options2 & PR_O2_SSL3_CHK) ||
(s->proxy->options2 & PR_O2_MYSQL_CHK) ||
(s->proxy->options2 & PR_O2_PGSQL_CHK) ||
+ (s->proxy->options2 & PR_O2_REDIS_CHK) ||
(s->proxy->options2 & PR_O2_LDAP_CHK)) {
int ret;
const char *check_req = s->proxy->check_req;
set_server_check_status(s, HCHK_STATUS_L7STS, desc);
}
}
+ else if (s->proxy->options2 & PR_O2_REDIS_CHK) {
+ if (!done && s->check_data_len < 7)
+ goto wait_more_data;
+
+ if (strcmp(s->check_data, "+PONG\r\n") == 0) {
+ set_server_check_status(s, HCHK_STATUS_L7OKD, "Redis server is ok");
+ }
+ else {
+ set_server_check_status(s, HCHK_STATUS_L7STS, s->check_data);
+ }
+ }
else if (s->proxy->options2 & PR_O2_MYSQL_CHK) {
if (!done && s->check_data_len < 5)
goto wait_more_data;