-
Notifications
You must be signed in to change notification settings - Fork 137
Add support for hostnames instead of static IP addresses #298
Comments
Thanks for looking at this! It'd be a nice feature to have. Regarding implementation:
PS: don't forget to sign the contribution agreement before submitting a PR. |
Created a first pull request now, which adds just the required additional async getaddrinfo for the outgoing connections. |
Question on the required contribution agreement: Is this agreement the right one and whom do I need to add as the Please add the Canonical Project Manager or contact (it's a required field) ? |
@NorbertHeusser That agreement looks like the right one, you could add "Stéphane Graber" @stgraber in that field. |
Yep, that's the correct one and it's fine to put me as the contact. |
@NorbertHeusser one thing I forgot to ask: are you using this raft library as part of dqlite, or for an entirely different project on your own that itself builds on this raft implementation? |
I work at the Cedalo GmbH with @ralight at our Mosquitto Premium MQTT broker. We use the raft library for HA of the broker right now. |
Oh I see, interesting. And out of curiosity, is it a single-threaded even-driven application or are you running this raft engine in its own thread and interacting with it from another thread? |
We have a dedicated thread running the raft engine. And different thread(s) running the broker itself. Communication between our thread and the raft engine thread is performed using small in-memory-queues to avoid race conditions. |
@NorbertHeusser can this be closed? |
We would like to use the raft library in the context of a docker swarm runtime environment. In contrast to traditional docker runtime it's not possible to assign internal static IP addresses to the individual cluster members. Static IP assignment not working seems to be an open issue in docker swarm now for several year so I don't expect it to be get fixed soon.
I tried to implement the DNS lookup in our application layer and keep the raft library config on IP addresses. But this has several caveats:
I guess in general it will make sense to support hostnames in the raft config instead of static IPs. And I already start to add the necessary code extension to provide a pull request. But I would need some design guidance how you would prefer the solution to be later on accepted into you code base.
The base problem about adding host name resolving is the DNS request will add an additional and potentially blocking call to the TCP connection handling. The libuv used in your integration implementation provides an async API to perform the name resolving asynchronously. In general I currently see to code paths, where a name resolve would need to happen:
2.Before the bind of the listen port for the address (or the bind_address). The current code path does not include any asynchronous steps for the bind/list calls. So in this case I would implement the name resolving in a traditional potential timeout blocking getaddrinfo base call. Adding the name resolving as an asynchronous step would need some general design changes in the bind/listen handling.
The design questions, which are currently open to me are:
The text was updated successfully, but these errors were encountered: