nmcli connection add type ethernet con-name static ifname eth1 ipv4.addresses 192.168.10.10/24 ipv4.method manual
$ dnf install httpd
$ systemctl enable --now httpd
$ echo "This is 01-webserver" > /var/www/html/index.html
$ firewall-cmd --add-service=http
nmcli connection add type ethernet con-name static ifname eth1 ipv4.addresses 192.168.10.20/24 ipv4.method manual
$ dnf install httpd
$ systemctl enable --now httpd
$ echo "This is 02-webserver" > /var/www/html/index.html
$ firewall-cmd --add-service=http
nmcli connection add type ethernet con-name static ifname eth1 ipv4.addresses 192.168.10.100/24 ipv4.method manual
dnf install -y httpd
dnf install -y haproxy
$ vi /etc/haproxy/haproxy.cfg
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
.
.
.
# 기타 옵션, 타임 아웃 등 설정
defaults
mode http # 웹 서버에 대한 로드밸런싱(애플리케이션 계층)
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 3000
#
frontend main
bind *:80 # 모든 ip의 http 통신 가능
default_backend app
# lb를 거쳐갈 실제 서버
backend app
balance roundrobin # 번갈아가며 전송하는 라운드 로빈 방식
server app1 192.168.10.10:80 check
server app2 192.168.10.20:80 check
# 파일 설정 후 시스템 시작
$ systemctl enable --now haproxy.service
$ ss -nltp | grep 80
LISTEN 0 3000 0.0.0.0:80 0.0.0.0:* users:(("haproxy",pid=3794,fd=6))
$ firewall-cmd --add-service=http
