right now if you boot up jube, if there is no ZOOKEEPER_URL defined it creates one on the fly on 2181.
Then the next jube you start up you specify host:2181 as the URL and it joins.
This is cool but results in an ensemble of 1. Setting up 3/5 node ensembles outside of kuberrnetes is hard.
I wonder how hard it'd be to add a kinda incremental formation?
Eg
• node1 starts; it creates a 1 node ensemble & elects a master
• node2 and node3 start, joining with an env var used as a seed to find a Zk server
• the master now detects there are 3 hosts now (each node registers into ZK) so can now decide to upgrade to 3 node ensemble - adding the address/port of node2/3 to Zk and telling node 2/3 to become ensemble members
• all nodes watch the /jube/ensemble area in Zk and then write to local disk the Zk of where the Zk ensemble nodes are so they can use those addresses on restart as seeds to find a Zk server
Then folks just have to run 1 node; then set an env var to point to it and then boot up new nodes. Then there is a simple automatic way to create a 3/5 node ensemble.
I guess multicast discovery is another option; that's much more complicated as it's tricky electing an initial leader for the first Zk server & master (chicken & egg!) so this env var approach is maybe nice & simple.
Once there are 3/5 nodes in the ensemble the system could output the URL of the 3/5 nodes to connect to from then on.
Maybe a simple multicast system could be - once a node starts in 'create' mode; it starts a Zk ensemble - then the master advertises it's URL on multicast. Other nodes can then discover the Zk URL via multicast & be informed when the ensemble changes from 1 -> 3.
The tricky thing is if 2 nodes start in create mode; when they find each other one has to switch from ensemble/master to client so there is only one master/ensemble node initially. Maybe if the startup logic waits long enough before detecting other masters & then has a way to pick which one is the real master if 2 nodes start at the same time (eg always pick the one with the smaller URL string) then the whole thing could use multicast discovery (or env vars when discover isn't available?)