Return-Path: X-Original-To: apmail-zookeeper-user-archive@www.apache.org Delivered-To: apmail-zookeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2005F10DCE for ; Tue, 26 Nov 2013 22:59:17 +0000 (UTC) Received: (qmail 54596 invoked by uid 500); 26 Nov 2013 22:59:16 -0000 Delivered-To: apmail-zookeeper-user-archive@zookeeper.apache.org Received: (qmail 54557 invoked by uid 500); 26 Nov 2013 22:59:16 -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 54545 invoked by uid 99); 26 Nov 2013 22:59:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Nov 2013 22:59:16 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of shralex@gmail.com designates 209.85.223.170 as permitted sender) Received: from [209.85.223.170] (HELO mail-ie0-f170.google.com) (209.85.223.170) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Nov 2013 22:59:11 +0000 Received: by mail-ie0-f170.google.com with SMTP id qd12so10688266ieb.15 for ; Tue, 26 Nov 2013 14:58:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=6UJrkMcEDZfUD/M6OoUn7y82xd9hhrxD3FYEqR8i8Hs=; b=B4Sjn1OTrxK7kvFWRCI1vDHQCXCRRCOUXJMB9SzycmX6dMgIVpynFsMsCOpsSBxb3+ Btb3Y1RBkKZz56Zz7yB2gWUy/QIxErPMwYGElN6m4Ffx6in0fs51K0xtuuEVXZAnWf+j QyDZUeeEbrvC3gZFAjGANYWKLfrTYGX2pm7ZEIpJJvxCwAoQbKfCTKBjuwr2Qnk26b48 7yv00TumrW/AhgxgD97yF4V3SjfiLQN6UH9OP7eyZJumgj0g9TJjsE8tkFLk40fwx/YY 0tcHMjf/IpLX2frTve05t4uQMYcS/TDXco7q+haxBD4qgl0gkSXUFqAZNV30Fx29PGbH axiQ== X-Received: by 10.42.62.196 with SMTP id z4mr3295089ich.49.1385506731266; Tue, 26 Nov 2013 14:58:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.64.250.225 with HTTP; Tue, 26 Nov 2013 14:58:31 -0800 (PST) In-Reply-To: References: <1385456084052-7579367.post@n2.nabble.com> <1385504882746-7579376.post@n2.nabble.com> From: Alexander Shraer Date: Tue, 26 Nov 2013 14:58:31 -0800 Message-ID: Subject: Re: Ensure there is one master To: "user@zookeeper.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Cameron's solution basically relies on additional timing assumptions as Maciej mentions in his question. One more thing you could do is to implement increasing generation ids for masters, and have clients in your system reject commands from a master if they already know that a master with a higher generation id was elected (either because they saw a command from the new master or because they got a notification from ZK). This way each client can only have a single master and goes forward in time. Alex On Tue, Nov 26, 2013 at 2:34 PM, Cameron McKenzie wrote: > If I'm understanding your question correctly, you're worried that when the > current 'master' loses its connection to ZooKeeper, a new 'master' will be > elected and you will have 2 'master' nodes at the same time. As soon as you > lose a connection to ZooKeeper there are no guarantees about any of the > state that you're determining from it. When you lose the ZooKeeper > connection, your 'master' must assume that it is no longer a 'master' node > until it reconnects to ZooKeeper, at which point it will be able to work > out what's going on. > > If you look at Apache Curator, its implementation of the Leader latch > recipe handles this loss of connection and reestablishment. > > cheers > Cam > > > On Wed, Nov 27, 2013 at 9:28 AM, ms209495 wrote: > >> Thanks for the reply. I want to clarify one thing. >> I think about a System of 20 nodes, that uses ZooKeeper of 3 nodes. >> I think about master election among these 20 nodes, that do not run >> consensus, but they use zookeeper service for master election. >> I used 'leader' term for a leeder in Zookeeper (among 3 nodes), and >> 'master' >> term for master in the System (20 nodes). >> Solution is described here: >> http://zookeeper.apache.org/doc/trunk/recipes.html#sc_leaderElection (I >> would name it 'master' election, not 'leader' election), but I doubt if it >> works reliable without additional timing assumptions as I described in my >> previous post. >> Please consider my previous post in the context of the System that uses >> Zookeeper (not ZooKeeper itself). >> >> >> >> -- >> View this message in context: >> http://zookeeper-user.578899.n2.nabble.com/Ensure-there-is-one-master-tp7579367p7579376.html >> Sent from the zookeeper-user mailing list archive at Nabble.com. >>