Network Load Balancer(NLB) Guide(KR) - cloud-barista/cb-spider GitHub Wiki
Network Load Balancer Management Guide
1. CB-Spider NLB ๊ฐ์
- ์ฌ์ฉ์๋ VPC ๋ด์ VM์ ํฅํ ์ธ๋ถ์ Client ์์ฒญ ๋ฐ ์
๋ ฅ ์คํธ๋ฆผ์ ๋ํ ๋ถํ ๋ถ์ฐ(Load Balancing)์ ๊ด๋ฆฌํ๊ธฐ ์ํด์
- ๊ทธ๋ฆผ๊ณผ ๊ฐ์ด ํน์ VPC์ ์์๋๋ Network Load Balancer(์ดํ NLB)๋ฅผ ์์ฑ ๋ฐ ๊ตฌ์ฑํ ์ ์๋ค.
- NLB ์์ฑ์์ ๋์ VM(VM Group)์ ํจ๊ป ์ค์ ํ ์๋ ์๊ณ , NLB ์์ฑ ํ์ VM์ ์ถ๊ฐํ ์๋ ์๋ค.
- ์์ธ: KT NLB๋ VPC๊ฐ ์๋ Subnet ๋์์ผ๋ก ์์ฑ์ด ๊ฐ๋ฅํ๋ค.
- KT NLB๋ ๋์ VM(VM Group)๊ณผ ํจ๊ป ์์ฑํ๋ ๋ฐฉ์๋ง ์ง์ํ๋ฉฐ, ์ค์ ํ VM์ด ์ํ Subnet์ NLB๊ฐ ์์ฑ๋๋ค.
- ๋ํ, NLB์ ๋์ผํ Subnet์ VM๋ค๋ง VM Group์ ์ถ๊ฐ ๋ฐ ์ด์์ด ๊ฐ๋ฅํ๋ค.
- NLB๋ Public ํ์
๊ณผ Internal ํ์
์ ์ ํํ์ฌ ์์ฑํ ์ ์๋ค.
- Public ํ์ (default): ์ธ๋ถ ์ธํฐ๋ท์ ํตํ ์ฌ์ฉ์์ ํด๋ผ์ด์ธํธ ์คํธ๋ฆผ์ ๋ํ ๋ถํ ๋ถ์ฐ
- Internal ํ์ : ๋ด๋ถ VM ๊ฐ์ ์คํธ๋ฆผ์ ๋ํ ๋ถํ ๋ถ์ฐ
- Public ํ์ ์ ๊ณต ์ค์ฌ์ผ๋ก ์ ๊ฐ๋ฐ ๋ฐ ์ฐ์ ํ์ฉ
- NLB๋ Region ๋ฒ์์ Global ๋ฒ์์ ์ด์์ ์ ํํ์ฌ ์์ฑํ ์ ์๋ค.
- Regional NLB(default): ๋จ์ผ Region์์ ์ด์๋๋ ๋ก๋ ๋ฐธ๋ฐ์
- Global NLB: ๋ฉํฐ Region์์ ์ด์๋๋ ๋ก๋ ๋ฐธ๋ฐ์
- Regional NLB ์ ๊ณต ์ค์ฌ์ผ๋ก ์ ๊ฐ๋ฐ ๋ฐ ์ฐ์ ํ์ฉ
2. CB-Spider NLB ๊ตฌ์ฑ ์์
- NLB๋ ๊ทธ๋ฆผ๊ณผ ๊ฐ์ด ํ๋ก ํธ์๋(Frontend) ์์ญ๊ณผ ๋ฐฑ์๋(Backend) ์์ญ์ผ๋ก ๊ตฌ๋ถ๋๋ฉฐ,
์์ญ๋ณ ์ฃผ์ ๊ตฌ์ฑ ์์๋ ๋ค์๊ณผ ๊ฐ๋ค.
-
[NLB-Frontend Tier]
(1) ํ๋ก ํธ์๋ ๋ฆฌ์ค๋(Frontend Listener)
- ๋ฆฌ์ค๋๋ Client์ ์์ฒญ ๋ฐ ์ ๋ ฅ ์คํธ๋ฆผ์ ์์ ํ์ฌ ๋ฐฑ์๋ ์์ญ์ VM๊ทธ๋ฃน์ผ๋ก ์ ๋ฌํ๋ค.
- ํ๋์ NLB๋ ํ๋์ ๋ฆฌ์ค๋๋ฅผ ํฌํจํ๋ฉฐ, ์์ ํ๋กํ ์ฝ, IP ๋ฐ ์์ ํฌํธ๋ก ๊ตฌ์ฑ๋๋ค.
- ์ ํ ๊ฐ๋ฅํ ์์ ํ๋กํ ์ฝ์ TCP ๋ฐ UDP์ด๋ฉฐ, IP๋ CSP ๋๋ ๋์ Driver์์ ์๋ ์์ฑ ๋ฐ ๊ด๋ฆฌ๋๋ค.
- ์์ ํฌํธ๋ 1-65535 ๋ฒ์์ ๊ฐ์ผ๋ก ์ค์ ์ด ๊ฐ๋ฅํ๋ค.
- โป ๋ฆฌ์ค๋ IP์ DNS-Name: ๋๋ค ์ ๊ณตํ๊ฑฐ๋ ๋์ค ํ๋๋ง ์ ๊ณตํ ์ ์์
-
[NLB-Backend Tier]
(2) ๋ฐฑ์๋ VM ๊ทธ๋ฃน(Backend VM Group)
- VM ๊ทธ๋ฃน์ ๋์ผํ ์๋น์ค(nginx, redis, ์ฌ์ฉ์ ๊ฐ๋ฐ ์๋น์ค ๋ฑ)๋ฅผ ์ ๊ณตํ๋ VM๋ค์ ์งํฉ์ด๋ฉฐ, VM์ ๋ฑ๋ก ๋๋ ์ ์ธ๊ฐ ๊ฐ๋ฅํ๋ค.
- VM ๊ทธ๋ฃน์ ํฌํจ๋ ์ ์๋ VM์ NLB์ ๋์ผํ VPC์ ์ํด ์๋ VM๋ค๋ก ํ์ ๋๋ค.
- ํ๋์ NLB๋ ํ๋์ VM ๊ทธ๋ฃน์ ํฌํจํ๋ฉฐ, VM ๊ทธ๋ฃน์ ์์ ํ๋กํ ์ฝ, ์์ ํฌํธ ๋ฐ VM๋ค๋ก ๊ตฌ์ฑ๋๋ค.
- ์ ํ ๊ฐ๋ฅํ ์์ ํ๋กํ ์ฝ์ TCP, UDP์ด๋ฉฐ,
- VM ๊ทธ๋ฃน์ ํ๋์ ์์ ํฌํธ๋ฅผ ์ค์ ํ ์ ์๋ค. (ํฌํธ๋ฒ์: 1-65535)
- VM ๊ทธ๋ฃน ๋ด์ VM๋ค์ VM ๊ทธ๋ฃน ์ค์ ๊ณผ ๋์ผํ ํ๋กํ ์ฝ ๋ฐ ํฌํธ ๋ฒํธ๋ฅผ ํตํด์ ์๋น์ค ์ ๊ณต์ด ๊ฐ๋ฅํ๋ค.
(3) ํฌ์ค ์ฒดํฌ๊ธฐ(Health Checker)
-
ํ๋์ NLB๋ ํ๋์ ํฌ์ค ์ฒดํฌ๊ธฐ๋ฅผ ํฌํจํ๋ฉฐ,
-
ํฌ์ค ์ฒดํฌ๊ธฐ๋ VM ๊ทธ๋ฃน์ ํฌํจ๋ VM๋ค์ ํฌ์ค ์ํ ์ ๋ณด๋ฅผ ์ ๊ณตํ๋ค.
- Healthy VM ๋ชฉ๋ก, Unhealthy VM ๋ชฉ๋ก ๋ฑ ์ ๊ณต
- ์ถ๊ฐ๋ VM์ ์ต์ด ํฌ์ค ์ํ ์ฒดํฌ๋ ์์ด~์๋ถ ์ ๋ ์์
-
ํฌ์ค ์ฒดํฌ๊ธฐ์ ์ ํ ๊ฐ๋ฅํ ํ๋กํ ์ฝ์ TCP ๋ฐ HTTP์ด๋ฉฐ,
-
VM ๊ทธ๋ฃน์ ์์๋ VM๋ค์ ํฌ์ค ์ํ๋ฅผ ์ฒดํฌํ๊ธฐ ์ํด์ VM ๊ทธ๋ฃน๊ณผ ๋์ผํ ํฌํธ๋ฅผ ํ์ฉํ๊ฑฐ๋
-
๋ณ๋์ ํฌ์ค ์ฒดํฌ ์ ์ฉ ํฌํธ(๊ทธ๋ฆผ์์ Port 81)๋ฅผ ๋ณ๋๋ก ์ค์ ํ ์ ์๋ค.
-
๊ฐ VM์ ์๋น์ค ํฌํธ ๋ฐ ํฌ์ค ์ฒดํฌ์ฉ ํฌํธ ์ฉ๋์ ์๋น์ค ๋ฐ๋ชฌ์ ์ฌ์ฉ์์ ์ํด ์ค๋น๋์ด์ผ ํ๋ค.
-
ํฌ์ค ์ฒดํฌ๊ธฐ๋ ์ํ ์ฒดํฌ ์ฃผ๊ธฐ(Interval), Timeout ๋ฐ Threadhold ๊ฐ์ ์ค์ ํ ์ ์์ผ๋ฉฐ,
-
์ฌ์ฉ์๊ฐ ๊ฐ์ ์ค์ ํ์ง ์๊ฑฐ๋,
default๊ฐ์ ๋ช ์ํ ๊ฒฝ์ฐ, default ๊ฐ์ด ์ค์ ๋๋ค.โป cf) Health Check Interval, Timeout, Threshold default ๊ฐ ๋ฐ ์ค์ ์กฐ๊ฑด ๋ฑ
-
[Interval]
CSP TCP defaultHTTP default์ค์ ์กฐ๊ฑด, ๋ฒ์ ๋ฐ ํน์ด์ฌํญ AWS 10 10 * ๋ฒ์: 10, 30๋ง ๊ฐ๋ฅ Azure 10 10 * ๋ฒ์: 5 ์ด์ * ์กฐ๊ฑด: Interval * Threshold < 2147483647 GCP 10 10 * ๋ฒ์: 1~300 * ์กฐ๊ฑด: Timeout <= Interval Alibaba 10 10 * ๋ฒ์: 1~50 Tencent 10 10 * ๋ฒ์: 2~300 * ์กฐ๊ฑด: Timeout <= Interval IBM 10 10 * ๋ฒ์: 2~60 * ์กฐ๊ฑด: Timeout < Interval OpenStack 10 10 * ๋ฒ์: 2147483647(int ์ต๋๊ฐ) * ์กฐ๊ฑด: Timeout <= Interval NCP 10 10 * ๋ฒ์: 5~300 NHN 10 10 * ๋ฒ์: 1~5000 * ์กฐ๊ฑด: Timeout < Interval -
[Timeout]
CSP TCP defaultHTTP default์ค์ ์กฐ๊ฑด, ๋ฒ์ ๋ฐ ํน์ด์ฌํญ AWS 10 6 * ์ค์ ๋ถ๊ฐ * TCP: 10s, HTTP: 6s ๊ณ ์ Azure 10 10 * ์ค์ ๋ถ๊ฐ * Interval๊ณผ Azure default Timeout( 30) ์ค ์์ ๊ฐGCP 10 6 * ๋ฒ์: 1 ์ด์ * ์กฐ๊ฑด: Timeout <= Interval Alibaba 10 6 * ๋ฒ์: 1~300 Tencent 10 6 * ๋ฒ์: 2~60 * ์กฐ๊ฑด: Timeout <= Interval IBM 9 6 * ์์ธ * ์กฐ๊ฑด: Timeout < Interval OpenStack 10 6 * ๋ฒ์: 2147483647(int ์ต๋๊ฐ) * ์กฐ๊ฑด: Timeout <= Interval NCP 10 6 * ๋ฒ์: 1~3600 NHN 10 6 * ๋ฒ์: 1~5000 * ์กฐ๊ฑด: Timeout < Interval -
[Threshold]
CSP TCP defaultHTTP default์ค์ ์กฐ๊ฑด, ๋ฒ์ ๋ฐ ํน์ด์ฌํญ AWS 3 3 * ๋ฒ์: 2~10 Azure 3 3 * ๋ฒ์: 1 ์ด์ * ์กฐ๊ฑด: Interval * Threshold < 2147483647 GCP 3 3 * ๋ฒ์: 1~10 Alibaba 3 3 * ๋ฒ์: 2~10 Tencent 3 3 * ๋ฒ์: 2~10 IBM 3 3 * ๋ฒ์: 1~10 OpenStack 3 3 * ๋ฒ์: 1~10 NCP 3 3 * ๋ฒ์: 2~10 NHN 3 3 * ๋ฒ์: 1~10
-
โป ์๋น์ค ๊ทธ๋ฃน ์คํ ์ค์ผ์ผ๋ง(Service Group Auto-Scaling)
- ์คํ ์ค์ผ์ผ๋ง ์ ์ ๋ฐ ์ง์ ์ฌ๋ถ ๋ฑ ์ถํ ๊ณ ๋ ค
-
3. CB-Spider NLB ๋์ ํ๋ฆ
- NLB ์ฃผ์ ๋์ ํ๋ฆ์ ๋ค์๊ณผ ๊ฐ๋ค.
- โ Client -> Frontend ์๋น์ค ์์ฒญ
- Client๋ TCP, HTTP ๋๋ UDP ํ๋กํ ์ฝ ๊ธฐ๋ฐ์ผ๋ก Frontend ๋ฆฌ์ค๋ IP ๋ฐ ๋ฆฌ์ค๋ ํฌํธ๋ฅผ ํตํด์ ์๋น์ค๋ฅผ ์์ฒญํ๋ค.
- Client์ HTTP ํ๋กํ ์ฝ ํธ์ถ์ ๊ฒฝ์ฐ VMGroup ์์ ํ๋กํ ์ฝ์ด TCP์ ๊ฒฝ์ฐ ๊ฐ๋ฅํ๋ค.
- โก Frontend -> Backend ์๋น์ค ๋ผ์ฐํ
- ๋ฆฌ์ค๋์ ์ํด ์์ ๋ ์ฌ์ฉ์ ์์ฒญ์ TCP ๋๋ UDP ๊ธฐ๋ฐ์ผ๋ก VM ๊ทธ๋ฃน ํฌํธ๋ก ๋ผ์ฐํ ๋๋ค.
- โข ๋ผ์ฐํ
๋์ VM ์ ์ ๋ฐ ๋ผ์ฐํ
(๋์ CSP์์ ์ํ)
- VM ๊ทธ๋ฃน์ ํฌํจ๋ VM๋ค ์ค Healthy ์ํ์ VM์๊ฒ Client ์์ฒญ ๋ฐ ์ ๋ ฅ ์คํธ๋ฆผ์ ๋ผ์ฐํ ํ๋ค.
- VM ๊ทธ๋ฃน์ ํฌํจ๋ ๋ชจ๋ VM๋ค์ด Unhealthy ์ํ์ธ ๊ฒฝ์ฐ CSP๋ณ๋ก ๋ค์๊ณผ ๊ฐ์ด ๋์ ํ๋ค.
- VM ๊ทธ๋ฃน์ ํฌํจ๋ ๋ชจ๋ VM์ ๋ผ์ฐํ ํ๋ CSP: AWS, GCP, Tencent
- Client ์คํธ๋ฆผ์ ๋ผ์ฐํ ํ์ง ์๋ CSP: Azure, IBM
- โป Health Checking
- ํฌ์ค ์ฒดํฌ๊ธฐ๋ ์ฃผ๊ธฐ์ ์ผ๋ก VM ๊ทธ๋ฃน์ ํฌํจ๋ VM์ Health ์ํ๋ฅผ ํ์ ํ๊ณ ์ ๊ณตํ๋ค.
- โ Client -> Frontend ์๋น์ค ์์ฒญ
4. CB-Spider NLB API ๋ฐ ์ ๊ณต ์ ๋ณด ๊ท๊ฒฉ
- ์ฌ์ฉ์๋ ๋ค์๊ณผ ๊ฐ์ CB-Spider REST API๋ฅผ ์ด์ฉํ์ฌ NLB ์ ๋ณด๋ฅผ JSON ๊ท๊ฒฉ์ผ๋ก ์ ๊ณต๋ฐ๋๋ค.
4.1 NLB ๊ด๋ฆฌ API
# NLB ์์ฑ ๋ฐ ์กฐํ
POST /spider/nlb - Create NLB
GET /spider/nlb - List NLBs
GET /spider/nlb/{Name} - Get NLB
DELETE /spider/nlb/{Name} - Delete NLB
# NLB ๋ฑ๋ก/ํด์ (๊ธฐ์กด CSP NLB ์ฐ๋)
POST /spider/regnlb - Register NLB
DELETE /spider/regnlb/{Name} - Unregister NLB
POST /spider/getnlbowner - Get NLB Owner VPC
# NLB VM ๊ด๋ฆฌ
POST /spider/nlb/{Name}/vms - Add VMs to NLB
DELETE /spider/nlb/{Name}/vms - Remove VMs from NLB
# NLB ํฌ์ค ์ ๋ณด
GET /spider/nlb/{Name}/health - Get VM Group Health Info
# NLB ๋ชฉ๋ก ์กฐํ (์ ์ฒด)
GET /spider/allnlb - List All NLBs (CB-Spider + CSP)
GET /spider/allnlbinfo - List All NLB Info
# NLB ํต๊ณ
GET /spider/countnlb - Count All NLBs
GET /spider/countnlb/{ConnectionName} - Count NLBs by Connection
# CSP NLB ์ง์ ์ญ์
DELETE /spider/cspnlb/{Id} - Delete CSP NLB
4.2 ์ ๊ณต ์ ๋ณด ๊ท๊ฒฉ
- NLB ์ ๋ณด (NLBInfo)
| ํ๋ | ์ค๋ช | ์์ |
|---|---|---|
| IId | NLB์ ์๋ณ์ ์ ๋ณด (NameId, SystemId) | โ {Name: "nlb-01", SystemId: "nlb-1234abcd"} |
| VpcIID | NLB๊ฐ ์ํ VPC ์๋ณ์ | โ {Name: "vpc-01", SystemId: "vpc-5678efgh"} |
| Type | NLB ํ์ | โ "PUBLIC" ๋๋ "INTERNAL" |
| Scope | NLB ๋ฒ์ | โ "REGION" ๋๋ "GLOBAL" |
| Listener | ๋ฆฌ์ค๋ ์ ๋ณด | โ ์๋ Listener ์ ๋ณด ์ฐธ์กฐ |
| VMGroup | VM ๊ทธ๋ฃน ์ ๋ณด | โ ์๋ VMGroup ์ ๋ณด ์ฐธ์กฐ |
| HealthChecker | ํฌ์ค ์ฒดํฌ๊ธฐ ์ ๋ณด | โ ์๋ HealthChecker ์ ๋ณด ์ฐธ์กฐ |
| TagList | NLB์ ํ ๋น๋ ํ๊ทธ ๋ฆฌ์คํธ | โ [{Key: "Environment", Value: "Production"}] |
| KeyValueList | CSP๊ฐ ์ ๊ณตํ๋ ์ถ๊ฐ NLB ์ ๋ณด | โ [{Key: "State", Value: "active"}] |
- Listener ์ ๋ณด (ListenerInfo)
| ํ๋ | ์ค๋ช | ์์ |
|---|---|---|
| Protocol | ์์ ํ๋กํ ์ฝ | โ "TCP" ๋๋ "UDP" |
| Port | ์์ ํฌํธ | โ "80", "443", "22" (1-65535) |
| IP | ๋ฆฌ์ค๋ IP (CSP์์ ์๋ ํ ๋น) | โ "52.12.34.56" |
| DNSName | ๋ฆฌ์ค๋ DNS ์ด๋ฆ (์ ํ์ ) | โ "nlb-12345.elb.amazonaws.com" |
| KeyValueList | CSP๊ฐ ์ ๊ณตํ๋ ์ถ๊ฐ ๋ฆฌ์ค๋ ์ ๋ณด | โ [{Key: "Scheme", Value: "internet-facing"}] |
- VMGroup ์ ๋ณด (VMGroupInfo)
| ํ๋ | ์ค๋ช | ์์ |
|---|---|---|
| Protocol | VM ๊ทธ๋ฃน ์์ ํ๋กํ ์ฝ | โ "TCP" ๋๋ "UDP" |
| Port | VM ๊ทธ๋ฃน ์์ ํฌํธ | โ "80", "8080" (1-65535) |
| VMs | VM ์๋ณ์ ๋ฆฌ์คํธ | โ [{Name: "vm-01", SystemId: "i-1234"}, {Name: "vm-02", SystemId: "i-5678"}] |
| CspID | CSP์์ ํ ๋นํ VM ๊ทธ๋ฃน ID | โ "tg-1234567890abcdef0" |
| KeyValueList | CSP๊ฐ ์ ๊ณตํ๋ ์ถ๊ฐ VM ๊ทธ๋ฃน ์ ๋ณด | โ [{Key: "TargetType", Value: "instance"}] |
- HealthChecker ์ ๋ณด (HealthCheckerInfo)
| ํ๋ | ์ค๋ช | ์์ |
|---|---|---|
| Protocol | ํฌ์ค ์ฒดํฌ ํ๋กํ ์ฝ | โ "TCP" ๋๋ "HTTP" |
| Port | ํฌ์ค ์ฒดํฌ ํฌํธ | โ "80", "8080" (1-65535 ๋๋ Listener Port) |
| Interval | ํฌ์ค ์ฒดํฌ ์ฃผ๊ธฐ (์ด) | โ 10, 30 ๋ฑ (๊ธฐ๋ณธ๊ฐ: -1 ๋๋ "default") |
| Timeout | ํฌ์ค ์ฒดํฌ ํ์์์ (์ด) | โ 5, 10 ๋ฑ (๊ธฐ๋ณธ๊ฐ: -1 ๋๋ "default") |
| Threshold | ํฌ์ค ์ฒดํฌ ์๊ณ๊ฐ | โ 3, 5 ๋ฑ (๊ธฐ๋ณธ๊ฐ: -1 ๋๋ "default") |
| CspID | CSP์์ ํ ๋นํ ํฌ์ค ์ฒดํฌ๊ธฐ ID | โ "health-check-1234" |
| KeyValueList | CSP๊ฐ ์ ๊ณตํ๋ ์ถ๊ฐ ํฌ์ค ์ฒดํฌ๊ธฐ ์ ๋ณด | โ [{Key: "HealthCheckPath", Value: "/health"}] |
- HealthInfo ์ ๋ณด
| ํ๋ | ์ค๋ช | ์์ |
|---|---|---|
| AllVMs | VM ๊ทธ๋ฃน์ ํฌํจ๋ ๋ชจ๋ VM | โ [{Name: "vm-01", SystemId: "i-1234"}, ...] |
| HealthyVMs | ํฌ์ค ์ฒดํฌ ๊ฒฐ๊ณผ ์ ์์ธ VM ๋ชฉ๋ก | โ [{Name: "vm-01", SystemId: "i-1234"}] |
| UnHealthyVMs | ํฌ์ค ์ฒดํฌ ๊ฒฐ๊ณผ ๋น์ ์์ธ VM ๋ชฉ๋ก | โ [{Name: "vm-02", SystemId: "i-5678"}] |
5. CB-Spider NLB API ๋ฐ ์ ๊ณต ์ ๋ณด ์์
5.1 NLB ์์ฑ ์์ - VMGroup ์ค์ ์ ์ธ
- VMGroup ์ค์ ์ ์ ์ธํ๊ณ NLB๋ฅผ ์์ฑํ๋ API ํธ์ถ ์์:
curl -sX POST http://localhost:1024/spider/nlb \
-H 'Content-Type: application/json' \
-d '{
"ConnectionName": "aws-config01",
"ReqInfo": {
"Name": "nlb-01",
"VPCName": "vpc-01",
"Type": "PUBLIC",
"Scope": "REGION",
"Listener": {
"Protocol": "TCP",
"Port": "80"
},
"HealthChecker": {
"Protocol": "TCP",
"Port": "80"
}
}
}' | jq
์๋ต ์์:
{
"IId": {
"NameId": "nlb-01",
"SystemId": "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/nlb-01/1234567890abcdef"
},
"VpcIID": {
"NameId": "vpc-01",
"SystemId": "vpc-0a1b2c3d4e5f67890"
},
"Type": "PUBLIC",
"Scope": "REGION",
"Listener": {
"Protocol": "TCP",
"Port": "80",
"DNSName": "nlb-01-1234567890.us-east-1.elb.amazonaws.com",
"IP": "",
"KeyValueList": [
{
"Key": "Scheme",
"Value": "internet-facing"
}
]
},
"VMGroup": {
"Protocol": "TCP",
"Port": "80",
"VMs": [],
"CspID": "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/nlb-01-tg/1234567890abcdef",
"KeyValueList": [
{
"Key": "TargetType",
"Value": "instance"
}
]
},
"HealthChecker": {
"Protocol": "TCP",
"Port": "80",
"Interval": 10,
"Timeout": 10,
"Threshold": 3,
"CspID": "",
"KeyValueList": []
},
"KeyValueList": [
{
"Key": "State",
"Value": "provisioning"
},
{
"Key": "Type",
"Value": "network"
}
]
}
5.2 NLB ์์ฑ ์์ - VMGroup ํฌํจ
- VMGroup(vm-01, vm-02)์ ํฌํจํ์ฌ NLB๋ฅผ ์์ฑํ๋ API ํธ์ถ ์์:
curl -sX POST http://localhost:1024/spider/nlb \
-H 'Content-Type: application/json' \
-d '{
"ConnectionName": "aws-config01",
"ReqInfo": {
"Name": "nlb-02",
"VPCName": "vpc-01",
"Type": "PUBLIC",
"Scope": "REGION",
"Listener": {
"Protocol": "TCP",
"Port": "22"
},
"VMGroup": {
"Protocol": "TCP",
"Port": "22",
"VMs": ["vm-01", "vm-02"]
},
"HealthChecker": {
"Protocol": "TCP",
"Port": "22",
"Interval": "default",
"Timeout": "default",
"Threshold": "5"
}
}
}' | jq
์๋ต ์์:
{
"IId": {
"NameId": "nlb-02",
"SystemId": "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/nlb-02/abcdef1234567890"
},
"VpcIID": {
"NameId": "vpc-01",
"SystemId": "vpc-0a1b2c3d4e5f67890"
},
"Type": "PUBLIC",
"Scope": "REGION",
"Listener": {
"Protocol": "TCP",
"Port": "22",
"DNSName": "nlb-02-abcdef1234.us-east-1.elb.amazonaws.com",
"IP": "",
"KeyValueList": []
},
"VMGroup": {
"Protocol": "TCP",
"Port": "22",
"VMs": [
{
"NameId": "vm-01",
"SystemId": "i-0a1b2c3d4e5f67890"
},
{
"NameId": "vm-02",
"SystemId": "i-1b2c3d4e5f678901"
}
],
"CspID": "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/nlb-02-tg/abcdef1234567890",
"KeyValueList": []
},
"HealthChecker": {
"Protocol": "TCP",
"Port": "22",
"Interval": 10,
"Timeout": 10,
"Threshold": 5,
"CspID": "",
"KeyValueList": []
},
"KeyValueList": [
{
"Key": "State",
"Value": "active"
}
]
}
5.3 NLB ์กฐํ ์์
- ์์ฑ๋ NLB ์ ๋ณด๋ฅผ ์กฐํํ๋ API ํธ์ถ ์์:
curl -sX GET 'http://localhost:1024/spider/nlb/nlb-01?ConnectionName=aws-config01' | jq
5.4 NLB ๋ชฉ๋ก ์กฐํ ์์
- Connection์ ์์ฑ๋ ๋ชจ๋ NLB ๋ชฉ๋ก์ ์กฐํํ๋ API ํธ์ถ ์์:
curl -sX GET 'http://localhost:1024/spider/nlb?ConnectionName=aws-config01' | jq
์๋ต ์์:
{
"nlb": [
{
"IId": {
"NameId": "nlb-01",
"SystemId": "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/nlb-01/1234567890abcdef"
},
"VpcIID": {
"NameId": "vpc-01",
"SystemId": "vpc-0a1b2c3d4e5f67890"
},
"Type": "PUBLIC",
"Scope": "REGION",
...
},
{
"IId": {
"NameId": "nlb-02",
"SystemId": "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/nlb-02/abcdef1234567890"
},
"VpcIID": {
"NameId": "vpc-01",
"SystemId": "vpc-0a1b2c3d4e5f67890"
},
"Type": "PUBLIC",
"Scope": "REGION",
...
}
]
}
5.5 VM ์ถ๊ฐ ์์
- NLB์ VM Group์ VM์ ์ถ๊ฐํ๋ API ํธ์ถ ์์:
curl -sX POST http://localhost:1024/spider/nlb/nlb-01/vms \
-H 'Content-Type: application/json' \
-d '{
"ConnectionName": "aws-config01",
"ReqInfo": {
"VMs": ["vm-03", "vm-04"]
}
}' | jq
์๋ต ์์:
{
"IId": {
"NameId": "nlb-01",
"SystemId": "arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/net/nlb-01/1234567890abcdef"
},
"VMGroup": {
"Protocol": "TCP",
"Port": "80",
"VMs": [
{
"NameId": "vm-03",
"SystemId": "i-2c3d4e5f67890123"
},
{
"NameId": "vm-04",
"SystemId": "i-3d4e5f6789012345"
}
],
...
},
...
}
5.6 VM ์ ๊ฑฐ ์์
- NLB์ VM Group์์ VM์ ์ ๊ฑฐํ๋ API ํธ์ถ ์์:
curl -sX DELETE http://localhost:1024/spider/nlb/nlb-01/vms \
-H 'Content-Type: application/json' \
-d '{
"ConnectionName": "aws-config01",
"ReqInfo": {
"VMs": ["vm-04"]
}
}' | jq
์๋ต ์์:
{
"Result": "true"
}
5.7 VM Group ์ํ ์ ๋ณด ํ์ธ ์์
- VM Group์ ํฌ์ค ์ํ ์ ๋ณด๋ฅผ ์กฐํํ๋ API ํธ์ถ ์์:
curl -sX GET 'http://localhost:1024/spider/nlb/nlb-01/health?ConnectionName=aws-config01' | jq
์๋ต ์์:
{
"healthinfo": {
"AllVMs": [
{
"NameId": "vm-01",
"SystemId": "i-0a1b2c3d4e5f67890"
},
{
"NameId": "vm-02",
"SystemId": "i-1b2c3d4e5f678901"
},
{
"NameId": "vm-03",
"SystemId": "i-2c3d4e5f67890123"
}
],
"HealthyVMs": [
{
"NameId": "vm-01",
"SystemId": "i-0a1b2c3d4e5f67890"
},
{
"NameId": "vm-02",
"SystemId": "i-1b2c3d4e5f678901"
}
],
"UnHealthyVMs": [
{
"NameId": "vm-03",
"SystemId": "i-2c3d4e5f67890123"
}
]
}
}
5.8 NLB ์ญ์ ์์
- NLB๋ฅผ ์ญ์ ํ๋ API ํธ์ถ ์์:
curl -sX DELETE 'http://localhost:1024/spider/nlb/nlb-01' \
-H 'Content-Type: application/json' \
-d '{
"ConnectionName": "aws-config01"
}' | jq
์๋ต ์์:
{
"Result": "true"
}
5.9 ๊ฐ์ ์ญ์ ์์
- NLB๋ฅผ ๊ฐ์ ๋ก ์ญ์ ํ๋ API ํธ์ถ ์์ (VM์ด ์ฐ๊ฒฐ๋์ด ์์ด๋ ์ญ์ ):
curl -sX DELETE 'http://localhost:1024/spider/nlb/nlb-01?force=true' \
-H 'Content-Type: application/json' \
-d '{
"ConnectionName": "aws-config01"
}' | jq
6. CB-Spider NLB AdminWeb ํ์ฉ ์์
-
AdminWeb์ ํตํ NLB ๊ด๋ฆฌ ์ ์ฐจ๋ ๋ค์๊ณผ ๊ฐ๋ค:
- Connection ์ ํ: AdminWeb ์๋จ์์ ๋์ CSP Connection ์ ํ
- NLB ๋ฉ๋ด ์ ๊ทผ: ์ข์ธก ๋ฉ๋ด์์ "NLB" ์ ํ
- NLB ์์ฑ: "Create NLB" ๋ฒํผ ํด๋ฆญ ํ ํ์ํ ์ ๋ณด ์ ๋ ฅ
- NLB ๊ด๋ฆฌ: NLB ์ํ ํ์ธ, VM ์ถ๊ฐ/์ ๊ฑฐ, ํฌ์ค ํ์ธ, ์ญ์ ๋ฑ
6.1 NLB ๋ชฉ๋ก ํ๋ฉด ์์
AdminWeb์์ NLB ๋ชฉ๋ก์ ์กฐํํ ๋ ๋ค์ ์ ๋ณด๊ฐ ํ์๋๋ค:
- NLB ์ด๋ฆ
- VPC ์ด๋ฆ
- ํ์ (PUBLIC/INTERNAL)
- ๋ฒ์ (REGION/GLOBAL)
- Listener ์ ๋ณด (Protocol, Port, DNS Name)
- VM Group ์ ๋ณด (VM ๊ฐ์)
- ์์ ๋ฒํผ (์์ธ๋ณด๊ธฐ, VM ๊ด๋ฆฌ, ํฌ์ค ํ์ธ, ์ญ์ ๋ฑ)
6.2 NLB ์์ฑ ํ๋ฉด ์์
AdminWeb์์ NLB๋ฅผ ์์ฑํ ๋ ๋ค์ ์ ๋ณด๋ฅผ ์ ๋ ฅํ๋ค:
- NLB Name: CB-Spider์์ ๊ด๋ฆฌํ NLB ์ด๋ฆ
- VPC Name: NLB๊ฐ ์ํ VPC ์ ํ
- Type: PUBLIC ๋๋ INTERNAL ์ ํ
- Scope: REGION ๋๋ GLOBAL ์ ํ
- Listener:
- Protocol: TCP ๋๋ UDP ์ ํ
- Port: 1-65535 ๋ฒ์์ ํฌํธ ๋ฒํธ
- VMGroup (์ ํ์ ):
- Protocol: TCP ๋๋ UDP ์ ํ
- Port: 1-65535 ๋ฒ์์ ํฌํธ ๋ฒํธ
- VMs: ์ถ๊ฐํ VM ์ ํ (๋ค์ค ์ ํ ๊ฐ๋ฅ)
- HealthChecker:
- Protocol: TCP ๋๋ HTTP ์ ํ
- Port: 1-65535 ๋ฒ์์ ํฌํธ ๋ฒํธ
- Interval: ํฌ์ค ์ฒดํฌ ์ฃผ๊ธฐ (์ด) ๋๋ "default"
- Timeout: ํฌ์ค ์ฒดํฌ ํ์์์ (์ด) ๋๋ "default"
- Threshold: ํฌ์ค ์ฒดํฌ ์๊ณ๊ฐ ๋๋ "default"
- Tags (์ ํ์ ): ๋ฆฌ์์ค ํ๊ทธ ์ ๋ณด
6.3 NLB ์์ธ ์ ๋ณด ํ๋ฉด ์์
NLB ์์ธ ์ ๋ณด ํ๋ฉด์์๋ ๋ค์ ์ ๋ณด๊ฐ ํ์๋๋ค:
๊ธฐ๋ณธ ์ ๋ณด:
- NLB IId (NameId, SystemId)
- VPC ์ ๋ณด
- Type, Scope
Listener ์ ๋ณด:
- Protocol, Port
- DNS Name ๋๋ IP
VMGroup ์ ๋ณด:
- Protocol, Port
- ๋ฑ๋ก๋ VM ๋ชฉ๋ก
- VM ์ถ๊ฐ/์ ๊ฑฐ ๋ฒํผ
HealthChecker ์ ๋ณด:
- Protocol, Port
- Interval, Timeout, Threshold
Health ์ํ:
- All VMs
- Healthy VMs
- Unhealthy VMs
์์ ๋ฒํผ:
- VM ์ถ๊ฐ/์ ๊ฑฐ
- ํฌ์ค ์ ๋ณด ๊ฐฑ์
- NLB ์ญ์
7. ์ฃผ์์ฌํญ ๋ฐ ์ ์ฝ์ฌํญ
7.1 NLB ์์ฑ ์ ์ฃผ์์ฌํญ
- ์ฌ์ ์ค๋น ๋ฆฌ์์ค: VPC๊ฐ ๋ฏธ๋ฆฌ ์์ฑ๋์ด ์์ด์ผ ํจ
- VM ์ค๋น: VM Group์ ์ถ๊ฐํ VM์ NLB์ ๋์ผํ VPC์ ์ํด์ผ ํจ
- ์๋น์ค ๋ฐ๋ชฌ: ๊ฐ VM์์ VMGroup Port ๋ฐ HealthChecker Port๋ก ์๋น์ค๊ฐ ์คํ ์ค์ด์ด์ผ ํจ
- ๋ณด์ ๊ทธ๋ฃน: VM์ ๋ณด์ ๊ทธ๋ฃน์์ VMGroup Port ๋ฐ HealthChecker Port ํ์ฉ ํ์
- KT ์์ธ: KT NLB๋ Subnet ๊ธฐ๋ฐ์ผ๋ก ์์ฑ๋๋ฉฐ, VM๊ณผ ํจ๊ป ์์ฑํด์ผ ํจ
7.2 NLB ์ญ์ ์ ์ฃผ์์ฌํญ
- ๊ฐ์ ์ญ์ : force=true ์ต์ ์ฌ์ฉ ์ ์ฐ๊ฒฐ๋ ๋ฆฌ์์ค ๊ฒ์ฆ ์์ด ๊ฐ์ ์ญ์ ๋จ (์ฃผ์!)
7.3 Health Check ์ฃผ์์ฌํญ
- ์ด๊ธฐ ํฌ์ค ์ฒดํฌ: VM ์ถ๊ฐ ํ ์ต์ด ํฌ์ค ์ํ ํ์ธ๊น์ง ์์ด~์๋ถ ์์
- ์๋น์ค ์ค๋น: VM์์ ํฌ์ค ์ฒดํฌ ํฌํธ๋ก ์๋ตํ ์ ์๋ ์๋น์ค๊ฐ ์คํ ์ค์ด์ด์ผ ํจ
- ํ๋กํ ์ฝ ํธํ: HTTP ํฌ์ค ์ฒดํฌ ์ VM์์ HTTP ์๋ต์ ์ ๊ณตํด์ผ ํจ
7.4 CSP๋ณ ํน์ด์ฌํญ
- AWS: Interval์ 10, 30๋ง ์ ํ ๊ฐ๋ฅ
- Azure: Timeout ์ค์ ๋ถ๊ฐ (Interval๊ณผ ๊ธฐ๋ณธ๊ฐ ์ค ์์ ๊ฐ ์๋ ์ค์ )
- IBM: Timeout์ Interval๋ณด๋ค ์์์ผ ํจ
- KT: Subnet ๊ธฐ๋ฐ NLB, VM๊ณผ ํจ๊ป ์์ฑ ํ์