Created
April 28, 2014 13:35
-
-
Save frankyaorenjie/11372221 to your computer and use it in GitHub Desktop.
zookeeper connect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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