public static void uploadConfigsToZookeeper(String rootFilePath, CuratorFramework client) throws Exception { uploadConfigsToZookeeper(rootFilePath, rootFilePath, rootFilePath, rootFilePath, rootFilePath, client); }
/** * Uploads config to Zookeeper based on the specified rootPath and configuration type. The local * file and zookeeper paths are dynamically calculated based on the rootPath and config type. * When grabbing files from the local FS, the rootPath is used. When reading/writing to Zookeeper, * the path returned by * {@link org.apache.metron.common.configuration.ConfigurationType#getZookeeperRoot()} is used. * For example, when grabbing GLOBAL config from the local FS, the path is based on 'rootPath/.' * whereas PARSER would be based on 'rootPath/parsers'. * * @param rootFilePath base configuration path on the local FS * @param client zk client * @param type config type to upload configs for */ public static void uploadConfigsToZookeeper(String rootFilePath, CuratorFramework client, ConfigurationType type) throws Exception { uploadConfigsToZookeeper(rootFilePath, client, type, Optional.empty()); }
public void push(String inputDirStr, CuratorFramework client, ConfigurationType type, Optional<String> configName) throws Exception { final File inputDir = new File(inputDirStr); if (!inputDir.exists() || !inputDir.isDirectory()) { throw new IllegalStateException( "Input directory: " + inputDir + " does not exist or is not a directory."); } ConfigurationsUtils.uploadConfigsToZookeeper(inputDirStr, client, type, configName); }
public void push(String inputDirStr, CuratorFramework client) throws Exception { final File inputDir = new File(inputDirStr); if (!inputDir.exists() || !inputDir.isDirectory()) { throw new IllegalStateException("Input directory: " + inputDir + " does not exist or is not a directory."); } ConfigurationsUtils.uploadConfigsToZookeeper(inputDirStr, client); }
public static void uploadConfigsToZookeeper(String globalConfigPath, String parsersConfigPath, String enrichmentsConfigPath, String indexingConfigPath, String profilerConfigPath, String zookeeperUrl) throws Exception { try (CuratorFramework client = getClient(zookeeperUrl)) { client.start(); uploadConfigsToZookeeper(globalConfigPath, parsersConfigPath, enrichmentsConfigPath, indexingConfigPath, profilerConfigPath, client); } }
public void update() throws UnableToStartException { try { final String zookeeperUrl = connectionString == null?topologyProperties.getProperty(ZKServerComponent.ZOOKEEPER_PROPERTY):connectionString; if(globalConfigPath != null || parserConfigsPath != null || enrichmentConfigsPath != null || indexingConfigsPath != null || profilerConfigPath != null ) { uploadConfigsToZookeeper(globalConfigPath, parserConfigsPath, enrichmentConfigsPath, indexingConfigsPath, profilerConfigPath, zookeeperUrl); } for(Map.Entry<String, SensorParserConfig> kv : parserSensorConfigs.entrySet()) { writeSensorParserConfigToZookeeper(kv.getKey(), kv.getValue(), zookeeperUrl); } if(globalConfig.isPresent()) { writeGlobalConfigToZookeeper(globalConfig.get().getBytes(), zookeeperUrl); } if(postStartCallback.isPresent()) { postStartCallback.get().accept(this); } } catch (Exception e) { throw new UnableToStartException(e.getMessage(), e); } }