docker swarm join --token SWMTKN-1-10o7lx9kz7w3knoboo3538z4enqhposlyko2c5w2uyb0f52f7r-2f8wllr0ap9i6dc22ouk074zw 192.168.1.64:2377
docker swarm leave --force
docker swarm init --advertise-addr 123.123.123.11
docker swarm join --token SWMTKN-1-0ot4t2x6avevkfw7346mviwf7kjrsqrkwuc8zqldqax2o92cku-29469t5mtein2fv7gyzsn6jrm 10.128.18.92:2377
docker network create -d overlay --attachable --subnet=192.10.0.0/24 pxc-network
docker network create -d overlay --attachable pxc-network
docker volume prune
docker network create -d --ingress overlay --attachable pxc-network1
docker run -d
-p 9001:3306
-e MYSQL_ROOT_PASSWORD=abc123456
-e CLUSTER_NAME=cluster1
-e XTRABACKUP_PASSWORD=abc123456
-e CLUSTER_JOIN=node1
-v pnv2:/var/lib/mysql --privileged
–name=node3
–net=ingress
percona/percona-xtradb-cluster:5.7
docker run -d
-p 8080:3306
-e MYSQL_ROOT_PASSWORD=abc123456
-e CLUSTER_NAME=cluster1
-e XTRABACKUP_PASSWORD=abc123456
-v conf1:/etc/mysql
-v pnv1:/var/lib/mysql --privileged
–name=node1
–net=pxc-network
percona/percona-xtradb-cluster:5.7
docker run -d
-p 8080:3306
-e MYSQL_ROOT_PASSWORD=abc123456
-e CLUSTER_NAME=cluster1
-e XTRABACKUP_PASSWORD=abc123456
-v conf1:/etc/mysql
-v pnv1:/var/lib/mysql --privileged
–name=node1
–net=pxc-network
percona/percona-xtradb-cluster:5.7 --wsrep-new-cluster
docker run -d
-p 8081:3306
-e MYSQL_ROOT_PASSWORD=abc123456
-e CLUSTER_NAME=cluster1
-e XTRABACKUP_PASSWORD=abc123456
-e CLUSTER_JOIN=node1
-v conf2:/etc/mysql
-v pnv2:/var/lib/mysql --privileged
–name=node2
–net=pxc-network
percona/percona-xtradb-cluster:5.7
docker run -d
-p 8080:3306
-e MYSQL_ROOT_PASSWORD=abc123456
-e CLUSTER_NAME=cluster1
-e XTRABACKUP_PASSWORD=abc123456
-e CLUSTER_JOIN=node1
-v conf3:/etc/mysql
-v pnv3:/var/lib/mysql --privileged
–name=node3
–net=pxc-network
percona/percona-xtradb-cluster:5.7
docker run -d
-p 8080:3306
-e MYSQL_ROOT_PASSWORD=abc123456
-e CLUSTER_NAME=cluster1
-e XTRABACKUP_PASSWORD=abc123456
-v conf3:/etc/mysql
-v pnv3:/var/lib/mysql --privileged
–name=node3
–net=pxc-network
percona/percona-xtradb-cluster:5.7
192.10.0.4:4567
iptables -L -n
iptables -v -L
https://www.percona.com/blog/2018/06/12/pxc-loves-firewalls-system-admins-loves-iptables/
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 3306 -j ACCEPT
iptables -A INPUT -p tcp --dport 4567 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 4567 -j ACCEPT
iptables -A INPUT -p tcp --dport 4568 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 4568 -j ACCEPT
iptables -A INPUT -p tcp --dport 4444 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 4444 -j ACCEPT
firewall-cmd --zone=public --add-port=4567/udp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=4567/tcp --permanent
firewall-cmd --zone=public --add-port=4568/tcp --permanent
firewall-cmd --zone=public --add-port=4444/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --zone=public --add-port=2376/tcp --permanent
firewall-cmd --zone=public --add-port=2377/tcp --permanent
firewall-cmd --zone=public --add-port=2376/tcp --permanent
docker machine
firewall-cmd --add-port=2376/tcp --permanent
manager
firewall-cmd --add-port=2377/tcp --permanent
communication among nodes (container network discovery).
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
overlay network traffic (container ingress networking).
firewall-cmd --add-port=4789/udp --permanent
iptables -A INPUT -p tcp --dport 2376 -j ACCEPT
iptables -A INPUT -p tcp --dport 2377 -j ACCEPT
iptables -A INPUT -p tcp --dport 7946 -j ACCEPT
iptables -A INPUT -p udp --dport 7946 -j ACCEPT
iptables -A INPUT -p tcp --dport 4789 -j ACCEPT
4444
4568
https://blog.csdn.net/pyktpykt/article/details/84589235
https://www.imooc.com/qadetail/264129
http://www.imooc.com/qadetail/263927
2377
wget http://launchpad.net/bridgeutils/main/1.4/+download/bridge-utils-1.4.tar.gz
docker node update --availability active
https://www.jianshu.com/p/6f9f9183f981
https://www.cnblogs.com/nulige/articles/9204706.html
#docker0网卡重启
ifconfig docker0 down
service network restart
卸载docker0
https://blog.csdn.net/styshoo/article/details/50984649>https://blog.csdn.net/styshoo/article/details/50984649
来源:CSDN
作者:方方园园
链接:https://blog.csdn.net/qq_22041375/article/details/103580536