Open longtechmaster opened 6 years ago
Yeah, I've had dig
not work before. Usually host
or getent
or something similar will. You should find something that works and replace that script with that works in your containers on the VM. Then, everything should be fine.
Also, have you considered moving to Kubernetes? There is no need for Consul in Kubernetes.
tks you! I run docker-compose first and run a script after that. The script show list ip of consul from the container outside ( base on docker-inspect
) and export to text file. The text file is used to volumes
from outside to /root/usr/bin/
inside container. I changed container-find
file -> read the text file.
This my way. I cant show list ip from inside container with dig
, getent
, host
, ... at my server (Debian Virtual Machine).
Can you help me another better way! Tks you!
when i changed dig
to getent ahosts ${1:-$CONSUL_SERVER_NAME} | awk '{print $1}' | awk 'NR % 2'
at local
i receive list ip same dig
/ # getent ahosts ${1:-$CONSUL_SERVER_NAME} | awk '{print $1}' | awk 'NR % 2'
172.18.0.9
172.18.0.8
172.18.0.5
/ # dig +short ${1:-$CONSUL_SERVER_NAME}
172.18.0.8
172.18.0.9
172.18.0.5
/ #
BUT Consul NOT working
2018/05/17 01:22:35 [INFO] raft: Election won. Tally: 1
2018/05/17 01:22:35 [INFO] raft: Node at 172.18.0.9:8300 [Leader] entering Leader state
2018/05/17 01:22:35 [INFO] consul: cluster leadership acquired
2018/05/17 01:22:35 [INFO] consul: New leader elected: e0d5eecc154a
2018/05/17 01:22:35 [INFO] consul: member '39a08603c401' joined, marking health alive
2018/05/17 01:22:35 [INFO] consul: member 'e0d5eecc154a' joined, marking health alive
2018/05/17 01:22:35 [ERR] consul: 'ba7e4254ead0' and 'f782fa5e353f' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:22:35 [INFO] consul: member 'ba7e4254ead0' joined, marking health alive
2018/05/17 01:22:35 [ERR] consul: '97368f1f55c0' and 'e0d5eecc154a' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:22:35 [INFO] consul: member '97368f1f55c0' joined, marking health alive
2018/05/17 01:22:35 [INFO] agent: Synced service 'consul'
2018/05/17 01:22:35 [ERR] consul: 'f782fa5e353f' and 'e07b1d5ff119' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:22:35 [INFO] consul: member 'f782fa5e353f' joined, marking health alive
2018/05/17 01:22:35 [ERR] consul: 'e07b1d5ff119' and 'f0cf753f5b09' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:22:35 [INFO] consul: member 'e07b1d5ff119' joined, marking health alive
2018/05/17 01:22:35 [ERR] consul: 'f0cf753f5b09' and 'e0d5eecc154a' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:22:35 [INFO] consul: member 'f0cf753f5b09' joined, marking health alive
2018/05/17 01:22:35 [INFO] consul: New leader elected: 97368f1f55c0
2018/05/17 01:22:36 [INFO] consul: New leader elected: f0cf753f5b09
2018/05/17 01:22:36 [INFO] consul: New leader elected: f782fa5e353f
2018/05/17 01:22:36 [INFO] consul: New leader elected: e07b1d5ff119
2018/05/17 01:23:35 [ERR] consul: 'f782fa5e353f' and '97368f1f55c0' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:23:35 [ERR] consul: 'e07b1d5ff119' and 'e0d5eecc154a' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:23:35 [ERR] consul: 'f0cf753f5b09' and 'e0d5eecc154a' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:23:35 [ERR] consul: 'ba7e4254ead0' and 'e0d5eecc154a' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
2018/05/17 01:23:35 [ERR] consul: '97368f1f55c0' and 'e07b1d5ff119' are both in bootstrap mode. Only one node should be in bootstrap mode, not adding Raft peer.
Are you familiar with how Consul works?
You could try setting CONSUL_BOOTSTRAP_DEBUG
to true
and then review the log file at /var/log/consul-bootstrap/consul-bootstrap.log
. This documents decisions made by the custom Consul bootstrapping functionality within these containers.
Also, have a read of https://github.com/smebberson/docker-alpine#consul-and-service-discovery and review the example. See if you can get that to work.
I can start all examples/ at local but not working in my server (a Virtual Machine), consul can't join with other
I tried to run all command in
docker-alpine/alpine-consul/root/usr/bin/
in consul-containerdig +short ${1:-$CONSUL_SERVER_NAME}
in container-find file not working, that make scriptconsul-join
,consul-available
cant run (and in this container, i cant ping to any website. )