Load balancing with HAPROXY & CONFD
Имеем:
$ fleetctl list-units
UNIT MACHINE ACTIVE SUB
[email protected] 3408f7ab.../172.17.8.103 active running
[email protected] b2ca4512.../172.17.8.101 active running
[email protected] 3408f7ab.../172.17.8.103 active running
[email protected] b2ca4512.../172.17.8.101 active running
[email protected] 3408f7ab.../172.17.8.103 active running
[email protected] db577263.../172.17.8.102 active running
[email protected] b2ca4512.../172.17.8.101 active running
[email protected] 3408f7ab.../172.17.8.103 active running
[email protected] db577263.../172.17.8.102 active running
[email protected] b2ca4512.../172.17.8.101 active running
Я заменил оригинальные image, своими. Они отличаются только IP адресом. С оригинальным у меня не заработало.
$ vi haproxy.service
$ fleetctl submit haproxy.service
$ fleetctl start haproxy.service
$ fleetctl list-units
UNIT MACHINE ACTIVE SUB
haproxy.service 3408f7ab.../172.17.8.103 active running
haproxy.service b2ca4512.../172.17.8.101 active running
haproxy.service db577263.../172.17.8.102 active running
[email protected] 3408f7ab.../172.17.8.103 active running
[email protected] b2ca4512.../172.17.8.101 active running
[email protected] 3408f7ab.../172.17.8.103 active running
[email protected] b2ca4512.../172.17.8.101 active running
[email protected] 3408f7ab.../172.17.8.103 active running
[email protected] db577263.../172.17.8.102 active running
[email protected] b2ca4512.../172.17.8.101 active running
[email protected] 3408f7ab.../172.17.8.103 active running
[email protected] db577263.../172.17.8.102 active running
[email protected] b2ca4512.../172.17.8.101 active running
$ journalctl -f --lines=50 -u haproxy
http://172.17.8.101/
http://172.17.8.102/
http://172.17.8.103/
Все работает!
Если нужно остановить и выгрузить все, что касается сервиса:
$ fleetctl stop haproxy.service
$ fleetctl unload haproxy.service
$ fleetctl destroy haproxy.service