brunch
매거진 NCP

(정식)Lab8. 로드 밸런서

by Master Seo

목표

# NLB 만들어보자

# ALB 만들어 보자

# ALB에서 /ip로 분기해보자



<1> NLB생성

<2> ALB생성

<3> ALB 에서 /ip 분기

<4> ALB 사용시, X-Forwarder-For 설정하여 사용자 IP 확인 하기



<1> NLB생성


슬라이드2.JPG
슬라이드3.JPG






1

web-nlb-tg 생성

tcp



2

lb 생성

web-nlb

Public

다이나믹 사이즈



3

80 허용


4

확인




<2> ALB생성


1

web-alb-tg

생성



2

alb 생성

web-alb

Public

small



3

80 허용



4

확인




<3> ALB 에서 /ip 분기


1

# 타깃 그룹 생성


alb-ip-tg



2

# ALB 로드밸런서에서 리스너 설정 변경


ALB > 리스너 설정 변경

규칙/ 조회 변경


규칙 추가

1


조건

path pattern 우측 추가

Path Pattern /ip/

추가

TagetGroup - alb-ip-tg




2

확인

/ip/





<4> ALB 사용시, X-Forwarder-For 설정하여 사용자 IP 확인 하기


1


[root@s107113338 httpd]# cd /etc/httpd/conf

[root@s107113338 conf]# vi httpd.conf

[root@s107113338 conf]# systemctl restart httpd

[root@s107113338 conf]# tail -f /var/log/httpd/access_log



2

set number

201



X-Forwarder-For 설정


변경전

# LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined



LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined



3

서버 로그에서 확인

[root@s107113338 conf]# tail -f /var/log/httpd/access_log





https://brunch.co.kr/@topasvga/4855


keyword
매거진의 이전글(정식)Lab7. VPC Peering, NAS