Infrastructure discovery with etcd
ducky.cloud
ducky.cloud
"Consul agent takes part in Raft, so doing infrastructure discovery in your whole environment means every system takes part in Raft"
Consul agent runs in two modes - master and client. From the Consul Docs:
"Client - A client is an agent that forwards all RPCs to a server. The client is relatively stateless. The only background activity a client performs is taking part in the LAN gossip pool. This has a minimal resource overhead and consumes only a small amount of network bandwidth."
The client doesn't take part in the consensus protocol. This seems to be the OPs whole reason for choosing etcd over Consul and I don't believe the OPs claim is correct.
I think that with the upcoming kubernetes trend, many OPs guys are somehow familiar with the CoreOS stack where etcd fits in very great. The hashicorp toolchain is great, but I've seen many OPs guys only using terraform or vault e.g. and don't build an integrated environment with nomad or atlas.
The CoreOS stacks I've seen are more integrated in platforms than the hashicorp ones (can be a good and a bad thing at once).
I think this is one of the nice parts about Hashicorp releases though is that they are building blocks and you can choose to use them as standalone pieces - Consul, subsets Consul + Vault or of them in an integrated stack such Nomad and Atlas.
I agree with you though if you are a CoreOS shop it certainly makes sense to choose etcd.
I have read a blog post about continous testing of consul at high scale too (can't find the link for now), but I can't remember to got this much insights.
The author says that Atlas is essentially "required" for bootstrapping. We simply use our cloud provider's "list-instances" command (with a filter) so that we don't rely on any third-party and never contact the internet. This is important to us for security and stability, and has kept our cluster running with over 1k members. We don't want to go down when Atlas or etcd's discovery service goes down.
What provisioning do you use to integrate with your cloud providers api?
I'm curious how etcd is bootstrapping? I don't see a better way to do it than using multicasting.
BTW: I absolutely hate that consul (and looks like etcd has this issue as well) is using http for communicating. It's so inefficient to obtain updates about changes these way. Zookeeper which everyone loves to hate (and it wasn't even created for service discovery), did this so much better, you have a single long standing connection where you subscribe what updates you want to receive, it has much lower overhead and is simpler to code with.
Another thing that seems to be lost buy people who promote their service discovery solution is that you don't need to be always consistent and eventually consistent is perfectly fine. You don't really need raft or paxos to do it.
Again, I did not work with etcd yet, but in consul because it's "RESTful" i when you monitor multiple services you need to maintain multiple requests.
Edit: Reading more about http 2's frames and pipelining, looks like it's possible to use it similar way it's done in ZK[1]. If GRPC allows that then I suppose it indeed solves this problem.
[1] having a single long standing connection that's not closed after receiving a response. The request frames could be used to place watches and response frames would send the updates to the client.
Last part is we have Go program (started with Bash) to do the joining.
It finds all the Consul server nodes (using tags) and then runs `consul join` until it succeeds.
There's a bunch of error checking and timeouts and such to make sure it works correctly.
I'm hoping to post a blog post about this in the next month or so.
I hope they can move to GUIDs or some other solution soon and facilitate consul's use in "dynamic" (at leat from consul's point of view) IP environment, say inside Docker, etc.
Which option would that be for a server config?
Are you wanting to have a single consul service running for the whole environment (as client and server)? If you're running an HA environment you should really have dedicated master nodes and non-voting clients for service discovery on instances. The member states of consul clusters have an IP and ID, are you saying that the IP could be mixed with a different ID (it could in the cloud, but upon connecting to the leader it would update its registered information).
Are you talking about cleaning up old instances registered in the cluster? Or that there could be a single master node which has a broken network connection to the other master nodes, so sees different cluster status information? In that case, you should be monitoring all your services. Always. There are a lot of tools out there which will clean up and correct voting clusters in those situations. We use Sensu and Kubernetes checks / services for a lot of monitoring and automatic reaction to changes in cluster health.
From the docs:
-advertise - The advertise address is used to change the address that we advertise to other nodes in the cluster. By default, the -bind address is advertised. However, in some cases, there may be a routable address that cannot be bound. This flag enables gossiping a different address to support this. If this address is not routable, the node will be in a constant flapping state as other nodes will treat the non-routability as a failure.
It is waiting for the previous IP, who was the leader, to join... My understanding is that it's not solved?
https://github.com/hashicorp/consul/issues/457
Or maybe I could set the reaping delay from 72h to 0 in that case.
Details are here - https://www.consul.io/docs/agent/checks.html.