- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中ml.shifu.guagua.coordinator.zk.ZooKeeperUtils
类的一些代码示例,展示了ZooKeeperUtils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperUtils
类的具体详情如下:
包路径:ml.shifu.guagua.coordinator.zk.ZooKeeperUtils
类名称: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.
[中]ZooKeeperUtils是用于在CLI主机中启动嵌入zookeeper服务器的助手。
对于大数据guagua应用,建议使用独立的zookeeper实例,如果手头没有zookeeper服务器,则嵌入式服务器便于用户使用guagua。
代码示例来源:origin: ml.shifu/guagua-mapreduce
/**
* Start zookeeper server in thread of master node.
*/
private String startZookeeperServer(String localHostName) {
int embedZkClientPort = 0;
try {
embedZkClientPort = ZooKeeperUtils.startEmbedZooKeeper();
} catch (IOException e) {
throw new RuntimeException(e);
}
// 2. check if it is started.
ZooKeeperUtils.checkIfEmbedZooKeeperStarted(embedZkClientPort);
return localHostName + ":" + embedZkClientPort;
}
代码示例来源:origin: ShifuML/guagua
String zooKeeperWorkingDir = getZooKeeperWorkingDir();
boolean isSuccessful = createFolder(zooKeeperWorkingDir);
zooKeeperWorkingDir = getZooKeeperWorkingDir("zookeeper_" + System.currentTimeMillis());
createFolder(zooKeeperWorkingDir);
int validZkPort = getValidZooKeeperPort();
prepZooKeeperConf(zooKeeperWorkingDir, confName, validZkPort + "");
代码示例来源:origin: ShifuML/guagua
/**
* Retrieve zookeeper working folder.
*/
private static String getZooKeeperWorkingDir() {
return getUserDir() + File.separator + "zookeeper";
}
代码示例来源:origin: ShifuML/guagua
embedZkClientPort = ZooKeeperUtils.startEmbedZooKeeper();
} catch (IOException e) {
throw new RuntimeException(e);
ZooKeeperUtils.checkIfEmbedZooKeeperStarted(embedZkClientPort);
try {
embededZooKeeperServer = InetAddress.getLocalHost().getHostName() + ":" + embedZkClientPort;
"Zookeeper servers should be provided by '-z' parameter with non-empty value.");
if(ZooKeeperUtils.checkServers(zkServers)) {
conf.set(GuaguaConstants.GUAGUA_ZK_SERVERS, zkServers.trim());
} else {
代码示例来源:origin: ShifuML/guagua
String zooKeeperWorkingDir = getZooKeeperWorkingDir();
boolean isSuccessful = createFolder(zooKeeperWorkingDir);
zooKeeperWorkingDir = getZooKeeperWorkingDir("zookeeper_" + System.currentTimeMillis());
createFolder(zooKeeperWorkingDir);
int validZkPort = getValidZooKeeperPort();
prepZooKeeperConf(zooKeeperWorkingDir, confName, validZkPort + "");
commandList.add(findContainingJar(Log4jLoggerAdapter.class) + ":" + findContainingJar(Logger.class) + ":"
+ findContainingJar(org.apache.log4j.Logger.class) + ":" + findContainingJar(ZooKeeperUtils.class)
+ ":" + findContainingJar(QuorumPeerMain.class));
commandList.add(ZooKeeperMain.class.getName());
commandList.add(confName);
String hostname = getLocalHostName();
if(isServerAlive(hostname, validZkPort)) {
return hostname + ":" + validZkPort;
} else {
代码示例来源:origin: ShifuML/guagua
@Override
public void preApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
String zkServers = context.getProps().getProperty(GuaguaConstants.GUAGUA_ZK_SERVERS);
if(zkServers == null || zkServers.length() == 0 || !ZooKeeperUtils.checkServers(zkServers)) {
this.isNeedStartZookeeper = true;
if(fileSystem == null) {
String zookeeperServer;
try {
zookeeperServer = ZooKeeperUtils.startChildZooKeeperProcess(zkJavaOpts);
} catch (IOException e) {
LOG.error("Error in start child zookeeper process.", e);
代码示例来源:origin: ml.shifu/guagua-mapreduce
@Override
public void preApplication(WorkerContext<MASTER_RESULT, WORKER_RESULT> context) {
String zkServers = context.getProps().getProperty(GuaguaConstants.GUAGUA_ZK_SERVERS);
if(zkServers == null || zkServers.length() == 0 || !ZooKeeperUtils.checkServers(zkServers)) {
this.sleepTime = NumberFormatUtils.getLong(
context.getProps().getProperty(GuaguaConstants.GUAGUA_COORDINATOR_SLEEP_UNIT), WAIT_SLOT_MILLS);
代码示例来源:origin: ShifuML/guagua
/**
* Create zookeeper file with specified name and client port setting.
*/
public static void prepZooKeeperConf(String zkFolder, String fileName, String clientPort) throws IOException {
Map<String, String> props = new HashMap<String, String>();
String dataDir = zkFolder + File.separator + "zkdata";
createFolder(dataDir);
String dataLogDir = zkFolder + File.separator + "zklog";
createFolder(dataLogDir);
props.put("tickTime", "2000");
props.put("initLimit", "10");
props.put("syncLimit", "5");
props.put("dataDir", dataDir);
props.put("dataLogDir", dataLogDir);
props.put("clientPort", clientPort);
props.put("minSessionTimeout", "10000");
props.put("maxSessionTimeout", "30000000");
// The number of snapshots to retain in dataDir
props.put("autopurge.snapRetainCount", "3");
// Purge task interval in hours set to "0" to disable auto purge feature
props.put("autopurge.purgeInterval", "1");
populateZooKeeperConfFile(fileName, props);
}
代码示例来源:origin: ml.shifu/guagua-yarn
embedZkClientPort = ZooKeeperUtils.startEmbedZooKeeper();
} catch (IOException e) {
throw new RuntimeException(e);
ZooKeeperUtils.checkIfEmbedZooKeeperStarted(embedZkClientPort);
try {
embededZooKeeperServer = InetAddress.getLocalHost().getHostName() + ":" + embedZkClientPort;
"Zookeeper servers should be provided by '-z' parameter with non-empty value.");
if(ZooKeeperUtils.checkServers(zkServers)) {
conf.set(GuaguaConstants.GUAGUA_ZK_SERVERS, zkServers.trim());
} else {
代码示例来源:origin: ml.shifu/guagua-yarn
@Override
public void preApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
String zkServers = context.getProps().getProperty(GuaguaConstants.GUAGUA_ZK_SERVERS);
if(zkServers == null || zkServers.length() == 0 || !ZooKeeperUtils.checkServers(zkServers)) {
this.isNeedStartZookeeper = true;
if(fileSystem == null) {
String zookeeperServer;
try {
zookeeperServer = ZooKeeperUtils.startChildZooKeeperProcess(zkJavaOpts);
} catch (IOException e) {
LOG.error("Error in start child zookeeper process.", e);
代码示例来源:origin: ShifuML/guagua
@Override
public void preApplication(WorkerContext<MASTER_RESULT, WORKER_RESULT> context) {
String zkServers = context.getProps().getProperty(GuaguaConstants.GUAGUA_ZK_SERVERS);
if(zkServers == null || zkServers.length() == 0 || !ZooKeeperUtils.checkServers(zkServers)) {
this.sleepTime = NumberFormatUtils.getLong(
context.getProps().getProperty(GuaguaConstants.GUAGUA_COORDINATOR_SLEEP_UNIT), WAIT_SLOT_MILLS);
代码示例来源:origin: ml.shifu/guagua-mapreduce
embedZkClientPort = ZooKeeperUtils.startEmbedZooKeeper();
} catch (IOException e) {
throw new RuntimeException(e);
ZooKeeperUtils.checkIfEmbedZooKeeperStarted(embedZkClientPort);
try {
embededZooKeeperServer = InetAddress.getLocalHost().getHostName() + ":" + embedZkClientPort;
"Zookeeper servers should be provided by '-z' parameter with non-empty value.");
if(ZooKeeperUtils.checkServers(zkServers)) {
conf.set(GuaguaConstants.GUAGUA_ZK_SERVERS, zkServers.trim());
} else {
代码示例来源:origin: ShifuML/guagua
/**
* Start zookeeper server in thread of master node.
*/
private String startZookeeperServer(String localHostName) {
int embedZkClientPort = 0;
try {
embedZkClientPort = ZooKeeperUtils.startEmbedZooKeeper();
} catch (IOException e) {
throw new RuntimeException(e);
}
// 2. check if it is started.
ZooKeeperUtils.checkIfEmbedZooKeeperStarted(embedZkClientPort);
return localHostName + ":" + embedZkClientPort;
}
代码示例来源:origin: ml.shifu/guagua-mapreduce
@Override
public void preApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
String zkServers = context.getProps().getProperty(GuaguaConstants.GUAGUA_ZK_SERVERS);
if(zkServers == null || zkServers.length() == 0 || !ZooKeeperUtils.checkServers(zkServers)) {
this.isNeedStartZookeeper = true;
if(fileSystem == null) {
String zookeeperServer;
try {
zookeeperServer = ZooKeeperUtils.startChildZooKeeperProcess(zkJavaOpts);
} catch (IOException e) {
LOG.error("Error in start child zookeeper process.", e);
代码示例来源:origin: ShifuML/guagua
@Override
public void preApplication(WorkerContext<MASTER_RESULT, WORKER_RESULT> context) {
String zkServers = context.getProps().getProperty(GuaguaConstants.GUAGUA_ZK_SERVERS);
if(zkServers == null || zkServers.length() == 0 || !ZooKeeperUtils.checkServers(zkServers)) {
this.sleepTime = NumberFormatUtils.getLong(
context.getProps().getProperty(GuaguaConstants.GUAGUA_COORDINATOR_SLEEP_UNIT), WAIT_SLOT_MILLS);
代码示例来源:origin: ShifuML/guagua
/**
* Retrieve zookeeper working folder.
*/
private static String getZooKeeperWorkingDir(String subFolder) {
return getUserDir() + File.separator + subFolder;
}
代码示例来源:origin: ShifuML/guagua
embedZkClientPort = ZooKeeperUtils.startEmbedZooKeeper();
} catch (IOException e) {
throw new RuntimeException(e);
ZooKeeperUtils.checkIfEmbedZooKeeperStarted(embedZkClientPort);
try {
embededZooKeeperServer = InetAddress.getLocalHost().getHostName() + ":" + embedZkClientPort;
"Zookeeper servers should be provided by '-z' parameter with non-empty value.");
if(ZooKeeperUtils.checkServers(zkServers)) {
conf.set(GuaguaConstants.GUAGUA_ZK_SERVERS, zkServers.trim());
} else {
代码示例来源:origin: ml.shifu/guagua-yarn
/**
* Start zookeeper server in thread of master node.
*/
private String startZookeeperServer(String localHostName) {
int embedZkClientPort = 0;
try {
embedZkClientPort = ZooKeeperUtils.startEmbedZooKeeper();
} catch (IOException e) {
throw new RuntimeException(e);
}
// 2. check if it is started.
ZooKeeperUtils.checkIfEmbedZooKeeperStarted(embedZkClientPort);
return localHostName + ":" + embedZkClientPort;
}
代码示例来源:origin: ShifuML/guagua
@Override
public void preApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
String zkServers = context.getProps().getProperty(GuaguaConstants.GUAGUA_ZK_SERVERS);
if(zkServers == null || zkServers.length() == 0 || !ZooKeeperUtils.checkServers(zkServers)) {
this.isNeedStartZookeeper = true;
if(fileSystem == null) {
String zookeeperServer;
try {
zookeeperServer = ZooKeeperUtils.startChildZooKeeperProcess(zkJavaOpts);
} catch (IOException e) {
LOG.error("Error in start child zookeeper process.", e);
代码示例来源:origin: ml.shifu/guagua-yarn
@Override
public void preApplication(WorkerContext<MASTER_RESULT, WORKER_RESULT> context) {
String zkServers = context.getProps().getProperty(GuaguaConstants.GUAGUA_ZK_SERVERS);
if(zkServers == null || zkServers.length() == 0 || !ZooKeeperUtils.checkServers(zkServers)) {
this.sleepTime = NumberFormatUtils.getLong(
context.getProps().getProperty(GuaguaConstants.GUAGUA_COORDINATOR_SLEEP_UNIT), WAIT_SLOT_MILLS);
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getSubstitutedPath()方法的一些代码示例,展示了ZooKeeperUtils.
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.setData()方法的一些代码示例,展示了ZooKeeperUtils.setData()的具
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.deleteSafe()方法的一些代码示例,展示了ZooKeeperUtils.deleteSa
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getContainerLogin()方法的一些代码示例,展示了ZooKeeperUtils.g
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getSubstitutedData()方法的一些代码示例,展示了ZooKeeperUtils.
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.isContainerLogin()方法的一些代码示例,展示了ZooKeeperUtils.is
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getData()方法的一些代码示例,展示了ZooKeeperUtils.getData()的具
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.create()方法的一些代码示例,展示了ZooKeeperUtils.create()的具体用
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getStringData()方法的一些代码示例,展示了ZooKeeperUtils.getSt
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getByteData()方法的一些代码示例,展示了ZooKeeperUtils.getByte
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getAllChildren()方法的一些代码示例,展示了ZooKeeperUtils.getA
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.generateContainerToken()方法的一些代码示例,展示了ZooKeeperUt
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getChildrenSafe()方法的一些代码示例,展示了ZooKeeperUtils.get
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.delete()方法的一些代码示例,展示了ZooKeeperUtils.delete()的具体用
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getContainerTokens()方法的一些代码示例,展示了ZooKeeperUtils.
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.exists()方法的一些代码示例,展示了ZooKeeperUtils.exists()的具体用
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.createDefault()方法的一些代码示例,展示了ZooKeeperUtils.creat
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.getChildren()方法的一些代码示例,展示了ZooKeeperUtils.getChil
本文整理了Java中com.twitter.common.zookeeper.ZooKeeperUtils.ensurePath()方法的一些代码示例,展示了ZooKeeperUtils.ensure
本文整理了Java中org.apache.flink.runtime.util.ZooKeeperUtils.createCheckpointIDCounter()方法的一些代码示例,展示了ZooKe
我是一名优秀的程序员,十分优秀!