public ZKStateStorage(Map<String, Object> conf, Map<String, Object> authConf, ClusterStateContext context) throws Exception { this.conf = conf; this.authConf = authConf; if (context.getDaemonType().equals(DaemonType.NIMBUS)) { this.isNimbus = true; } // just mkdir STORM_ZOOKEEPER_ROOT dir CuratorFramework zkTemp = mkZk(context.getDaemonType()); String rootPath = String.valueOf(conf.get(Config.STORM_ZOOKEEPER_ROOT)); ClientZookeeper.mkdirs(zkTemp, rootPath, context.getDefaultZkAcls()); zkTemp.close(); active = new AtomicBoolean(true); zkWriter = mkZk(new ZkWatcherCallBack(), context.getDaemonType()); if (isNimbus) { zkReader = mkZk(new ZkWatcherCallBack(), context.getDaemonType()); } else { zkReader = zkWriter; } }
@Override public void addPrivateWorkerKey(WorkerTokenServiceType type, String topologyId, long keyVersion, PrivateWorkerKey key) { assert context.getDaemonType() == DaemonType.NIMBUS; stateStorage.mkdirs(ClusterUtils.SECRET_KEYS_SUBTREE, defaultAcls); List<ACL> secretAcls = context.getZkSecretAcls(type); String path = ClusterUtils.secretKeysPath(type, topologyId, keyVersion); LOG.info("Storing private key for {} connecting to a {} at {} with ACL {}", topologyId, type, path, secretAcls); stateStorage.set_data(path, Utils.serialize(key), secretAcls); }
public ZKStateStorage(Map<Object, Object> conf, Map authConf, List<ACL> acls, ClusterStateContext context) throws Exception { this.conf = conf; this.authConf = authConf; if (context.getDaemonType().equals(DaemonType.NIMBUS)) this.isNimbus = true; // just mkdir STORM_ZOOKEEPER_ROOT dir CuratorFramework zkTemp = mkZk(acls); String rootPath = String.valueOf(conf.get(Config.STORM_ZOOKEEPER_ROOT)); Zookeeper.mkdirs(zkTemp, rootPath, acls); zkTemp.close(); active = new AtomicBoolean(true); zkWriter = mkZk(acls, new ZkWatcherCallBack()); if (isNimbus) { zkReader = mkZk(acls, new ZkWatcherCallBack()); } else { zkReader = zkWriter; } }