Jumping in to this conversation:

I know that's best practice.  In my case though, we have a situation where we  
spread our zk nodes across two networks in different buildings connected with 
high speed robust, redundant networks.  We also have some servers at a third 
co-location facility is isn't exactly quite as robust.  We generally use this 
for quorum management, just to break ties when a netsplit happens.  For 
example, for mongodb cluster we run a non-data bearing node in arbiter mode 
here.

For Zookeeper, we exclude this node from the connection string as we never want 
our clients connecting to it.  In an ideal world, we would also like it to 
participate in leader elections but not be electable.  Bonus points if it only 
participated in leader elections and didn't have a copy of the znode data.


--
Kathryn Hogg
Principal Technology Architect

-----Original Message-----
From: Szalay-Bekő Máté [mailto:szalay.beko.m...@gmail.com] 
Sent: Monday, June 20, 2022 10:29 AM
To: UserZooKeeper <u...@zookeeper.apache.org>
Cc: DevZooKeeper <dev@zookeeper.apache.org>; Heller, George A III CTR (USA) 
<george.a.heller2....@mail.mil.invalid>
Subject: Re: Can the leader of a Zookeeper be specifically selected at startup?

{External email message: This email is from an external source. Please exercise 
caution prior to opening attachments, clicking on links, or providing any 
sensitive information.}

I also don't really know why you would need a single host being "preferred"
as leader. I think the safest (and the best practice) is to make sure all your 
ZooKeeper servers are the same in terms of networking / performance / etc.

Not knowing your goals, maybe the Observer feature is also something you can 
take a look into:
https://zookeeper.apache.org/doc/r3.6.3/zookeeperObservers.html

Best regards,
Mate

On Mon, Jun 20, 2022 at 9:57 AM Enrico Olivelli <eolive...@gmail.com> wrote:

> 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/b4f9aab099880ba8ef08eaff697de
> be6cdeae057/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?
>

Reply via email to