Another thing you could try is to send the "stat" command to each server in your ensemble. On a leader it will return "Mode: leader" versus "Mode: follower" for a follower.
Of course it's not necessarily guaranteed that the leader at the start of the test will stay the leader throughout. $ echo stat | nc zookeeper1 2181 Zookeeper version: 3.4.5-107--1, built on 05/20/2013 06:34 GMT Clients: ... Latency min/avg/max: 0/0/390 Received: 2334607 Sent: 2631466 Connections: 2 Outstanding: 0 Zxid: 0x90032f244 Mode: leader Node count: 61 On 4/18/14, 10:43 AM, "Paolo Viotti" <[email protected]> wrote: >I've solved this by implementing a simple leader election algorithm that >elects as leader the quorum peer with smallest id. > >Thanks anyway. >Best regards, >P > > >On 18/04/2014 13:05, Paolo Viotti wrote: >> Hello, >> >> I'm running some performance experiments which involve ZooKeeper. >> In order to simplify things I'd like to point all clients to the same >> server, and, most importantly, I'd like that server to be the leader >> of the ensemble. >> >> So I was wondering: is there a way to choose and impose a leader of >> the ensemble (thus bypassing the leader election algorithm)..? >> >> Thanks in advance. >> Kind regards, >> Paolo >> >
