Answer the question
In order to leave comments, you need to log in
How to setup Health check load balancer on nginx?
Hello, there are 3 nodes that are added to upstream on nginx. Services are raised on them:
1) Web
2) Transmission / reception of data via tcp (abbreviation mci)
Each port has its own API. The task is the following - it is necessary to check the availability of servers using their api using get (for web) and post (for tcp) requests.
stream {
upstream mci_balancing {
server 172.22.5.32:37911 fail_timeout=3s;
server 172.22.5.33:37911 fail_timeout=3s;
server 172.22.5.34:37911 fail_timeout=3s;
#По MCI - вот такой POST запрос <IRIS Version="1" Message="StatusRequest"></IRIS>
}
server {
listen 37911;
proxy_pass mci_balancing;
proxy_timeout 3s;
proxy_connect_timeout 1s;
}
}
http {
upstream web_server {
ip_hash; #для сохранения сессии авторизации
server 172.22.5.32:8001;
server 172.22.5.33:8001;
server 172.22.5.34:8001;
#GET /?{%22request%22:%22ping%22
keepalive 64;
}
server {
listen 80;
location / {
proxy_pass http://web_server;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question