zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Benediktson <dbenedikt...@twitter.com.INVALID>
Subject Re: can the value of myid > 255?
Date Tue, 20 Dec 2016 17:18:00 GMT
I'd strongly suggest you keep the actual value within the range of [0,255]
so that you can get the benefit of the fix for ZOOKEEPER-2504 whenever the
patch is accepted.

On Tue, Dec 20, 2016 at 9:11 AM, Michael Han <hanm@cloudera.com> wrote:

> >> I can not see any limitation on this myid??
>
> There is no hard limitation in code that enforce myid is in range of
> [1..255] - myid is required to be in such range because it's used as server
> id which is used to generate session id. Each session id should be unique,
> so this requires the higher 8 bits of the server id (myid) to be unique.
> See here
> <https://github.com/apache/zookeeper/blob/master/src/java/main/org/apache/
> zookeeper/server/SessionTrackerImpl.java#L100>
> for
> code reference.
>
> >> I want to use the host ip to auto generate myid (ip2long) in bash shell
> when install zookeeper, but the auto generated will greater than 255
>
> I think generating myid that exceeds 255 should work as long as you can
> guarantee the lower 8 bits of it is unique. Though I'd also recommend to
> try generate myid within range of [1..255], it seems not too hard to do so.
>
> See ZOOKEEPER-2503 for more details on related discussions.
>
> On Tue, Dec 20, 2016 at 7:50 AM, 郭平(坤宇) <guoping.gp@alibaba-inc.com>
> wrote:
>
> > In the zookeeper's document for v3.4.6, it says
> > "...The myid file consists of a single line containing only the text of
> > that machine's id. So myid of server 1 would contain the text "1" and
> > nothing else. The id must be unique within the ensemble and should have a
> > value between 1 and 255..."
> >
> > but by checking the source code, I can not see any limitation on this
> > myid?? So if I have config a myid > 255, is there any side effect??
> > ======================QuorumPeer.java
> >
> >     /**     * My id     */    private long myid;
> >
> > I want to use the host ip to auto generate myid (ip2long) in bash shell
> > when install zookeeper, but the auto generated will greater than 255
> >
>
>
>
> --
> Cheers
> Michael.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message