|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectml.shifu.guagua.coordinator.zk.ZooKeeperUtils
public final class ZooKeeperUtils
ZooKeeperUtils is a helper used to start embed zookeeper server in CLI host.
For big data guagua application, independent zookeeper instance is recommended, embed server is for user easy to use guagua if there is no zookeeper server in hand.
| 字段摘要 | |
|---|---|
static int |
INITAL_ZK_PORT
Initial zookeeper port used for check valid zookeeper port. |
static int |
RETRY_COUNT
Client connection retry count |
static int |
TRY_PORT_COUNT
How many ports will be used to launch embed zookeeper server. |
| 方法摘要 | |
|---|---|
static void |
checkIfEmbedZooKeeperStarted(int embedZkClientPort)
Wait for a time period until zookeeper server is started. |
static boolean |
checkServers(String servers)
Check zookeeper servers, if one of them is alive, return true; |
static String |
findContainingJar(Class my_class)
Find a jar that contains a class of the same name, if any. |
static int |
getValidZooKeeperPort()
Check from DEFAULT_ZK_PORT to (DEFAULT_ZK_PORT + TRY_PORT_COUNT) to see if there is valid port to launch embed zookeeper server. |
static boolean |
isServerAlive(InetAddress host,
int port)
Check whether a server is alive. |
static boolean |
isServerAlive(String host,
int port)
Check whether a server is alive. |
static void |
populateZooKeeperConfFile(String fileName,
Map<String,String> props)
Create zoo.cfg file to launch a embed zookeeper server. |
static void |
prepZooKeeperConf(String fileName,
String clientPort)
Create zookeeper file with specified name and client port setting. |
static String |
startChildZooKeeperProcess(String zkJavaOpts)
Start embed zookeeper server in a child process. |
static int |
startEmbedZooKeeper()
Start embed zookeeper server in a daemon thread. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
public static final int RETRY_COUNT
public static final int TRY_PORT_COUNT
public static final int INITAL_ZK_PORT
| 方法详细信息 |
|---|
public static int getValidZooKeeperPort()
public static void populateZooKeeperConfFile(String fileName,
Map<String,String> props)
fileName - zookeeper conf file nameprops - key-value pairs for zookeeper configurations
public static boolean isServerAlive(InetAddress host,
int port)
host - the server hostport - the server port
public static boolean isServerAlive(String host,
int port)
host - the server hostport - the server port
public static void prepZooKeeperConf(String fileName,
String clientPort)
throws IOException
IOExceptionpublic static void checkIfEmbedZooKeeperStarted(int embedZkClientPort)
embedZkClientPort - the valid zookeeper client port
public static int startEmbedZooKeeper()
throws IOException
IOException
public static String startChildZooKeeperProcess(String zkJavaOpts)
throws IOException
IOExceptionpublic static String findContainingJar(Class my_class)
my_class - the class to find
public static boolean checkServers(String servers)
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||