Examples of HelixConfigScopeBuilder


Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

  public void joinCluster() {
    // Read cluster config and see if instance can auto join the cluster
    boolean autoJoin = false;
    try {
      HelixConfigScope scope =
          new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(
              _manager.getClusterName()).build();
      autoJoin =
          Boolean.parseBoolean(_configAccessor.get(scope,
              ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN));
      LOG.info("instance: " + _instanceName + " auto-joining " + _clusterName + " is " + autoJoin);
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    // test config support
    // ConfigScope scope = new ConfigScopeBuilder().forCluster(clusterName)
    // .forResource("testResource").forPartition("testPartition").build();
    HelixConfigScope scope =
        new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION).forCluster(clusterName)
            .forResource("testResource").forPartition("testPartition").build();

    Map<String, String> properties = new HashMap<String, String>();
    properties.put("pKey1", "pValue1");
    properties.put("pKey2", "pValue2");
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    tool.addStateModelDef(clusterName, "MasterSlave", new StateModelDefinition(
        StateModelConfigGenerator.generateConfigForMasterSlave()));
    tool.addResource(clusterName, "test-db", 4, "MasterSlave");
    Map<String, String> resourceConfig = new HashMap<String, String>();
    resourceConfig.put("key1", "value1");
    tool.setConfig(new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE)
        .forCluster(clusterName).forResource("test-db").build(), resourceConfig);

    PropertyKey.Builder keyBuilder = new PropertyKey.Builder(clusterName);
    Assert.assertTrue(_gZkClient.exists(keyBuilder.idealStates("test-db").getPath()),
        "test-db ideal-state should exist");
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    HelixAdmin adminTool = admin.getClusterManagmentTool();
    // ConfigScope scope = new ConfigScopeBuilder().forCluster(clusterName)
    // .forResource("testResource").forPartition("testPartition").build();
    HelixConfigScope scope =
        new HelixConfigScopeBuilder(ConfigScopeProperty.PARTITION).forCluster(clusterName)
            .forResource("testResource").forPartition("testPartition").build();

    Map<String, String> properties = new HashMap<String, String>();
    properties.put("pKey1", "pValue1");
    properties.put("pKey2", "pValue2");
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

        1, // replicas
        "MasterSlave", true); // do rebalance

    // set cluster config
    HelixConfigScope scope =
        new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(clusterName).build();
    ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);

    // String pidFile = ScriptTestHelper.getPrefix() + ScriptTestHelper.INTEGRATION_LOG_DIR +
    // "/default/foo_{PARTITION_NAME}_pid.txt";
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    List<String> cmdConfigKeys = Arrays.asList(cmdKey, workingDirKey, timeoutKey, pidFileKey);

    // read command from resource-scope configures
    if (cmd == null) {
      HelixConfigScope resourceScope =
          new HelixConfigScopeBuilder(ConfigScopeProperty.RESOURCE).forCluster(clusterName)
              .forResource(message.getResourceName()).build();
      Map<String, String> cmdKeyValueMap =
          manager.getConfigAccessor().get(resourceScope, cmdConfigKeys);
      if (cmdKeyValueMap != null) {
        cmd = cmdKeyValueMap.get(cmdKey);
        workingDir = cmdKeyValueMap.get(workingDirKey);
        timeout = cmdKeyValueMap.get(timeoutKey);
        pidFile = cmdKeyValueMap.get(pidFileKey);
      }
    }

    // if resource-scope doesn't contain command, fall back to cluster-scope configures
    if (cmd == null) {
      HelixConfigScope clusterScope =
          new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(clusterName).build();
      Map<String, String> cmdKeyValueMap =
          manager.getConfigAccessor().get(clusterScope, cmdConfigKeys);

      if (cmdKeyValueMap != null) {
        cmd = cmdKeyValueMap.get(cmdKey);
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

  }

  private static void addConfiguration(ClusterSetup setup, String baseDir, String clusterName,
      String instanceName) throws IOException {
    Map<String, String> properties = new HashMap<String, String>();
    HelixConfigScopeBuilder builder = new HelixConfigScopeBuilder(ConfigScopeProperty.PARTICIPANT);
    HelixConfigScope instanceScope =
        builder.forCluster(clusterName).forParticipant(instanceName).build();
    properties.put("change_log_dir", baseDir + instanceName + "/translog");
    properties.put("file_store_dir", baseDir + instanceName + "/filestore");
    properties.put("check_point_dir", baseDir + instanceName + "/checkpoint");
    setup.getClusterManagementTool().setConfig(instanceScope, properties);
    FileUtils.deleteDirectory(new File(properties.get("change_log_dir")));
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

        HelixManagerFactory.getZKHelixManager(cluster, "service-discovery",
            InstanceType.ADMINISTRATOR, zkAddress);
    admin.connect();
    admin.getClusterManagmentTool().addCluster(cluster, false);
    HelixConfigScope scope =
        new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER).forCluster(cluster).build();

    Map<String, String> properties = new HashMap<String, String>();
    properties.put(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN, String.valueOf(true));
    admin.getClusterManagmentTool().setConfig(scope, properties);
    switch (mode) {
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    ZkClient zkClient = (ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);
    ClusterSetup setupTool = new ClusterSetup(zkClient);
    HelixAdmin admin = setupTool.getClusterManagementTool();
    ZNRecord record = new ZNRecord(scopeProperty + " Config");

    HelixConfigScope scope = new HelixConfigScopeBuilder(scopeProperty, keys).build();
    // List<String> configKeys = admin.getConfigKeys(scopeProperty, clusterName, keys);
    List<String> configKeys = admin.getConfigKeys(scope);
    record.setListField(scopeProperty.toString(), configKeys);

    representation =
View Full Code Here

Examples of org.apache.helix.model.builder.HelixConfigScopeBuilder

    ZkClient zkClient = (ZkClient) getContext().getAttributes().get(RestAdminApplication.ZKCLIENT);
    ClusterSetup setupTool = new ClusterSetup(zkClient);
    HelixAdmin admin = setupTool.getClusterManagementTool();
    ZNRecord record = new ZNRecord(scopeProperty + " Config");

    HelixConfigScope scope = new HelixConfigScopeBuilder(scopeProperty, keys).build();
    List<String> configKeys = admin.getConfigKeys(scope);
    Map<String, String> configs = admin.getConfig(scope, configKeys);
    record.setSimpleFields(configs);

    representation =
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.