Zookeeper client behavior on ZK server segmentation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Zookeeper client behavior on ZK server segmentation

Sergey Chugunov
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/
Reply | Threaded
Open this post in threaded view
|

Re: Zookeeper client behavior on ZK server segmentation

Flavio Junqueira-3
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 <[hidden email]> 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/

Reply | Threaded
Open this post in threaded view
|

Re: Zookeeper client behavior on ZK server segmentation

Sergey Chugunov
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 <[hidden email]> 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 <[hidden email]>
> 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/
>
>