I installed a consul cluster, 3 nodes. At first, this cluster was good worked. The leader was elected yet.
node1
./consul agent -server -bootstrap -syslog \
-ui \
-data-dir=/opt/consul/data \
-config-dir=/opt/consul/conf \
-pid-file=/opt/consul/run/consul.pid \
-client=0.0.0.0 \
-bind=node1 \
-node=consul-server01 -disable-host-node-id -join=node1
node2
./consul agent -server -syslog \
-ui \
-data-dir=/opt/consul/data \
-config-dir=/opt/consul/conf \
-pid-file=/opt/consul/run/consul.pid \
-client=0.0.0.0 \
-bind=node2 \
-node=consul-server02 -disable-host-node-id -join=node1
node3
./consul agent -server -syslog \
-ui \
-data-dir=/opt/consul/data \
-config-dir=/opt/consul/conf \
-pid-file=/opt/consul/run/consul.pid \
-client=0.0.0.0 \
-bind=node3 \
-node=consul-server03 -disable-host-node-id -join=node1
And then, I registered three services(A,B,C) via HTTP API.
registered the A service via HTTP API of node1
(curl -X PUT -d '{"id": "livtix0atcf01","name": "Docker-service1","address": "livtix0atcf01","port":9100,"tags": ["node_exporter"]}' http://node1:8500/v1/agent/service/register )
registered the B service via HTTP API of node2
(curl -X PUT -d '{"id": "livtix0atcf02","name": "Docker-service2","address": "livtix0atcf02","port":9100,"tags": ["node_exporter"]}' http://node2:8500/v1/agent/service/register )
registered the C service via HTTP API of node3
(curl -X PUT -d '{"id": "livtix0atcf03","name": "Docker-service3","address": "livtix0atcf03","port":9100,"tags": ["node_exporter"]}' http://node3:8500/v1/agent/service/register )
I expect to have these three services at each point to high availability. But it’s not, serviceA only exist on the node1, and serviceB only exist on the node2, serviceC only exist on the node3.
And then, when I stopped the node3, the serviceC doesn’t existed.
The state of each node is consistent.
**consul info command output: The raft part of each node is consistent **
I want to know what the problem is.
Thank you so much!
Should I register one service to all three nodes at the same time?