You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Sergey Chugunov <se...@gmail.com> on 2018/02/20 13:59:53 UTC

Zookeeper client behavior on ZK server segmentation

Hello Zookeeper folks,

I'm from Apache Ignite community [1]; I'm trying to adopt ZooKeeper ver.
3.4.6 in our project.

As Ignite is a distributed platform we need some discovery mechanism to
build a cluster; when integrating ZooKeeper for this purpose I faced the
following issue.

My scenario is simple: I use ZK multinode cluster to organize discovery
environment where Ignite nodes publish discovery data to find each other.

So each Ignite node connects to some ZK server in order to join the
cluster.
However, when ZK server gets segmented from ZooKeeper cluster, it seems it
closes sessions of all connected clients; as a result all Ignite nodes
connected to that particular server shut down.

My question is if there is a way to configure ZooKeeper client in such a
way that it will try to reconnect to other ZooKeeper servers when the
server it was connected to gets segmented?

If no, what would you recommend to overcome the issue? Is it possible to
handle server segmentation in ZooKeeper client and organize reconnect
procedure at Ignite's code level?

Thanks,
Sergey Chugunov.

[1] https://ignite.apache.org/

Re: Zookeeper client behavior on ZK server segmentation

Posted by Sergey Chugunov <se...@gmail.com>.
Flavio,

Thank you for quick reply, I'll revisit my code in that case.

---
Sergey.

On Tue, Feb 20, 2018 at 7:04 PM, Flavio Junqueira <fp...@apache.org> wrote:

> Hey Sergey,
>
>
> > My question is if there is a way to configure ZooKeeper client in such a
> > way that it will try to reconnect to other ZooKeeper servers when the
> > server it was connected to gets segmented?
>
> The connect string that you pass when creating a zookeeper handle can
> contain multiple server names or addresses. If you configure that way,
>  the client will try to reconnect to a different server upon disconnecting.
>
> Note that the zk client will notify the application of the connection
> loss, but
> that notification (or exception, depending on whether you are on the sync
> or
> Async API) does not imply that the session is expired. Session expiration
> is declared by the leader.
>
> -Flavio
>
> > On 20 Feb 2018, at 14:59, Sergey Chugunov <se...@gmail.com>
> wrote:
> >
> > Hello Zookeeper folks,
> >
> > I'm from Apache Ignite community [1]; I'm trying to adopt ZooKeeper ver.
> > 3.4.6 in our project.
> >
> > As Ignite is a distributed platform we need some discovery mechanism to
> > build a cluster; when integrating ZooKeeper for this purpose I faced the
> > following issue.
> >
> > My scenario is simple: I use ZK multinode cluster to organize discovery
> > environment where Ignite nodes publish discovery data to find each other.
> >
> > So each Ignite node connects to some ZK server in order to join the
> > cluster.
> > However, when ZK server gets segmented from ZooKeeper cluster, it seems
> it
> > closes sessions of all connected clients; as a result all Ignite nodes
> > connected to that particular server shut down.
> >
> > My question is if there is a way to configure ZooKeeper client in such a
> > way that it will try to reconnect to other ZooKeeper servers when the
> > server it was connected to gets segmented?
> >
> > If no, what would you recommend to overcome the issue? Is it possible to
> > handle server segmentation in ZooKeeper client and organize reconnect
> > procedure at Ignite's code level?
> >
> > Thanks,
> > Sergey Chugunov.
> >
> > [1] https://ignite.apache.org/
>
>

Re: Zookeeper client behavior on ZK server segmentation

Posted by Flavio Junqueira <fp...@apache.org>.
Hey Sergey,


> My question is if there is a way to configure ZooKeeper client in such a
> way that it will try to reconnect to other ZooKeeper servers when the
> server it was connected to gets segmented?

The connect string that you pass when creating a zookeeper handle can
contain multiple server names or addresses. If you configure that way,
 the client will try to reconnect to a different server upon disconnecting.

Note that the zk client will notify the application of the connection loss, but
that notification (or exception, depending on whether you are on the sync or
Async API) does not imply that the session is expired. Session expiration
is declared by the leader.

-Flavio

> On 20 Feb 2018, at 14:59, Sergey Chugunov <se...@gmail.com> wrote:
> 
> Hello Zookeeper folks,
> 
> I'm from Apache Ignite community [1]; I'm trying to adopt ZooKeeper ver.
> 3.4.6 in our project.
> 
> As Ignite is a distributed platform we need some discovery mechanism to
> build a cluster; when integrating ZooKeeper for this purpose I faced the
> following issue.
> 
> My scenario is simple: I use ZK multinode cluster to organize discovery
> environment where Ignite nodes publish discovery data to find each other.
> 
> So each Ignite node connects to some ZK server in order to join the
> cluster.
> However, when ZK server gets segmented from ZooKeeper cluster, it seems it
> closes sessions of all connected clients; as a result all Ignite nodes
> connected to that particular server shut down.
> 
> My question is if there is a way to configure ZooKeeper client in such a
> way that it will try to reconnect to other ZooKeeper servers when the
> server it was connected to gets segmented?
> 
> If no, what would you recommend to overcome the issue? Is it possible to
> handle server segmentation in ZooKeeper client and organize reconnect
> procedure at Ignite's code level?
> 
> Thanks,
> Sergey Chugunov.
> 
> [1] https://ignite.apache.org/