Masterless High-Availability Leader Election for Go.
Ronin embeds NATS JetStream (Raft) as the consensus engine so
you can ship leader election as part of a single binary.
Ronin provides leader election semantics similar to Kubernetes Lease Leader Election without depending on an
external etcd or Kubernetes API Server.
Since it embeds the consensus engine, you can simplify operations by shipping a single binary.
Click on the components below to understand how Ronin achieves scalability.
Ronin uses a Manager-Candidate architecture. This separation is crucial for running hundreds of election shards within a single process efficiently.
Click a component on the diagram to learn more.
The Infrastructure Layer. It is a Singleton per process.
The Application Layer. You can have multiple Candidates per process.
OnElected, OnSteppingDown.Prevents double leaders and self-steps down on stale leadership. Provides semantics similar to Kubernetes Lease Leader Election.
Embeds NATS JetStream (Raft) as the consensus engine. Run as a single binary without setting up complex external middleware.
Exports metrics for leadership status, KV revision, and failure counts out of the box. Supports custom MeterProviders.
If your application configures the OpenTelemetry SDK, Ronin exports metrics automatically.
Reliable leader election needs a quorum.
If multiple candidates share the same BucketName, their settings must match (enforced by
Manager).
Stop Candidates first (cancel the ctx passed to Run), then shut down the Manager.
ctx passed to candidate.Run(ctx).mgr.Shutdown().