Skip to content

Instantly share code, notes, and snippets.

@frankyaorenjie
Created April 28, 2014 13:35
Show Gist options
  • Save frankyaorenjie/11372221 to your computer and use it in GitHub Desktop.
Save frankyaorenjie/11372221 to your computer and use it in GitHub Desktop.
zookeeper connect
package com.google.code.or.Sample;
import org.apache.log4j.Logger;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;
import java.io.IOException;
/**
* Created by ybaniu on 14-4-28.
*/
public class ZkTest {
static Logger logger = Logger.getLogger(ZkTest.class);
public static void main(String[] args) throws IOException, KeeperException, InterruptedException {
ZooKeeper zk = new ZooKeeper("localhost:2181", 1000, null);
zk.create("/or", "123".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment