George, really, it should not be a problem which is the leader. it is automatically chosen. Each node should be ideally as powerful as the other peers.
why do you need this "preferred leader" ? I am afraid that you have some flaw in your design Enrico Il giorno lun 20 giu 2022 alle ore 05:39 Kezhu Wang <kez...@gmail.com> ha scritto: > > Hi, > > I think this could be achieved with help from `reconfig`[1]: > * Configs all nodes with `standaloneEnabled=false`, `reconfigEnabled=true`. > * Starts node-2 as sole quorum participant. > * Now node-2 is the leader. You will see "No server failure will be > tolerated. You need at least 3 servers”. > * Starts node-1 and node-3 with all quorum. > * `zkCli.sh config` shows only node-2 for now. > * `zkCli.sh reconfig -add node-1,node-2` will add both node-1, node-3 to > quorum. > * According to `Leader.tryToCommit`[2], node-2 will be the leader due to > old leadership in old quorum and voter in new quorum. > > node-2 is the leader in whole progress. > > [1]: https://zookeeper.apache.org/doc/current/zookeeperReconfig.html > [2]: > https://github.com/apache/zookeeper/blob/b4f9aab099880ba8ef08eaff697debe6cdeae057/zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Leader.java#L950 > > Best, > Kezhu Wang > > On June 19, 2022 at 23:00:59, Heller, George A III CTR (USA) ( > george.a.heller2....@mail.mil.invalid) wrote: > > We have 3 Zookeeper nodes and would like node 2 to always be the leader > unless node 2 goes down. IF node 2 goes down, then either node 1 or node 3 > would be the leader. > > > > Can this be done? If so, how would this be done?