tanszek:oktatas:iss_t:docker2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tanszek:oktatas:iss_t:docker2 [2023/04/16 18:46] – knehez | tanszek:oktatas:iss_t:docker2 [2023/04/16 18:50] (current) – knehez | ||
---|---|---|---|
Line 1: | Line 1: | ||
==== Scale services with load balancing ==== | ==== Scale services with load balancing ==== | ||
- | https:// | + | https:// |
**HAProxy** is an open-source software that provides High Availability services, load balancing, and proxying for **TCP** and **HTTP**-based applications. It is used to distribute incoming network traffic across multiple servers to improve performance, | **HAProxy** is an open-source software that provides High Availability services, load balancing, and proxying for **TCP** and **HTTP**-based applications. It is used to distribute incoming network traffic across multiple servers to improve performance, | ||
Line 26: | Line 26: | ||
</ | </ | ||
+ | HAproxy config: | ||
+ | |||
+ | The following configuration sets up HAProxy to listen on port 80 for incoming HTTP traffic and distribute it across five backend servers that are checked for health before traffic is forwarded. It also sets up a stats interface on port 8404 to monitor the HAProxy instance. | ||
+ | |||
+ | < | ||
+ | global | ||
+ | stats socket / | ||
+ | log stdout format raw local0 info | ||
+ | |||
+ | defaults | ||
+ | mode http | ||
+ | timeout client 10s | ||
+ | timeout connect 5s | ||
+ | timeout server 10s | ||
+ | timeout http-request 10s | ||
+ | log global | ||
+ | |||
+ | frontend stats | ||
+ | bind *:8404 | ||
+ | stats enable | ||
+ | stats uri / | ||
+ | stats refresh 10s | ||
+ | |||
+ | frontend myfrontend | ||
+ | bind 0.0.0.0:80 | ||
+ | mode http | ||
+ | default_backend webservers | ||
+ | |||
+ | backend webservers | ||
+ | server s1 web:5000 check | ||
+ | server s2 web:5000 check | ||
+ | server s3 web:5000 check | ||
+ | server s4 web:5000 check | ||
+ | server s5 web:5000 check | ||
+ | </ | ||
This is a sample HAProxy configuration that defines various global settings, default settings, and frontend/ | This is a sample HAProxy configuration that defines various global settings, default settings, and frontend/ | ||
Line 35: | Line 70: | ||
- The backend webservers section defines a backend that consists of five servers, all with the name web and listening on port 5000. The check option specifies that HAProxy should check the health of each server before forwarding traffic to it. | - The backend webservers section defines a backend that consists of five servers, all with the name web and listening on port 5000. The check option specifies that HAProxy should check the health of each server before forwarding traffic to it. | ||
- | In summary, this configuration sets up HAProxy | + | How to run? |
+ | docker-compose up --scale web=4 |
tanszek/oktatas/iss_t/docker2.1681670763.txt.gz · Last modified: 2023/04/16 18:46 by knehez