helix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kishore g <g.kish...@gmail.com>
Subject Re: Is InstanceConfig object necessary?
Date Mon, 19 Aug 2013 18:16:55 GMT
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 <erwin@optinity.com> 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<String> 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
>

Mime
View raw message