Return-Path: X-Original-To: apmail-helix-user-archive@minotaur.apache.org Delivered-To: apmail-helix-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D2A8F10634 for ; Mon, 19 Aug 2013 19:10:34 +0000 (UTC) Received: (qmail 94527 invoked by uid 500); 19 Aug 2013 19:10:34 -0000 Delivered-To: apmail-helix-user-archive@helix.apache.org Received: (qmail 94454 invoked by uid 500); 19 Aug 2013 19:10:33 -0000 Mailing-List: contact user-help@helix.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@helix.incubator.apache.org Delivered-To: mailing list user@helix.incubator.apache.org Received: (qmail 94444 invoked by uid 99); 19 Aug 2013 19:10:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Aug 2013 19:10:33 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of erwin.karbasi@gmail.com designates 74.125.82.170 as permitted sender) Received: from [74.125.82.170] (HELO mail-we0-f170.google.com) (74.125.82.170) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Aug 2013 19:10:28 +0000 Received: by mail-we0-f170.google.com with SMTP id w62so1398096wes.29 for ; Mon, 19 Aug 2013 12:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=tMRHMiu3PBX9eVszABOxc7+8c691NcfPWAz1LYGc+Q0=; b=QHu5NGSzdm8JDY7jHwcaF6yE5YVYt0Mz88/HzjQZzw/BHqzRXTYAEmnpCG6aZJhHC/ PmEUj4glUXJm7Q7mp7KBRXOlIb5gdaIK/cwoNY/Sey5gKEKfFWO0VaCh1GhRJL1HGuXv py9eBPnKHRA3tNrXsH5dF1Dev2jVdbMRpTvXe4snTZP5IuatTmqsupHuSBFaqAHd2XeF sHQCX5umHJsefehSb1to5mhMLWztSbctgO1Pi2UZem0LXGc4UZOhzjPeFtCIsI9a/5rL PlbWdN/+wuqanVeeZ1rs3DZBe+B/7WNaCAEQwq6KGtoweVi1Jc0cBWo3ZfadLwzD1eGK FS4w== MIME-Version: 1.0 X-Received: by 10.180.91.6 with SMTP id ca6mr9576032wib.4.1376939407205; Mon, 19 Aug 2013 12:10:07 -0700 (PDT) Sender: erwin.karbasi@gmail.com Received: by 10.216.191.18 with HTTP; Mon, 19 Aug 2013 12:10:07 -0700 (PDT) Received: by 10.216.191.18 with HTTP; Mon, 19 Aug 2013 12:10:07 -0700 (PDT) In-Reply-To: References: Date: Mon, 19 Aug 2013 22:10:07 +0300 X-Google-Sender-Auth: hCX_R0W1C4FRKgq0hhuQDiBZKGs Message-ID: Subject: Re: Is InstanceConfig object necessary? From: Erwin Karbasi To: user Content-Type: multipart/alternative; boundary=f46d043c7e0c3e6aa004e451b0a6 X-Virus-Checked: Checked by ClamAV on apache.org --f46d043c7e0c3e6aa004e451b0a6 Content-Type: text/plain; charset=ISO-8859-1 So we will add this method. Thanks a lot. On Aug 19, 2013 9:17 PM, "kishore g" wrote: > Hi Erwin, > > In the configureInstance method, " helixAdmin.addInstance(clusterName, > config); " is the most important line. This registers the participant in > the cluster. The reason we made this mandatory by default is to disallow > rogue nodes to join the cluster (mostly because of misconfiguration). > Without invoking this, HelixManagerFactory.getZKHelixManager(clusterName, > instanceName, InstanceType.PARTICIPANT, zkAddress); > > If you want to avoid calling this method, then you need to set a Helix > property ALLOW_PARTICIPANT_AUTO_JOIN to true. Once you set that you can > skip calling configureInstance method. > > thanks, > Kishore G > > > > > > On Sun, Aug 18, 2013 at 8:42 AM, Erwin Karbasi wrote: > >> Hey Guys, >> >> We have used the "Distributed lock manager" sample as our resource for >> building Leader election mechanism. >> >> We have one partition, each JVM (participant) is Leader or Standby, that >> is, one JVM do the job. >> >> In above usage we didn't implement InstanceConfig object but just >> ParticipantManager for each participant process, that is, the following >> start method of LockProcess missing the configureInstance(String >> instanceName) method. >> >> public void start() throws Exception >> { >> System.out.println("STARTING "+ instanceName +"\n"); >> configureInstance(instanceName); >> >> participantManager = >> HelixManagerFactory.getZKHelixManager(clusterName, instanceName, >> InstanceType.PARTICIPANT, zkAddress); >> >> participantManager.getStateMachineEngine().registerStateModelFactory("LeaderStandby", >> new LockFactory()); >> participantManager.connect(); >> >> if (startController) >> { >> startController(); >> } >> System.out.println("STARTED "+ instanceName+"\n"); >> >> } >> >> >> private void configureInstance(String instanceName) >> { >> ZKHelixAdmin helixAdmin = new ZKHelixAdmin(zkAddress); >> >> List instancesInCluster = helixAdmin >> .getInstancesInCluster(clusterName); >> if (instancesInCluster == null || >> !instancesInCluster.contains(instanceName)) >> { >> InstanceConfig config = new InstanceConfig(instanceName); >> config.setHostName("localhost"); >> config.setPort("12000"); >> helixAdmin.addInstance(clusterName, config); >> } >> } >> >> How above implementation without the InstanceConfig can effect, what we >> lose if we don't use InstanceConfig and whether it can works at all? >> >> Thanks in advance, >> Erwin Karbasi >> AT&T, Senior Software Architect >> > > --f46d043c7e0c3e6aa004e451b0a6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

So we will add this method.

Thanks a lot.

On Aug 19, 2013 9:17 PM, "kishore g" &= lt;g.kishore@gmail.com> wrote= :
Hi Erwin,

In the configureInstance meth= od,=A0=A0"= =A0 =A0= helixAdmin.addInstance(clusterName, config); " is the most important line. Thi= s registers the participant in the cluster. The reason we made this mandato= ry by default is to disallow rogue nodes to join the cluster (mostly becaus= e of misconfiguration). Without invoking this,=A0HelixManagerFactory.getZKHelixManager(clus= terName, instanceName, InstanceType.PARTICIPANT, zkAddress);

If = you want to avoid calling this method, then you need to set a Helix propert= y=A0ALLOW_PARTICIPANT_AUTO_JOIN to true. Once you set that you can s= kip calling configureInstance method.

tha= nks,
Kishore G=A0
=A0 =A0=A0




On Sun, Aug 1= 8, 2013 at 8:= 42 AM, Erwin Karbasi <erwin@optinity.com> wrote:
Hey Guys,

We have used the "Distributed lock manager&q= uot; sample as our resource for building Leader election mechanism.

We have one partition, each JVM (participant) is Leader or Standb= y, that is, one JVM do the job.

In above usage we didn't implement InstanceConfig object but = just ParticipantManager for each participant process, that is, the followin= g start method of LockProcess missing the configureInstance(String instance= Name) method.

=A0 public void start() throws Exception
=A0 {
=A0=A0=A0 System.o= ut.println("STARTING "+ instanceName +"\n");
=A0=A0= =A0 configureInstance(instanceName);
=A0=A0=A0
=A0=A0=A0 participant= Manager =3D HelixManagerFactory.getZKHelixManager(clusterName, instanceName= , InstanceType.PARTICIPANT, zkAddress);
=A0=A0=A0 participantManager.getStateMachineEngine().registerStateModelFact= ory("LeaderStandby", new LockFactory());
=A0=A0=A0 participan= tManager.connect();
=A0=A0=A0
=A0=A0=A0 if (startController)
=A0= =A0=A0 {
=A0=A0=A0=A0=A0 startController();
=A0=A0=A0 }
=A0=A0=A0 System.out.println("STARTED "+ instanceN= ame+"\n");

=A0 }


=A0 private void configureInst= ance(String instanceName)
=A0 {
=A0=A0=A0 ZKHelixAdmin helixAdmin =3D= new ZKHelixAdmin(zkAddress);

=A0=A0=A0 List<String> instancesInCluster =3D helixAdmin
=A0= =A0=A0=A0=A0=A0=A0 .getInstancesInCluster(clusterName);
=A0=A0=A0 if (in= stancesInCluster =3D=3D null || !instancesInCluster.contains(instanceName))=
=A0=A0=A0 {
=A0=A0=A0=A0=A0 InstanceConfig config =3D new InstanceCo= nfig(instanceName);
=A0=A0=A0=A0=A0 config.setHostName("localhost");
=A0=A0=A0=A0= =A0 config.setPort("12000");
=A0=A0=A0=A0=A0 helixAdmin.addIns= tance(clusterName, config);
=A0=A0=A0 }
=A0 }

How = above implementation without the InstanceConfig can effect, what we lose if= we don't use InstanceConfig and whether it can works at all?

Thanks in advance,
Erwin Karbasi
AT&T, Senior Software Architect

--f46d043c7e0c3e6aa004e451b0a6--