wesher icon indicating copy to clipboard operation
wesher copied to clipboard

Why does network need to be multiple of 8?

Open dovi5988 opened this issue 5 years ago • 5 comments

Hi,

Is here any reason why wesher is set up so that nework side needs to a multiple of 8? This currently restricts you to having your network block being a minimum of a /24. Since a random IP from the network is assigned there is no way to know if a host's IP will end in 1 or 95.

dovi5988 avatar Sep 13 '20 03:09 dovi5988

Hi, yes, this is currently an unfortunate side-effect of the (somewhat naive) IP assignment implementation. With a bit of refactoring, it should be perfectly possible to get rid of this limitation.

Having said that, I didn't think this would be a problem for all but the most extreme cases. What use-case do you have in mind? Do you have so many networks, where /24 becomes prohibitive?

costela avatar Sep 13 '20 12:09 costela

Quite the opposite. We are using keydb where you need to list every other IP in the network. Since we don't know what IP a host will get if we have a /24 we need to configure every host to try to connect to every other node on the network (since each node does not know when the other nodes come and go). If we that IP usage started at the bottom and we had say 10 hosts then I would just add: 172.16.50.1 172.16.50.2 etc. and add the first 10 IP's.

dovi5988 avatar Sep 13 '20 20:09 dovi5988

Ah, I see, so it's basically a trick to compensate for the lack of service-discovery? Wouldn't looping over a set of hostnames help? The hostnames are added to /etc/hosts to help with this kind of problem.

(but don't get me wrong: I still intend on getting rid of the original limitation; just gotta find the time)

costela avatar Sep 14 '20 08:09 costela

@costela I would not help since KeyDB has no way of knowing when hosts join and leave. The only "easy" way is if I know I plan on having a max of 10 hosts then list those ten in keydb.

dovi5988 avatar Sep 14 '20 09:09 dovi5988

@dovi5988 What about running Consul too? Consul is able to keep track of hosts in the cluster and provide a queryable HTTP API.

sbrl avatar Mar 30 '21 16:03 sbrl