/** * State store that stores instances of {@link State}s in a ZooKeeper-backed {@link HelixPropertyStore} * storeRootDir will be created when the first entry is written if it does not exist * @param connectString ZooKeeper connect string * @param storeRootDir The root directory for the state store * @param compressedValues should values be compressed for storage? * @param stateClass The type of state being stored * @throws IOException */ public ZkStateStore(String connectString, String storeRootDir, boolean compressedValues, Class<T> stateClass) throws IOException { this.compressedValues = compressedValues; this.stateClass = stateClass; ZkSerializer serializer = new ByteArraySerializer(); propStore = new ZkHelixPropertyStore<byte[]>(connectString, serializer, storeRootDir); }
public ZKDumper(String zkAddress) { client = new ZkClient(zkAddress, ZkClient.DEFAULT_CONNECTION_TIMEOUT); ZkSerializer zkSerializer = new ByteArraySerializer(); client.setZkSerializer(zkSerializer); filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return !name.startsWith("."); } }; }
dstClient = new ZkClient(srcZkAddr, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ByteArraySerializer()); } else { srcClient = new ZkClient(srcZkAddr, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ByteArraySerializer()); dstClient = new ZkClient(dstZkAddr, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ByteArraySerializer());
public ZKDumper(String zkAddress) { client = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(zkAddress)); ZkSerializer zkSerializer = new ByteArraySerializer(); client.setZkSerializer(zkSerializer); filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return !name.startsWith("."); } }; }
try { if (srcZkAddr.equals(dstZkAddr)) { clientConfig.setZkSerializer(new ByteArraySerializer()); srcClient = dstClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(srcZkAddr), clientConfig); } else { clientConfig.setZkSerializer(new ByteArraySerializer()); srcClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(srcZkAddr), clientConfig); clientConfig.setZkSerializer(new ByteArraySerializer()); dstClient = SharedZkClientFactory.getInstance() .buildZkClient(new HelixZkClient.ZkConnectionConfig(dstZkAddr), clientConfig);
public synchronized void start() throws Exception { LOG.info("helixAdminWebApp starting"); if (_component == null) { _zkClient = new ZkClient(_zkServerAddress, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer()); _rawZkClient = new ZkClient(_zkServerAddress, ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ByteArraySerializer()); _component = new Component(); _component.getServers().add(Protocol.HTTP, _helixAdminPort); Context applicationContext = _component.getContext().createChildContext(); applicationContext.getAttributes() .put(RestAdminApplication.ZKSERVERADDRESS, _zkServerAddress); applicationContext.getAttributes().put(RestAdminApplication.PORT, "" + _helixAdminPort); applicationContext.getAttributes().put(RestAdminApplication.ZKCLIENT, _zkClient); applicationContext.getAttributes().put(ResourceUtil.ContextKey.RAW_ZKCLIENT.toString(), _rawZkClient); _adminApp = new RestAdminApplication(applicationContext); // Attach the application to the component and start it _component.getDefaultHost().attach(_adminApp); _component.start(); } LOG.info("helixAdminWebApp started on port: " + _helixAdminPort); }