So we will add this method. Thanks a lot. On Aug 19, 2013 9:17 PM, "kishore g" <[email protected]> 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 <[email protected]> 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 >> > >
