728x90
이전 실습에 이어 구성
/etc/haproxy/haproxy.cfg 파일 수정
tcp 모드로 설정해야 http, mysql 동시 구성 가능
[root@haproxy ~]# vi /etc/haproxy/haproxy.cfg
4 pidfile /var/run/haproxy.pid
5 maxconn 255
6 user haproxy
7 group haproxy
8 daemon
9
10 defaults
11 mode tcp
12 log global
13 timeout connect 30s
14 timeout server 60s
15 timeout client 60s
16
17 frontend loadbalancer_db
18 bind *:3306
19 default_backend mariadb
20
21 backend mariadb
22 balance roundrobin
23 server db01 10.0.2.10:3306 check
24 server db02 10.0.2.20:3306 check
25
26
27 frontend loadbalancer_web
28 bind *:80
29 default_backend web
30
31 backend web
32 balance roundrobin
33 server web01 10.0.2.30:80 check
34 server web02 10.0.2.31:80 check
로드밸런서에서 작동 확인
* 주의
tcp 동작 모드로 할 경우 웹 서버의 로드밸런싱 속도가 느려짐
http 동작 모드로 변경하면 정상 속도로 돌아옴
728x90
'쿠버네티스 교육 > 프로젝트' 카테고리의 다른 글
220527_1_세미 프로젝트_웹 서비스 구축_네트워크 티밍 (0) | 2022.05.27 |
---|---|
220526_4_세미 프로젝트_웹 서비스 구축_L4 로드밸런서 구성 (0) | 2022.05.26 |
220526_3_세미 프로젝트_웹 서비스 구축_HAProxy 로그 기록 방식 정의 (0) | 2022.05.26 |
220526_2_세미 프로젝트_웹 서비스 구축_로드밸런서 SSL 인증서 적용 (0) | 2022.05.26 |
220526_1_세미 프로젝트_웹 서비스 구축_로드밸런서 상태 체크 (0) | 2022.05.26 |