SeouliteLab
Centos8 Haproxy 설치 본문
1. 설치
sudo yum install haproxy -y
2. 버전확인
haproxy -v
3. 환경설정
sudo vim /etc/haproxy/haproxy.cfg
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend main
#80포트 설정
bind *:80
#이 아래 부분 주석해야 외부에서 static 데이터 보임...
#acl url_static path_beg -i /static /images /javascript /stylesheets
#acl url_static path_end -i .jpg .gif .png .css .js
#use_backend static if url_static
#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend app
balance roundrobin
server app1 10.0.2.4:8080 check
server app2 10.0.2.8:8080 check
4. 환경설정 검증
sudo /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -c
5. 서비스 상태 확인
service haproxy status
6. 서비스 재시작
service haproxy restart
7. 방화벽 80 포트오픈
sudo firewall-cmd --add-port=80/tcp --zone=public --permanent
# 80 Port가 LISTEN 상태인지 확인한다
netstat -tlpn
8. 방화벽 재시작
sudo firewall-cmd --reload
9. 방화벽 정상등록 확인
sudo firewall-cmd --list-all
10. 시스템을 재부팅해도 haproxy가 자동 시작할 수 있도록 설정한다.
sudo chkconfig haproxy on
11. 잘 등록되었는지 확인 ^^
systemctl list-unit-files | grep haproxy
12. 부팅될때 자동시작
sudo systemctl enable --now haproxy
'프로그래밍' 카테고리의 다른 글
[JS] V8 엔진(자바스크립트 엔진)이란? (0) | 2024.02.27 |
---|---|
[MSA] 마이크로서비스 아키텍처(MSA)란? (0) | 2024.02.27 |
CentOS8 redis 설치 (0) | 2020.04.06 |
CentOS 8 ftp 설치 (0) | 2020.04.06 |
이클립스에서 웹서비스 만들기 (0) | 2018.12.29 |