Hello,
is it possible to perform different checks according to the server
destination?
I have an active/passive backend that contain 2 servers.
The first server is the A machine (main), the second server is the B
machine (backup). These machines runs a web application with a Database
(which is located on an another machine) and Apache.
My backend is configure to perform httpchk on a PHP script which control
the state of the web app (basically just a request on a web page which
have his content generate by a SQL request). If this check is OK,
clients go to A. If not, they go to B.
But if the check is NOK due to Database issues and Apache is correctly
running on A, I want to clients go to A (or B if Apache on A is not
running). That's why I need a second check script which only control the
state of Apache.
I need TWO different httpchk for ONE backend.
I don't have see this possibility on the official documentation or by
Internet researches.
So, to do this, I have defined two VirtualHost. The first (listening on
port 80) is the normal web site with the PHP script on /check/check.php.
The second (listening on port 8000) is here to allow another PHP script
on the same URL.
backend config:
backend www.site.fr
mode http
log global
balance roundrobin
cookie CZKLJasD insert indirect nocache
option httpclose
option httpchk GET /check/check.php HTTP/1.1\r\nHost:\ www.site.fr
option forwardfor except 127.0.0.1
server main 192.168.1.65:80 cookie main check port 80
server bu 192.168.1.66:80 cookie bu check port 80 backup
server bmain 192.168.1.65:80 cookie bmain check port 8000 backup
server bbu 192.168.1.66:80 cookie bbu check port 8000 backup
This configuration is working well on my model. But I don't want to add
another port listening on my Apache on production. Is it possible to
perform two different checks on the same backend. One for "main" and
"bu", another for "bmain" and "bbu"?
The ideal config:
backend www.site.fr
mode http
log global
balance roundrobin
cookie CZKLJasD insert indirect nocache
option httpclose
option httpchk1 GET /check/check_database_and_apache.php
HTTP/1.1\r\nHost:\ www.site.fr
option httpchk2 GET /check/check_apache.php HTTP/1.1\r\nHost:\
www.site.fr
option forwardfor except 127.0.0.1
server main 192.168.1.65:80 cookie main check1 port 80
server bu 192.168.1.66:80 cookie bu check1 port 80 backup
server bmain 192.168.1.65:80 cookie bmain check2 port 80 backup
server bbu 192.168.1.66:80 cookie bbu check2 port 80 backup
Best regards,
Adrien