Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------------------------------- Task -1 -------------------------------------------
- [ec2-user@master ~]$ docker node ls
- ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
- pm6boa3ibinv3kmxkg0ac1v0x * master.ap-south-1.compute.internal Ready Active Leader 20.10.23
- 2r4aabr22xsqrouc0fp6266gg worker1.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
- i6amddzp81hfg3gjxa1dbs4e2 worker2.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
- j7p4b6wyarft4ml82f8plt7yl worker3.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker service create \
- > --name web \
- > --replicas 4 \
- > -p 80:80 \
- > fujiclado/rolling-hello:green
- mc04i7wbvwfmi2u073d7zfauq
- overall progress: 4 out of 4 tasks
- 1/4: running [==================================================>]
- 2/4: running [==================================================>]
- 3/4: running [==================================================>]
- 4/4: running [==================================================>]
- verify: Service converged
- -------------- Draining master ------------------
- [ec2-user@master ~]$ docker node update --availability drain master.ap-south-1.compute.internal
- master.ap-south-1.compute.internal
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker service ps web
- ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
- jmmvaalf62yw web.1 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running about a minute ago
- mixkeb7o3zqr web.2 fujiclado/rolling-hello:green worker3.ap-south-1.compute.amazonaws.com Running Running about a minute ago
- m4jvnl1vgfw6 web.3 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 5 seconds ago
- l3tb58sm543c \_ web.3 fujiclado/rolling-hello:green master.ap-south-1.compute.internal Shutdown Shutdown 6 seconds ago
- zmfeqbn1t3ur web.4 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running about a minute ago
- --------------Pausing one worker --------------------
- [ec2-user@master ~]$ docker node update --availability pause worker3.ap-south-1.compute.amazonaws.com
- worker3.ap-south-1.compute.amazonaws.com
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker service ps web
- ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
- jmmvaalf62yw web.1 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running 3 minutes ago
- mixkeb7o3zqr web.2 fujiclado/rolling-hello:green worker3.ap-south-1.compute.amazonaws.com Running Running 3 minutes ago
- m4jvnl1vgfw6 web.3 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 2 minutes ago
- l3tb58sm543c \_ web.3 fujiclado/rolling-hello:green master.ap-south-1.compute.internal Shutdown Shutdown 2 minutes ago
- zmfeqbn1t3ur web.4 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 3 minutes ago
- [ec2-user@master ~]$ docker service update --replicas 6 web
- web
- overall progress: 6 out of 6 tasks
- 1/6: running [==================================================>]
- 2/6: running [==================================================>]
- 3/6: running [==================================================>]
- 4/6: running [==================================================>]
- 5/6: running [==================================================>]
- 6/6: running [==================================================>]
- verify: Service converged
- [ec2-user@master ~]$ docker service ps web
- ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
- jmmvaalf62yw web.1 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running 5 minutes ago
- mixkeb7o3zqr web.2 fujiclado/rolling-hello:green worker3.ap-south-1.compute.amazonaws.com Running Running 5 minutes ago
- m4jvnl1vgfw6 web.3 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 4 minutes ago
- l3tb58sm543c \_ web.3 fujiclado/rolling-hello:green master.ap-south-1.compute.internal Shutdown Shutdown 4 minutes ago
- zmfeqbn1t3ur web.4 fujiclado/rolling-hello:green worker1.ap-south-1.compute.amazonaws.com Running Running 5 minutes ago
- 6wfngvpdif0f web.5 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running 53 seconds ago
- muy48n3dledx web.6 fujiclado/rolling-hello:green worker2.ap-south-1.compute.amazonaws.com Running Running 53 seconds ago
- ----------- Removing service web -----------
- [ec2-user@master ~]$ docker service ls
- ID NAME MODE REPLICAS IMAGE PORTS
- mc04i7wbvwfm web replicated 6/6 fujiclado/rolling-hello:green *:80->80/tcp
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker service rm web
- web
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker service ls
- ID NAME MODE REPLICAS IMAGE PORTS
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker service ps web
- no such service: web
- [ec2-user@master ~]$
- ------------------------------------------------------- Task 2 --------------------------------------------------
- ----------Network Creation----------
- [ec2-user@master ~]$ docker network create ip-geo --driver=overlay
- 1oem7xmo605s5zeyodt8l9hvo
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker network ls
- NETWORK ID NAME DRIVER SCOPE
- 0a310b2284e5 bridge bridge local
- fe1a0db7f8fa docker_gwbridge bridge local
- 47b7ee1d22f6 host host local
- q6xptqrcxmym ingress overlay swarm
- 1oem7xmo605s ip-geo overlay swarm
- 57cc6a515219 none null local
- [ec2-user@master ~]$
- -------- Label ---------
- [ec2-user@master ~]$ docker node ls
- ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
- pm6boa3ibinv3kmxkg0ac1v0x * master.ap-south-1.compute.internal Ready Drain Leader 20.10.23
- 2r4aabr22xsqrouc0fp6266gg worker1.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
- i6amddzp81hfg3gjxa1dbs4e2 worker2.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
- j7p4b6wyarft4ml82f8plt7yl worker3.ap-south-1.compute.amazonaws.com Ready Active 20.10.23
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker node update --label-add service=api-service worker1.ap-south-1.compute.amazonaws.com
- worker1.ap-south-1.compute.amazonaws.com
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker node update --label-add service=api-service worker2.ap-south-1.compute.amazonaws.com
- worker2.ap-south-1.compute.amazonaws.com
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- [ec2-user@master ~]$ docker node update --label-add service=redis worker3.ap-south-1.compute.amazonaws.com
- worker3.ap-south-1.compute.amazonaws.com
- [ec2-user@master ~]$
- [ec2-user@master ~]$
- ---------- Service Creation ------------
- [ec2-user@master ~]$ docker service create \
- > --name redis \
- > --network ip-geo \
- > --constraint node.labels.service==redis \
- > --replicas 1 \
- > redis:latest
- 39ya5gqbn3cnf5gtwvmqervoc
- overall progress: 1 out of 1 tasks
- 1/1: running [==================================================>]
- verify: Service converged
- [ec2-user@master ~]$ docker service create \
- > --name ip-api1 \
- > -p 8080:8080 \
- > --network ip-geo \
- > --constraint node.labels.service==api-service \
- > --replicas 4 \
- > -e REDIS_PORT="6379" \
- > -e REDIS_HOST="redis" \
- > -e APP_PORT="8080" \
- > -e API_KEY="48c444472b0840848c261f62abe32b0d" \
- > fujikomalan/ipgeolocation-api-service:latest
- overall progress: 4 out of 4 tasks
- 1/4: running [==================================================>]
- 2/4: running [==================================================>]
- 3/4: running [==================================================>]
- 4/4: running [==================================================>]
- verify: Service converged
- [ec2-user@master ~]$ docker service create \
- > --name ipip-frontend \
- > -p 9090:8080 \
- > --network ip-geo \
- > --constraint node.labels.service==api-service \
- > --replicas 4 \
- > -e API_SERVER="ip-api1" \
- > -e API_SERVER_PORT="8080" \
- > -e APP_PORT="8080" \
- > fujikomalan/ipgeolocation-frontend:latest
- g2s4vrkhyofeb3iv74p77u39f
- overall progress: 4 out of 4 tasks
- 1/4: running [==================================================>]
- 2/4: running [==================================================>]
- 3/4: running [==================================================>]
- 4/4: running [==================================================>]
- verify: Service converged
- [ec2-user@master ~]$ docker service ls
- ID NAME MODE REPLICAS IMAGE PORTS
- kn3jjpa9wfa3 ip-api1 replicated 4/4 fujikomalan/ipgeolocation-api-service:latest *:8080->8080/tcp
- g2s4vrkhyofe ip-frontend replicated 4/4 fujikomalan/ipgeolocation-frontend:latest *:9090->8080/tcp
- 39ya5gqbn3cn redis replicated 1/1 redis:latest
Advertisement
Add Comment
Please, Sign In to add comment