Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id AB650200BA3 for ; Thu, 20 Oct 2016 18:27:54 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id A9F20160AF2; Thu, 20 Oct 2016 16:27:54 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CB699160ACC for ; Thu, 20 Oct 2016 18:27:53 +0200 (CEST) Received: (qmail 91581 invoked by uid 500); 20 Oct 2016 16:27:52 -0000 Mailing-List: contact user-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@zookeeper.apache.org Delivered-To: mailing list user@zookeeper.apache.org Received: (qmail 91569 invoked by uid 99); 20 Oct 2016 16:27:52 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Oct 2016 16:27:52 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A91E4180664 for ; Thu, 20 Oct 2016 16:27:51 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.979 X-Spam-Level: * X-Spam-Status: No, score=1.979 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=cloudera-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id g46uc5t8WcFH for ; Thu, 20 Oct 2016 16:27:49 +0000 (UTC) Received: from mail-vk0-f42.google.com (mail-vk0-f42.google.com [209.85.213.42]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 92BDE5FBF0 for ; Thu, 20 Oct 2016 16:27:49 +0000 (UTC) Received: by mail-vk0-f42.google.com with SMTP id 83so79463693vkd.0 for ; Thu, 20 Oct 2016 09:27:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudera-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QhsnQlWjh60nom7ltpuzLIn4l1+OhkBSsbZFauNz8/o=; b=gOJGK/qQ3ERa6qOpjuTotPkwzSlhASwrmxfeth40D2npM68BK0hCJCQMX0In4H2lm6 xZCrmDTIqmdt3cjfdD31HZQ51PyRZOpzgLgMaj9D89buHkHym5pMo7XaMA20gzT6uM4+ OMX0/Zg5tI4+56DfD9r/yiKl6hqiNyGMtdWK7qGghFYYN7ejdvRYMxteAkkCOkzZZsV7 enSXwzMIwjvQUndP4pQ6y7VrP6AN8mpllsEIBqXfncpCieCibLiKe22tnEa6j0IplZJE CX8Wx56/VgZlYdvr66syuPSopOpEJGLsDu77uu5FyakjqTQJlMzaHQIDkZeCRtZJ2PVX /JJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=QhsnQlWjh60nom7ltpuzLIn4l1+OhkBSsbZFauNz8/o=; b=CycqGuiWrlcKeL8DefUNpjPvpns9eIcwzarl8DHDmSfed9nY3/Pwox9cyg9IB2qOie bPcorg2txIo1v+NYqE02Q2Ejh0WFhFX2QS1vC2Ya2dggNbddjACLVpI3pZMCBokw3d9M GskyLBQ9HHW/0Biwl78ZWRilhuNj8l67gwr7OG7SPTw2FoRxHl8qAo+XgwK+2Gdf+CRE xGzA3Ys+j+Jm48Pb+hXig90QbkJGuaAQca/s3J7TxMTYdn8Zs/IVVOUPexvdwZl9Jmzn HZQ2ezCRyalmWi6ad+xIcFej275Ith/ZMhmTksX3NnSRvLaqwtGxsC7rdt2J/pC2c57x Al9Q== X-Gm-Message-State: AA6/9Rn0P3p/oYqENvwk1S5n0DON+LDpeqaD/pth+TwS/xcZl2pHHcGfmvDdVFOAkBFXFoWp3V6JNHUk5TKOvRT7 X-Received: by 10.31.215.67 with SMTP id o64mr2234750vkg.92.1476980804473; Thu, 20 Oct 2016 09:26:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.69.226 with HTTP; Thu, 20 Oct 2016 09:26:14 -0700 (PDT) In-Reply-To: References: From: Michael Han Date: Thu, 20 Oct 2016 09:26:14 -0700 Message-ID: Subject: Re: Adding and removing replicas? To: UserZooKeeper Cc: steve@scalyr.com Content-Type: multipart/alternative; boundary=94eb2c07c97230f558053f4e64c8 archived-at: Thu, 20 Oct 2016 16:27:54 -0000 --94eb2c07c97230f558053f4e64c8 Content-Type: text/plain; charset=UTF-8 +1 on what Rakesh mentioned - dynamic reconfig is a great feature for this use case. For 3.4.x where dynamic reconfig feature is not available we could do a 'rolling restart' of the cluster for the use case of adding or removing a ZK server node. A rolling restart is pretty much like what you described for step 1 / 2 / 3, to minimize downtime, there are some standard practice to apply when doing the restart step 3: * Restart one server at a time. If you restart multiple servers at same time, you have the risk of bring down the cluster when there are not enough up servers to form a quorum, plus it will cause a lot of clients connecting to those restarting servers being disconnected and reconnecting which causes extra load to your cluster. * Restart from follower nodes, then finally restart leader if possible to minimize the number of times of leader election. During leader election ZK ensemble would not server clients, and after leader election it might take a while to form the quorum (servers sync up with leader) depends on the size of snapshot etc, and during this period ZK ensemble is also not available. So to minimize downtime, we need to minimize the chance of leader election. Worst case - every round we restart the leader and then ensemble would not be available until the rolling restart is finished. * Restart from lowest sid server then highest sid - there is a design in ZK server to minimize duplicated connections between servers so if a server A trying to connect to another server B find out A has smaller sid then B then A will drop connection. So if you restart server with smallest sid last, then that server might not able to join ensemble. On Thu, Oct 20, 2016 at 8:03 AM, Rakesh Radhakrishnan wrote: > Hi Steve, > > I'd suggest you to look at ZooKeeper-3.5.2 latest version and use dynamic > reconfig feature. This will help to resize(add/remove zk server) your > cluster without restarting entire cluster. > > Please refer the following links to understand more about the dynamic > reconfig feature:- > https://zookeeper.apache.org/doc/r3.5.2-alpha/zookeeperReconfig.html > http://www.slideshare.net/Hadoop_Summit/dynamic- > reconfiguration-of-zookeeper > > Regards, > Rakesh > > On Thu, Oct 20, 2016 at 3:19 AM, Steve Newman wrote: > > > Apologies for a basic question, but I've been researching and haven't > been > > able to find the answer online. > > > > What is the best way to add or remove replicas from a running ZooKeeper > > cluster, with minimal downtime? To add a replica, the naive answer would > > seem to be: > > > > 1. Prepare the new replica(s), i.e. install ZooKeeper and set up the > > configuration files. > > 2. Edit the configuration for all replicas (new and existing) to list the > > new replicas. > > 3. Restart all replicas. (Simultaneously? Or gradually, one at a time?) > > > > Is this the best way to do it? Step 3 seems scary in a production > cluster. > > Also, will the new replicas smoothly pick up the existing data, or is it > > better to seed them with a snapshot somehow? > > > > Similarly, the naive answer for removing a replica would seem to be: > > > > 1. Halt the ZooKeeper process. > > 2. Edit the configuration for all other replicas to remove the replica > > that's going away. > > 3. Restart all remaining replicas (one at a time?). > > > > Again, is this the best approach? > > > > Thanks, > > Steve > > > -- Cheers Michael. --94eb2c07c97230f558053f4e64c8--