Docker Swanm闆嗙兢閰嶇疆
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker Swanm闆嗙兢閰嶇疆相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/ISE' title='ISE'>ISE stop list rip erro 瑙e喅鏂规硶 firewall leader pre
棣栧厛 鍙互鐢–ontOS铏氭嫙鏈?nbsp; 鍏嬮殕 5涓櫄鎷熸満锛?span style="background-color: #ffffff; color: #800000;">娉ㄦ剰锛?/span>鍏嬮殕涓绘満蹇呴』瑁呬簡Docker,鍏嬮殕鍚庯紝鍏嬮殕鏈洪兘浼氭湁Docker锛?/span>
閰嶇疆 缃戠粶
鍏嬮殕CentOS铏氭嫙鏈?nbsp;
鏈€鍚庡拰鍒板涓嬬粨鏋?/p>
鎵撳紑2377绔彛
firewall-cmd --zone=public --add-port=2377/tcp --permanent
鐒跺悗杩涘叆CentOS 7 64浣?/p>
鍒濆鍖?nbsp;Swarm
sudo docker swarm init --advertise-addr 192.168.0.102:2377 --listen-addr 192.168.0.102:2377
A: 锛堝垵濮嬪寲鍚嶴warm鍚庡彲浠ラ€氳繃 docker swarm join-token worker 鏌ョ湅Swarm鐨凾oken淇℃伅 )
涓婂浘涓嬬澶村嵆鏄坊鍔犲姛鑳借妭鐐瑰懡浠わ紝浠g爜濡備笅锛?/p>
sudo docker swarm join --token SWMTKN-1-1fmeankvtj5x8483gsxuhgwvhrdt2yt6japzopemjcucv8ykit-4xj0shobna3bu2u1tk377z2ch 192.168.0.102:2377 --advertise-addr 192.168.0.105:2377 --listen-addr 192.168.0.105:2377
B: 鏌ョ湅娣荤鐞嗚兘鑺傜偣鍛戒护
docker swarm join-token manager
涓婂浘涓嬬澶村嵆鏄坊鍔犵鐞嗚妭鐐瑰懡浠?nbsp; 锛堟敞鎰?nbsp;鍏堝叧闂坊鍔犵鐞嗚妭鐐规満鍣ㄧ殑闃茬伀澧欙紝涓嶇劧鍙兘涓嶆垚鍔燂級锛屼唬鐮佸涓嬶細
sudo docker swarm join --token SWMTKN-1-1fmeankvtj5x8483gsxuhgwvhrdt2yt6japzopemjcucv8ykit-4xj0shobna3bu2u1tk377z2ch 192.168.0.102:2377 --advertise-addr 192.168.0.104:2377 --listen-addr 192.168.0.104:2377
鍙互閫氳繃Docker info鏌ョ湅鐩稿叧淇℃伅
娣诲姞绠$悊鑺傜偣 锛堟敞鎰?nbsp;鍏堝叧闂?04鐨?/p>
闃茬伀澧欙紝涓嶇劧鍙兘涓嶆垚鍔燂級
鍏堢櫥鍏ュ彟涓€鍙拌櫄鎷熸満
鍏抽棴闃茬伀澧?/p>
systemctl stop firewalld
娣诲姞绠$悊鑺傜偣
sudo docker swarm join --token SWMTKN-1-1fmeankvtj5x8483gsxuhgwvhrdt2yt6japzopemjcucv8ykit-4xj0shobna3bu2u1tk377z2ch 192.168.0.102:2377 --advertise-addr 192.168.0.104:2377 --listen-addr 192.168.0.104:2377
娣诲姞鍔熻兘鑺傜偣
sudo docker swarm join --token SWMTKN-1-1fmeankvtj5x8483gsxuhgwvhrdt2yt6japzopemjcucv8ykit-4xj0shobna3bu2u1tk377z2ch 192.168.0.102:2377 --advertise-addr 192.168.0.105:2377 --listen-addr 192.168.0.105:2377
鍒涘缓Swarm Service
杩欓噷鐨刦ive鏄垜鐢?net Core鍒涘缓鐨処mage,鐜板湪鎴戣鐢ㄨ繖涓鍍忓垱寤?涓猄warm Servie瀹瑰櫒
sudo docker service create --name myfiveweb -p 8080:5000 --replicas 5 five
鏌ョ湅Swarm Service 杩愯鎯呭喌
docker service ls
璇︽儏
docker service ps myfiveweb
鏌ョ湅Docker 鑺傜偣淇℃伅
docker node ls
濡傛灉鎶?nbsp;docker node ls閿欙細
Error response from daemon: rpc error: code = Unknown desc = The swarm does not have a leader. It鈥榮 possible that too few managers are online. Make sure more than half of the managers are online.
瑙e喅鏂规硶锛?/p>
docker swarm init --force-new-cluster
鎻愬崌涓虹鐞嗚妭鐐瑰懡浠?/p>
sudo docker node promote fhdpncl3ay8vl5ogmbdh42ia8
灏嗙鐞嗚妭鐐归檷绾?/p>
docker node demote 0nbt 闄嶇骇
鍒犱簡鑺傜偣
鍏堝湪鑺傜偣鏈哄櫒涓婃墽琛?nbsp;
sudo docker swarm leave --force
鐒跺悗鍐峉warm涓荤鐞嗘満涓婃墽琛?/p>
docker node rm ablwad6b 鍒犻櫎
以上是关于Docker Swanm闆嗙兢閰嶇疆的主要内容,如果未能解决你的问题,请参考以下文章