public static void updateSharedConfig(CuratorFramework curator, Properties sharedProps) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); sharedProps.store(baos, "Shared java props"); CuratorUtil.putData(curator, ZookeeperPath.CONFIG_SHARED, baos.toByteArray(), CuratorUtil.NodeExistsPolicy.OVERWRITE); }
public static void updateObservers(CuratorFramework curator, Map<Column, ObserverConfiguration> colObservers, Map<Column, ObserverConfiguration> weakObservers) throws Exception { // TODO check that no workers are running... or make workers watch this znode String observerPath = ZookeeperPath.CONFIG_FLUO_OBSERVERS; try { curator.delete().deletingChildrenIfNeeded().forPath(observerPath); } catch (NoNodeException nne) { // it's ok if node doesn't exist } catch (Exception e) { logger.error("An error occurred deleting Zookeeper node. node=[" + observerPath + "], error=[" + e.getMessage() + "]"); throw new RuntimeException(e); } byte[] serializedObservers = serializeObservers(colObservers, weakObservers); CuratorUtil.putData(curator, observerPath, serializedObservers, CuratorUtil.NodeExistsPolicy.OVERWRITE); }
CuratorUtil.putData(rootCurator, appRootDir, new byte[0], CuratorUtil.NodeExistsPolicy.FAIL); CuratorUtil.putData(curator, ZookeeperPath.CONFIG, new byte[0], CuratorUtil.NodeExistsPolicy.FAIL); CuratorUtil.putData(curator, ZookeeperPath.CONFIG_ACCUMULO_TABLE, config.getAccumuloTable() .getBytes("UTF-8"), CuratorUtil.NodeExistsPolicy.FAIL); CuratorUtil.putData(curator, ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_NAME, accumuloInstanceName.getBytes("UTF-8"), CuratorUtil.NodeExistsPolicy.FAIL); CuratorUtil.putData(curator, ZookeeperPath.CONFIG_ACCUMULO_INSTANCE_ID, accumuloInstanceID.getBytes("UTF-8"), CuratorUtil.NodeExistsPolicy.FAIL); CuratorUtil.putData(curator, ZookeeperPath.CONFIG_FLUO_APPLICATION_ID, fluoApplicationID.getBytes("UTF-8"), CuratorUtil.NodeExistsPolicy.FAIL); CuratorUtil.putData(curator, ZookeeperPath.ORACLE_SERVER, new byte[0], CuratorUtil.NodeExistsPolicy.FAIL); CuratorUtil.putData(curator, ZookeeperPath.ORACLE_MAX_TIMESTAMP, new byte[] {'2'}, CuratorUtil.NodeExistsPolicy.FAIL); CuratorUtil.putData(curator, ZookeeperPath.ORACLE_GC_TIMESTAMP, new byte[] {'0'}, CuratorUtil.NodeExistsPolicy.FAIL);
CuratorUtil.putData(getAppCurator(config), ZookeeperPath.YARN_TWILL_ID, twillId.getBytes(StandardCharsets.UTF_8), CuratorUtil.NodeExistsPolicy.OVERWRITE); CuratorUtil.putData(getAppCurator(config), ZookeeperPath.YARN_APP_ID, appId.getBytes(StandardCharsets.UTF_8), CuratorUtil.NodeExistsPolicy.OVERWRITE);