Query Current Leader

I was wondering if it was possible to tie into or query the couchbase leader election process.

We have another application running on the same servers as couchbase that require leader coordination and using something like zookeeper or implementing raft ourselves seems like overkill if we could piggyback on an existing process occurring in couchbase.

Would this be at all possible?

1 Like

The Leader or Master node only really plays a part in add/removing nodes or during rebalancing. Couchbase really is a distributed system so there is no master/slaver or master/worker relationship between nodes.

Well yeah and I would like to know which node is the Leader or Master node. Is it something one can query?


This is not something that you have access to/control, this is a logic that is part of the client SDK that chooses the client using a simple round robin approach.

I do not not the .Net client code to show you the exact location but here is how it is done in Java: