본문 바로가기
Infra/프라이빗 클라우드 인프라

LBaaS를 통한 Loadbalance

by shinebee* 2020. 7. 13.

< LBaaS 생성>

1. 확인을 위한 configure-httpd 파일 생성

vi configure-httpd1
	#!/bin/bash
	yum -y install httpd
	systemctl start httpd
	systemctl enable httpd
	echo "WEB1" > /var/www/html/index.html
    
vi configure-httpd2
	#!/bin/bash
	yum -y install httpd
	systemctl start httpd
	systemctl enable httpd
	echo "WEB2" > /var/www/html/index.html

 

 

2. Instance 생성

openstack server create --image centos7 --flavor wp --key-name all-key --network all-net --security-group "SSH&ICMP&HTTP" --user-data configure-httpd1 web1
openstack server create --image centos7 --flavor wp --key-name all-key --network all-net --security-group "SSH&ICMP&HTTP" --user-data configure-httpd2 web2

 

 

3. log 확인

openstack console log show web1
openstack console log show web2

 

 

4. loadbalancer 생성

neutron lbaas-loadbalancer-create --name web-lb all-subnet

 

 

5. listnener 생성

neutron lbaas-listener-create --loadbalancer web-lb --protocol HTTP --protocol-port 80 --name web-lb-listener

 

 

6. pool 생성

neutron lbaas-pool-create --name web-lb-pool --lb-algorithm ROUND_ROBIN --listener web-lb-listener --loadbalancer web-lb --protocol HTTP

 

 

7. member 생성

neutron lbaas-member-create --name web-lb-web1 --weight 100 --subnet all-subnet --address 10.10.10.4 --protocol-port 80 web-lb-pool
neutron lbaas-member-create --name web-lb-web2 --weight 100 --subnet all-subnet --address 10.10.10.11 -protocol-port 80 web-lb-pool

 

 

8. 상태 모니터 생성

neutron lbaas-healthmonitor-create --name web-lb-monitor --delay 5 --timeout 5 --http-method GET --url-path '/' --max-retries 3 --type HTTP --pool web-lb-pool

 

 

9. 유동 IP 연결

neutron lbaas-loadbalancer-show web-lb -c name -c vip_port_id //port 검색

openstack floating ip create --port [vip_port_id] 192.168.122.112 (ext-net)

 

 

10.  확인

watch -n 1 curl 192.168.122.112

 

 


 

< LBaaS 삭제 >

※ 생성한 순서 반대로 차례대로 삭제해주어야 오류나지않는다.

 

1. member 삭제

neutron lbaas-member-delete web-lb-web1 web-lb-pool
neutron lbaas-member-delete web-lb-web2 web-lb-pool

 

 

2. pool 삭제

neutron lbaas-pool-delete web-lb-pool

 

 

3. listener 삭제

neutron lbaas-listener-delete web-lb-listener

 

 

4. 유동 IP 연결 해제

openstack floation ip unset --port 192.168.122.112

 

 

5. loadbalancer 삭제

neutron lbaas-loadbalancer-delete web-lb

'Infra > 프라이빗 클라우드 인프라' 카테고리의 다른 글

Auto Scaling  (0) 2020.07.17
NFS를 Cinder로 사용하기  (0) 2020.07.10
Swift deivce add  (0) 2020.07.08
Object Storage(swift) 서비스 관리  (0) 2020.07.08
Image 생성 - error  (0) 2020.07.07

댓글