λ컀 μ€μμ λ³λλ‘ μ€μΉν νμ μμ΄, λ컀 μλ² μ체λ§λλ‘ λ컀 μ€μ ν΄λ¬μ€ν°λ₯Ό μμ½κ² ꡬμ±ν μ μμ΅λλ€ ;)
λ컀 μ€μλͺ¨λλ₯Ό μ 곡νλμ§ νμΈνκΈ° μν΄μλ Docker Versionμ νμΈνμ¬ 1.12λ²μ μ΄μμΈμ§ νμΈν©λλ€.
μ΄λ² μ€μ΅μμλ Docker Swarm ν΄λ¬μ€ν°λ₯Ό ꡬμ±νκ³ μ¬μ©νλ μ€μ΅μ μ§νν©λλ€. π
λ컀 μ€μμ, λ컀 컨ν μ΄λμ μ€μΌμ€νΈλ μ΄μ ν΄μ΄λΌκ³ λ³Ό μ μμ΅λλ€.
λ컀 μ€μμ λ§μ€ν° λ
Έλμ μ컀λ
Έλ μ΄λ κ² 2κ°μ μν μ΄ μμΌλ©°, 맀λμ μν μ λ
Έλλ λ°λμ 1κ° μ΄μ, μ컀λ
Έλλ μμ μ μμ΅λλ€.
맀λμ μν μ νλ λ
Έλλ μ컀λ
Έλμ μν λ μννκΈ°λλ¬Έμ
λλ€.
μ κ·Έλ¦Όμ 3κ°μ Manager λ Έλμ, 7λμ Worker λ Έλλ‘ κ΅¬μ±λμ΄μμ§λ§, μ΄λ² μ€μ΅μμλ 1κ°μ Manager λ Έλ, 2κ°μ Worker λ Έλλ‘ κ΅¬μ±νμ¬ μ€μ΅μ μ§ννκ² μ΅λλ€.
μ€ μ¬μ©νκ²½μμλ λ°λμ 3κ°μ΄μμ Manager λ Έλλ₯Ό μ€μ ν΄μ£ΌμΈμ :)
μ€μ΅μ μλμ μμλ‘ μ§νλ©λλ€.
- Docker Swarm - Mamager λ Έλ μ€μ
- Docker Swarm - Worker #1, #2 λ Έλ μΆκ°
- Docker Swarm - μλΉμ€ μμν΄λ³΄κΈ°
Docker Swarm μ€μ΅ ꡬμ±
μ΄ κ·Έλ¦Όκ³Ό κ°μ΄ μ΄ 3κ°μ μλ² μμμ μ¬μ©νμ¬, 1κ°λ Manager, 2κ°λ Workerλ‘ κ΅¬μ±ν΄λ³΄λλ‘ νκ² μ΅λλ€.
μ΄ μ€μ΅μ μ¬μ 쑰건μ λ°λμ 1.12μ΄μμ λ컀 λ°λͺ¬μ΄ μ€μΉλμ΄μλκ²μ
λλ€.
λ컀 μ€μΉκ° λμ΄μμ§ μλ€λ©΄ μ¬κΈ°λ₯Ό ν΄λ¦νμ¬ μ€μΉλΆν° ν©λλ€ :)
Docker Swarm - Mamager λ Έλ μ€μ
λ¨Όμ , Manager λ Έλμμ Swarm initμ μ€νν©λλ€.
[root@swarm-manager /]# docker swarm init
Swarm initialized: current node (nimv87d2pupej2uxxzthkugvx) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-23oim81yk3k1pd0ykpz4ezdnh22warxvrjaddtzjvdoqohu5zo-0nd5a0gpav8zp2rkbn45q00oq 172.31.13.191:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
μ! μ΄μ ꡬμ±μ΄ μλ£λμμ΅λλ€!!! μ΄λ κ² κ°λ¨νκ² κ΅¬μ±μ΄ λλ¬μ΅λλ€!!! π₯³π₯³
λ§μ½ Manager λ
ΈνΈμ λ€νΈμν¬ μΈν°νμ΄μ€κ° μ¬λ¬κ° μ‘΄μ¬νλ€λ©΄,
μ΄λ€ IPλ₯Ό μΈκ²μΈμ§ μ ν νμ "docker swarm init --advertise-addr <Manager Node IP>" λͺ
λ Ήμ΄λ₯Ό μ¬μ©νλ©΄ λ©λλ€.
Docker Swarm - Worker #1, #2 λ Έλ μΆκ°
Manager λ Έλλ₯Ό μΆκ°ν λ μΆλ ₯λλ λ΄μ©μ€μ "docker swarm join~~" λΆλΆμ 볡μ¬νμ¬ Worker Nodeμ λΆμ¬λ£κΈ° ν©λλ€!
λ¨Όμ , Worker #1 λ Έλμμ μ§νν©λλ€.
[root@swarm-worker1 /]# docker swarm join --token SWMTKN-1-23oim81yk3k1pd0ykpz4ezdnh22warxvrjaddtzjvdoqohu5zo-0nd5a0gpav8zp2rkbn45q00oq 172.31.13.191:2377
This node joined a swarm as a worker.
μ΄μ , λλ²μ§Έλ‘ Worker #2 λ Έλμμ μ§νν©λλ€.
[root@swarm-worker2 /]# docker swarm join --token SWMTKN-1-23oim81yk3k1pd0ykpz4ezdnh22warxvrjaddtzjvdoqohu5zo-0nd5a0gpav8zp2rkbn45q00oq 172.31.13.191:2377
This node joined a swarm as a worker.
μ΄λ κ² λκ°μ λ
Έλκ° μΆκ°λμμ΅λλ€. 3κ°μ λ
Έλ λͺ¨λ μ μ΄μμ€μΈμ§ νμΈν΄λ³΄κ² μ΅λλ€.
[root@swarm-manager /]# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
nimv87d2pupej2uxxzthkugvx * swarm-manager Ready Active Leader 19.03.13
c60u9g03hg4z1co9a6pitimmo swarm-worker1 Ready Active 19.03.13
r7vk73m3yi3nm0p3k11xfmf5e swarm-worker2 Ready Active 19.03.13
λͺ¨λ Active μνλ‘ μ μ΄μμ€μ΄λ€μ.
μ¬κΈ°μμ λ³ν(*)κ° λΆμ λ
Έλκ° νμ¬ λ
Έλμ
λλ€.
μΆκ°μ μΌλ‘ :)
μλ‘μ΄ λ§€λμ λ
Έλλ₯Ό μΆκ°νκ±°λ, μλ‘μ΄ μ컀 λ
Έλλ₯Ό μΆκ°ν λλ μλμ κ°μ λͺ
λ Ήμ΄λ₯Ό μ¬μ©ν μ μμ΅λλ€.
<!-- Manager Node μΆκ° -->
[root@swarm-manager /]# docker swarm join-token manager
To add a manager to this swarm, run the following command:
docker swarm join --token SWMTKN-1-23oim81yk3k1pd0ykpz4ezdnh22warxvrjaddtzjvdoqohu5zo-bw42g26eho9dohi1nl2og0ur5 172.31.13.191:2377
<!-- Worker Node μΆκ° -->
[root@swarm-manager /]# docker swarm join-token worker
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-23oim81yk3k1pd0ykpz4ezdnh22warxvrjaddtzjvdoqohu5zo-0nd5a0gpav8zp2rkbn45q00oq 172.31.13.191:2377
Docker Swarm - μλΉμ€ μμν΄λ³΄κΈ°
μ΄λ² λ¨κ³μμλ λ컀 μ€μμμ λ§λ³΄κΈ°λ‘ μλΉμ€λ₯Ό μμν΄λ³΄κ² μ΅λλ€ :)
Docker Service λͺ λ Ήμ΄λ₯Ό μ΄μ©ν΄μ μλΉμ€λ₯Ό μμ±νκ² μ΅λλ€.
[root@swarm-manager /]# docker service create --replicas 5 --name helloworld alpine ping docker.com
q6vjfrr3q7mqbwwb6ea7evfxc
overall progress: 5 out of 5 tasks
1/5: running [==================================================>]
2/5: running [==================================================>]
3/5: running [==================================================>]
4/5: running [==================================================>]
5/5: running [==================================================>]
verify: Service converged
μλΉμ€ μμ±μ΄ μλ£ λμλμ§ νμΈνκ² μ΅λλ€. νμΈ λͺ λ Ήμ΄λ docker service ls (μλΉμ€ λͺ©λ‘ νμΈ), docker service ps <μλ―Έμ€λͺ > (μλΉμ€ λ΄ μ»¨ν μ΄λ μν νμΈ) μ λλ€!
<!-- λ컀 μλΉμ€ λͺ©λ‘ νμΈ -->
[root@swarm-manager /]# docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
q6vjfrr3q7mq helloworld replicated 5/5 alpine:latest
<!-- λ컀 μλΉμ€μ 컨ν
μ΄λ μν νμΈ -->
[root@swarm-manager /]# docker service ps helloworld
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
rqxf9vw6mwcj helloworld.1 alpine:latest swarm-worker1 Running Running about a minute ago
ds9rj06j94f3 helloworld.2 alpine:latest swarm-worker2 Running Running about a minute ago
jrvq3yuq4wxk helloworld.3 alpine:latest swarm-manager Running Running about a minute ago
nqpnq5ewrdch helloworld.4 alpine:latest swarm-worker1 Running Running about a minute ago
z904et43297e helloworld.5 alpine:latest swarm-manager Running Running about a minute ago
μ! μ¬κΈ°κΉμ§ λ§λ³΄κΈ°μμ΅λλ€!!
λ€μ μ€νμΌλ‘ κ°μλ€ !!