gpt4 book ai didi

ml.shifu.guagua.hadoop.ZooKeeperMasterInterceptor类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 10:13:16 28 4
gpt4 key购买 nike

本文整理了Java中ml.shifu.guagua.hadoop.ZooKeeperMasterInterceptor类的一些代码示例,展示了ZooKeeperMasterInterceptor类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperMasterInterceptor类的具体详情如下:
包路径:ml.shifu.guagua.hadoop.ZooKeeperMasterInterceptor
类名称:ZooKeeperMasterInterceptor

ZooKeeperMasterInterceptor介绍

[英]To start zookeeper instance in cluster environment.

Compare with start zookeeper instance in client process, ZooKeeperMasterInterceptor can be used in cluster and even to start zookeeper ensemble in cluster to void single point failure issue.
[中]在集群环境中启动zookeeper实例。
与客户端进程中启动zookeeper实例相比,ZooKeeperMasterInterceptor可以在集群中使用,甚至可以在集群中启动zookeeper集成,避免单点故障问题。

代码示例

代码示例来源:origin: ml.shifu/guagua-mapreduce

@Override
public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
  if(this.isNeedStartZookeeper) {
    try {
      this.fileSystem.delete(new Path(this.getZookeeperServerFolder(context)), true);
    } catch (IOException e) {
      throw new GuaguaRuntimeException(e);
    }
  }
}

代码示例来源:origin: ShifuML/guagua

String localHostName = getLocalHostName();
LOG.warn("No valid zookeeper servers, start one in ZooKeeperMaster {}", localHostName);
  zookeeperServer = startZookeeperServer(localHostName);
  LOG.info("Zookeeper server is stated with thread: {}", zookeeperServer);
} else {
writeServerInfoToHDFS(context, zookeeperServer);

代码示例来源:origin: ml.shifu/guagua-mapreduce

String localHostName = getLocalHostName();
LOG.warn("No valid zookeeper servers, start one in ZooKeeperMaster {}", localHostName);
  zookeeperServer = startZookeeperServer(localHostName);
  LOG.info("Zookeeper server is stated with thread: {}", zookeeperServer);
} else {
writeServerInfoToHDFS(context, zookeeperServer);

代码示例来源:origin: ml.shifu/guagua-yarn

String localHostName = getLocalHostName();
LOG.warn("No valid zookeeper servers, start one in ZooKeeperMaster {}", localHostName);
  zookeeperServer = startZookeeperServer(localHostName);
  LOG.info("Zookeeper server is stated with thread: {}", zookeeperServer);
} else {
writeServerInfoToHDFS(context, zookeeperServer);

代码示例来源:origin: ml.shifu/guagua-yarn

@Override
public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
  if(this.isNeedStartZookeeper) {
    try {
      this.fileSystem.delete(new Path(this.getZookeeperServerFolder(context)), true);
    } catch (IOException e) {
      throw new GuaguaRuntimeException(e);
    }
  }
}

代码示例来源:origin: ShifuML/guagua

String localHostName = getLocalHostName();
LOG.warn("No valid zookeeper servers, start one in ZooKeeperMaster {}", localHostName);
  zookeeperServer = startZookeeperServer(localHostName);
  LOG.info("Zookeeper server is stated with thread: {}", zookeeperServer);
} else {
writeServerInfoToHDFS(context, zookeeperServer);

代码示例来源:origin: ShifuML/guagua

@Override
public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
  if(this.isNeedStartZookeeper) {
    try {
      this.fileSystem.delete(new Path(this.getZookeeperServerFolder(context)), true);
    } catch (IOException e) {
      throw new GuaguaRuntimeException(e);
    }
  }
}

代码示例来源:origin: ShifuML/guagua

@Override
public void postApplication(MasterContext<MASTER_RESULT, WORKER_RESULT> context) {
  if(this.isNeedStartZookeeper) {
    try {
      this.fileSystem.delete(new Path(this.getZookeeperServerFolder(context)), true);
    } catch (IOException e) {
      throw new GuaguaRuntimeException(e);
    }
  }
}

代码示例来源:origin: ShifuML/guagua

/**
 * Write zookeeper server info to HDFS. Then worker can get such info and connect to such server..
 */
private void writeServerInfoToHDFS(MasterContext<MASTER_RESULT, WORKER_RESULT> context,
    String embededZooKeeperServer) {
  String hdfsZookeeperServerFolder = getZookeeperServerFolder(context);
  PrintWriter pw = null;
  try {
    if(!this.fileSystem.exists(new Path(hdfsZookeeperServerFolder))) {
      this.fileSystem.mkdirs(new Path(hdfsZookeeperServerFolder));
    }
    this.zookeeperServerPath = fileSystem.makeQualified(new Path(hdfsZookeeperServerFolder,
        GuaguaConstants.GUAGUA_CLUSTER_ZOOKEEPER_SERVER_FILE));
    LOG.info("Writing hdfs zookeeper server info to {}", this.zookeeperServerPath);
    FSDataOutputStream fos = fileSystem.create(this.zookeeperServerPath);
    pw = new PrintWriter(fos);
    pw.println(embededZooKeeperServer);
    pw.flush();
  } catch (IOException e) {
    LOG.error("Error in writing output.", e);
  } catch (Exception e) {
    LOG.error("Error in writing output.", e);
  } finally {
    IOUtils.closeStream(pw);
  }
}

代码示例来源:origin: ml.shifu/guagua-yarn

/**
 * Write zookeeper server info to HDFS. Then worker can get such info and connect to such server..
 */
private void writeServerInfoToHDFS(MasterContext<MASTER_RESULT, WORKER_RESULT> context,
    String embededZooKeeperServer) {
  String hdfsZookeeperServerFolder = getZookeeperServerFolder(context);
  PrintWriter pw = null;
  try {
    if(!this.fileSystem.exists(new Path(hdfsZookeeperServerFolder))) {
      this.fileSystem.mkdirs(new Path(hdfsZookeeperServerFolder));
    }
    this.zookeeperServerPath = fileSystem.makeQualified(new Path(hdfsZookeeperServerFolder,
        GuaguaConstants.GUAGUA_CLUSTER_ZOOKEEPER_SERVER_FILE));
    LOG.info("Writing hdfs zookeeper server info to {}", this.zookeeperServerPath);
    FSDataOutputStream fos = fileSystem.create(this.zookeeperServerPath);
    pw = new PrintWriter(fos);
    pw.println(embededZooKeeperServer);
    pw.flush();
  } catch (IOException e) {
    LOG.error("Error in writing output.", e);
  } catch (Exception e) {
    LOG.error("Error in writing output.", e);
  } finally {
    IOUtils.closeStream(pw);
  }
}

代码示例来源:origin: ml.shifu/guagua-mapreduce

/**
 * Write zookeeper server info to HDFS. Then worker can get such info and connect to such server..
 */
private void writeServerInfoToHDFS(MasterContext<MASTER_RESULT, WORKER_RESULT> context,
    String embededZooKeeperServer) {
  String hdfsZookeeperServerFolder = getZookeeperServerFolder(context);
  PrintWriter pw = null;
  try {
    if(!this.fileSystem.exists(new Path(hdfsZookeeperServerFolder))) {
      this.fileSystem.mkdirs(new Path(hdfsZookeeperServerFolder));
    }
    this.zookeeperServerPath = fileSystem.makeQualified(new Path(hdfsZookeeperServerFolder,
        GuaguaConstants.GUAGUA_CLUSTER_ZOOKEEPER_SERVER_FILE));
    LOG.info("Writing hdfs zookeeper server info to {}", this.zookeeperServerPath);
    FSDataOutputStream fos = fileSystem.create(this.zookeeperServerPath);
    pw = new PrintWriter(fos);
    pw.println(embededZooKeeperServer);
    pw.flush();
  } catch (IOException e) {
    LOG.error("Error in writing output.", e);
  } catch (Exception e) {
    LOG.error("Error in writing output.", e);
  } finally {
    IOUtils.closeStream(pw);
  }
}

代码示例来源:origin: ShifuML/guagua

/**
 * Write zookeeper server info to HDFS. Then worker can get such info and connect to such server..
 */
private void writeServerInfoToHDFS(MasterContext<MASTER_RESULT, WORKER_RESULT> context,
    String embededZooKeeperServer) {
  String hdfsZookeeperServerFolder = getZookeeperServerFolder(context);
  PrintWriter pw = null;
  try {
    if(!this.fileSystem.exists(new Path(hdfsZookeeperServerFolder))) {
      this.fileSystem.mkdirs(new Path(hdfsZookeeperServerFolder));
    }
    this.zookeeperServerPath = fileSystem.makeQualified(new Path(hdfsZookeeperServerFolder,
        GuaguaConstants.GUAGUA_CLUSTER_ZOOKEEPER_SERVER_FILE));
    LOG.info("Writing hdfs zookeeper server info to {}", this.zookeeperServerPath);
    FSDataOutputStream fos = fileSystem.create(this.zookeeperServerPath);
    pw = new PrintWriter(fos);
    pw.println(embededZooKeeperServer);
    pw.flush();
  } catch (IOException e) {
    LOG.error("Error in writing output.", e);
  } catch (Exception e) {
    LOG.error("Error in writing output.", e);
  } finally {
    IOUtils.closeStream(pw);
  }
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com