tidwall / summitdb

In-memory NoSQL database with ACID transactions, Raft consensus, and Redis API
Other
1.41k stars 78 forks source link

Kubernetes Statefulset #25

Open sigxcpu76 opened 6 years ago

sigxcpu76 commented 6 years ago

SummitDB is something I've been looking for for ages: RedisDB-like with JSON and secondary index support. I've successfully set up a cluster on localhost with various ports and tested HA by killing nodes and/or storage, all being successful. The real destination for this is a Kubernetes cluster. I've managed to create a StatefulSet and there were some tricks required:

It clusters beautifully, but there one more issue left. The first node that initiates the clustering is stored in cluster database (Raft?) by IP:port. In a containerized environment IPs are ephemeral, so this will kill the cluster at first node loss.

Now the question is: is it possible to have an "advertise address" parameter that will be used by Raft peering? This way we can have stable Node IDs by using hostnames, which come with a guarantee in a Kubernetes Statefulset.