Package org.apache.helix.manager.zk

Examples of org.apache.helix.manager.zk.ZKHelixAdmin.addInstance()


      int port = 12918 + i;
      InstanceConfig config = new InstanceConfig("localhost_" + port);
      config.setHostName("localhost");
      config.setPort(Integer.toString(port));
      config.setInstanceEnabled(true);
      admin.addInstance(clusterName, config);
    }

    // add resource "TestDB" which has 4 partitions and uses MasterSlave state model
    String resourceName = "TestDB";
    if (idealStateRebalancerMode == RebalanceMode.SEMI_AUTO
View Full Code Here


      List<String> nodes = admin.getInstancesInCluster(_clusterName);
      if (!nodes.contains(_instanceName)) {
        InstanceConfig config = new InstanceConfig(_instanceName);
        config.setHostName("localhost");
        config.setInstanceEnabled(true);
        admin.addInstance(_clusterName, config);
      }

      Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void run() {
View Full Code Here

      List<String> nodes = admin.getInstancesInCluster(clusterName);
      if (!nodes.contains("consumer_" + consumerId)) {
        InstanceConfig config = new InstanceConfig("consumer_" + consumerId);
        config.setHostName("localhost");
        config.setInstanceEnabled(true);
        admin.addInstance(clusterName, config);
      }

      // start consumer
      final Consumer consumer =
          new Consumer(zkAddr, clusterName, "consumer_" + consumerId, mqServer);
View Full Code Here

      String instance = "localhost_" + instances[i];
      InstanceConfig instanceConfig = new InstanceConfig(instance);
      instanceConfig.setHostName("localhost");
      instanceConfig.setPort("" + instances[i]);
      instanceConfig.setInstanceEnabled(true);
      admin.addInstance(clusterName, instanceConfig);
    }
  }

  protected void runPipeline(ClusterEvent event, Pipeline pipeline) {
    try {
View Full Code Here

    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);
    }
  }

  public void stop() {
    if (participantManager != null) {
View Full Code Here

      Assert
          .fail("Except fail to set participant-config because participant: localhost_12918 is not added to cluster yet");
    } catch (HelixException e) {
      // OK
    }
    admin.addInstance(clusterName, new InstanceConfig("localhost_12918"));

    try {
      configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
    } catch (Exception e) {
      Assert
View Full Code Here

      Assert
          .fail("Except fail to set participant-config because participant: localhost_12918 is not added to cluster yet");
    } catch (HelixException e) {
      // OK
    }
    admin.addInstance(clusterName, new InstanceConfig("localhost_12918"));

    try {
      configAccessor.set(participantScope, "participantConfigKey", "participantConfigValue");
    } catch (Exception e) {
      Assert
View Full Code Here

        String serverId = "localhost_" + port;
        InstanceConfig config = new InstanceConfig(serverId);
        config.setHostName("localhost");
        config.setPort(port);
        config.setInstanceEnabled(true);
        admin.addInstance(clusterName, config);
      }
      // add resource "repository" which has 1 partition
      String resourceName = DEFAULT_RESOURCE_NAME;
      admin.addResource(clusterName, resourceName, DEFAULT_PARTITION_NUMBER, DEFAULT_STATE_MODEL,
          RebalanceMode.SEMI_AUTO.toString());
View Full Code Here

      if (instanceConfig == null) {
        InstanceConfig config = new InstanceConfig(instanceName);
        config.setHostName("localhost");
        config.setInstanceEnabled(true);
        echo("Adding InstanceConfig:" + config);
        admin.addInstance(clusterName, config);
      }
    }

    public static void echo(Object obj) {
      LOGGER.info(obj);
View Full Code Here

      int port = 12918 + i;
      InstanceConfig instanceConfig = new InstanceConfig("localhost_" + port);
      instanceConfig.setHostName("localhost");
      instanceConfig.setPort("" + port);
      instanceConfig.setInstanceEnabled(true);
      admin.addInstance(clusterName, instanceConfig);
      // System.out.println("\t Added participant: " + instanceConfig.getInstanceName());
    }

    // construct ideal-state manually
    IdealState idealState = new IdealState(db);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.