Java Code Examples for org.apache.helix.model.HelixConfigScope.ConfigScopeProperty#PARTICIPANT
The following examples show how to use
org.apache.helix.model.HelixConfigScope.ConfigScopeProperty#PARTICIPANT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntegrationTest.java From helix with Apache License 2.0 | 6 votes |
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"))); FileUtils.deleteDirectory(new File(properties.get("file_store_dir"))); FileUtils.deleteDirectory(new File(properties.get("check_point_dir"))); new File(properties.get("change_log_dir")).mkdirs(); new File(properties.get("file_store_dir")).mkdirs(); new File(properties.get("check_point_dir")).mkdirs(); }
Example 2
Source File: ConfigAccessor.java From helix with Apache License 2.0 | 5 votes |
/** * Set multiple configs, creating them if they don't exist * @param scope scope specification of the entity set to query * (e.g. cluster, resource, participant, etc.) * @param keyValueMap configurations organized by their identifiers */ public void set(HelixConfigScope scope, Map<String, String> keyValueMap) { if (scope == null || scope.getType() == null || !scope.isFullKey()) { LOG.error("fail to set config. invalid config scope. Scope: {}.", scope); return; } String clusterName = scope.getClusterName(); if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) { throw new HelixException("fail to set config. cluster: " + clusterName + " is NOT setup."); } if (scope.getType() == ConfigScopeProperty.PARTICIPANT) { if (!ZKUtil.isInstanceSetup(_zkClient, scope.getClusterName(), scope.getParticipantName(), InstanceType.PARTICIPANT)) { throw new HelixException("fail to set config. instance: " + scope.getParticipantName() + " is NOT setup in cluster: " + clusterName); } } String mapKey = scope.getMapKey(); String zkPath = scope.getZkPath(); String id = zkPath.substring(zkPath.lastIndexOf('/') + 1); ZNRecord update = new ZNRecord(id); if (mapKey == null) { update.getSimpleFields().putAll(keyValueMap); } else { update.setMapField(mapKey, keyValueMap); } ZKUtil.createOrMerge(_zkClient, zkPath, update, true, true); }
Example 3
Source File: PropertyKey.java From helix with Apache License 2.0 | 4 votes |
/** * Get a property key associated with {@link InstanceConfig} * @return {@link PropertyKey} */ public PropertyKey instanceConfigs() { return new PropertyKey(CONFIGS, ConfigScopeProperty.PARTICIPANT, InstanceConfig.class, _clusterName, ConfigScopeProperty.PARTICIPANT.toString()); }
Example 4
Source File: PropertyKey.java From helix with Apache License 2.0 | 2 votes |
/** * Get a property key associated with {@link InstanceConfig} for a specific instance * @param instanceName * @return {@link PropertyKey} */ public PropertyKey instanceConfig(String instanceName) { return new PropertyKey(CONFIGS, ConfigScopeProperty.PARTICIPANT, InstanceConfig.class, _clusterName, ConfigScopeProperty.PARTICIPANT.toString(), instanceName); }