brunch
매거진 kakao cloud

카카오 클라우드 2탄-5. 로드밸런서

by Master Seo

<1 > was lb 생성하기

<2> 우분트 웹서버 에 nginx 설치 (선택)

<3> web lb 생성



<1 > was lb 생성하기


1

was subnet에 생성


2

networking > load balancer


3

리스너 타켓 그룹 8080 http





<2> 우분트 웹서버 에 nginx 설치 (선택)


1

sudo apt-get update

sudo apt-get install -y nginx

sudo systemctl enable nginx

sudo systemctl start nginx



# 기존 default 설정 삭제

$ sudo rm /etc/nginx/sites-enabled/default



# web.conf 파일 생성 및 데이터 추가

# proxy_pass 에 앞서 설정한 WAS로드밸런서의 IP를 입력

$ sudo vi /etc/nginx/conf.d/web.conf

------------ 아래 내용을 붙여넣고 WAS_LB_IP 수정 -------------

server {

listen *:80;

server_name _;

access_log /var/log/nginx/access_library.log;

error_log /var/log/nginx/error_library.log;

location / {

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_http_version 1.1;

proxy_set_header Upgrade $http_upgrade;

proxy_set_header Connection "Upgrade";

proxy_buffering off;

proxy_request_buffering off;

proxy_hide_header X-Frame-Options;

proxy_pass http://${WAS_LB_IP}:8080;

}

}



# 웹 서버 재시작

$ sudo systemctl restart nginx



$ sudo lsof -i:80

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

nginx 14060 root 8u IPv4 46063 0t0 TCP *:http (LISTEN)

nginx 14061 www-data 8u IPv4 46063 0t0 TCP *:http (LISTEN)

nginx 14062 www-data 8u IPv4 46063 0t0 TCP *:http (LISTEN)






<3> web lb 생성


1

kakao lb는 현재 alb이다.


2

LB 생성

Public web subnet 에 생성


game-web-alb1



3

web lb에 공인ip 연결.

// 공인ip는 기본 10개 할당?


4

상태 확인




5

접속확인




다음

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


감사합니다.

keyword
매거진의 이전글카카오 클라우드 2탄-4. 데이터 베이스