In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Docker swarm is a docker host management software, and there are K8s and mesos as similar container management software. After docker 10.15, docker does not need to be installed separately.
Https://docs.docker.com/engine/swarm/services/
VirtualBox runs 3 virtual machines
Host list
Swarm01 192.168.0.127
Swarm02 192.168.0.128
Swarm03 192.168.0.129
Install docker
$curl-fsSL get.docker.com-o get-docker.sh
$sudo sh get-docker.sh-mirror Aliyun
# $sudo sh get-docker.sh-- mirror AzureChinaCloud
Sudo systemctl start docker
Sudo systemctl enable docker
Native 3 Nic, broadcast on enp0s3 192.168.0.127 bridge Nic enp0s8
Docker swarm init-- advertise-addr 192.168.0.127
Password for work joining
Docker swarm join-- token SWMTKN-1-0wlbnf7ezi6d39j7m0sv9912ikzf13f10jgk384ttiuj6ovy88-4sjlkdp9ul3fe353b0iq0q56c 192.168.0.127VR 2377
Docker node ls
Three machines that have joined the cluster can be found.
Set up a hello service
Docker search alpine
Docker pull registry.docker-cn.com/library/alpine
Docker service create-replicas 1-name hello busybox
Mao, registry is gone?
Nginx should have it.
Docker service create-name my_web nginx
Docker service ls
Create a task
Docker service create-name helloworld alpine ping www.baidu.com
Docker service ls
Nginx service plus one port
Docker service update-publish-add 80 my_web
Docker service scale my_web=3
It's okay to rollback if you make a mistake.
Docker service update-replicas=5 my_web
Docker service update-rollback my_web
192.168.0.127-1293 servers can access nginx's public network NAT port 3000 on port 30000.
Where did the port of 30000 come from? let me update it.
Docker service update\
-- publish-add published=80,target=80\
My_web
Node port 80 can access birds.
Docker network ls
There are two kinds of network. Bridge is accessed externally, and overlay is the communication network within the container.
Docker network create-d overlay-- attachable swarm_test
Add swarm communication network card
Create a network when creating a service
Docker service create\
-- replicas 3\
-- network swarm_test\
-- name my_web2\
Nginx
Compare the differences between the two services
Docker service inspect my_web
Docker service inspect my_web2
The network is different.
Other docker services commands
Https://docs.docker.com/engine/reference/commandline/service_update/
Docker service create
Create a new service
Docker service inspect
Display detailed information on one or more services
Docker service logs
Fetch the logs of a service or task
Docker service ls
List services
Docker service ps
List the tasks of one or more services
Docker service rm
Remove one or more services
Docker service rollback
Revert changes to a service's configuration
Docker service scale
Scale one or multiple replicated services
Docker service update
Update a service
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.