Problem Description I created three virtual machines with centos7 installed locally and initialized the swarm cluster, namely one manager node and two worker nodes; the IP addresses of the three machines are [root@localhost ~]# docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION j0f4up8v7epacp3vceby4exsz localhost.localdomain Ready Active 19.03.13 qeeqc10gl9e56w61pajjqle08 localhost.localdomain Ready Active 19.03.13 r5sg5m9dkwcu76t56hg0vu29t * localhost.localdomain Ready Active Leader 19.03.14 Then I started a service on the swarm cluster with the following command docker service create --name test-vote --replicas 2 --constraint node.role==worker --publish 8080:80 registry.cn-hangzhou.aliyuncs.com/anoy/vote Directly curling the worker node ip:port can get a response, but the returned containerId remains unchanged, and if you directly access the manager node, you will not get a response, it seems that the load balancing is not effective! solveAfter some searching, I found the answer on stack overflow: https://stackoverflow.com/questions/48360577/docker-swarm-mode-routing-mesh-not-working It turned out to be a firewall issue. According to the documentation, in order for So if it is centos, you can use the following script to open the port. Each host in the swarm cluster needs to be opened. For convenience, both TCP and UDP ports are opened. After opening the port, you need to restart the machine. firewall-cmd --permanent --zone=public --add-port=4789/tcp && \ firewall-cmd --permanent --zone=public --add-port=7946/tcp && \ firewall-cmd --permanent --zone=public --add-port=4789/udp && \ firewall-cmd --permanent --zone=public --add-port=7946/udp && \ firewall-cmd --reload && \ # Reboot sudo reboot This is the end of this article about docker swarm external verification load balancing not taking effect. For more relevant docker swarm load balancing content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Summary of the most commonly used knowledge points about ES6 new features
>>: JS, CSS style reference writing
To understand load balancing, you must first unde...
As the application of centos on the server side b...
Installation of Python 3 1. Install dependent env...
Table of contents Enter the topic mysql add, dele...
1. Official Introduction grep is a commonly used ...
Preface The string types of MySQL database are CH...
Several parts of Compose deal with environment va...
Table of contents Preface Actual Combat 1. No loc...
Create a project Create a project in WeChat Devel...
This article installs Google Input Method. In fac...
1. Download the virtual machine version 15.5.1 I ...
Note When developing an article display list inte...
In the project, it is necessary to obtain the lat...
Table of contents Solution 1: Rebuild Replicas Pr...
CSS has two pseudo-classes that are not commonly ...