当前位置: 首页>>代码示例>>Java>>正文


Java ZKFCTestUtil.waitForHealthState方法代码示例

本文整理汇总了Java中org.apache.hadoop.ha.ZKFCTestUtil.waitForHealthState方法的典型用法代码示例。如果您正苦于以下问题:Java ZKFCTestUtil.waitForHealthState方法的具体用法?Java ZKFCTestUtil.waitForHealthState怎么用?Java ZKFCTestUtil.waitForHealthState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.ha.ZKFCTestUtil的用法示例。


在下文中一共展示了ZKFCTestUtil.waitForHealthState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import org.apache.hadoop.ha.ZKFCTestUtil; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
  String logicalName = MiniMRHACluster.LOGICAL_NAME;
  conf = new Configuration();
  conf.set(addKeySuffixes(ZKFailoverController.ZK_QUORUM_KEY, logicalName), hostPort);
  conf.set(HAUtil.MR_HA_FENCING_METHODS_KEY,
      AlwaysSucceedFencer.class.getName());
  conf.setBoolean(HAUtil.MR_HA_AUTO_FAILOVER_ENABLED_KEY, true);

  // Turn off IPC client caching, so that the suite can handle
  // the restart of the daemons between test cases.
  conf.setInt(
      CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY,
      0);
  
  conf.setInt(addKeySuffixes(HAUtil.MR_HA_ZKFC_PORT_KEY, logicalName, "jt1"), 10003);
  conf.setInt(addKeySuffixes(HAUtil.MR_HA_ZKFC_PORT_KEY, logicalName, "jt2"), 10004);

  cluster = new MiniMRHACluster(conf);

  ctx = new TestContext();
  ctx.addThread(thr1 = new ZKFCThread(ctx, 0));
  assertEquals(0, thr1.zkfc.run(new String[]{"-formatZK"}));

  thr1.start();
  waitForHAState(0, HAServiceState.ACTIVE);
  
  ctx.addThread(thr2 = new ZKFCThread(ctx, 1));
  thr2.start();
  
  cluster.startTaskTracker(0, 1);
  cluster.waitActive();
  
  // Wait for the ZKFCs to fully start up
  ZKFCTestUtil.waitForHealthState(thr1.zkfc,
      HealthMonitor.State.SERVICE_HEALTHY, ctx);
  ZKFCTestUtil.waitForHealthState(thr2.zkfc,
      HealthMonitor.State.SERVICE_HEALTHY, ctx);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:40,代码来源:TestMRZKFailoverController.java

示例2: setup

import org.apache.hadoop.ha.ZKFCTestUtil; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
  conf = new Configuration();
  // Specify the quorum per-nameservice, to ensure that these configs
  // can be nameservice-scoped.
  conf.set(ZKFailoverController.ZK_QUORUM_KEY + ".ns1", hostPort);
  conf.set(DFSConfigKeys.DFS_HA_FENCE_METHODS_KEY,
      AlwaysSucceedFencer.class.getName());
  conf.setBoolean(DFSConfigKeys.DFS_HA_AUTO_FAILOVER_ENABLED_KEY, true);

  // Turn off IPC client caching, so that the suite can handle
  // the restart of the daemons between test cases.
  conf.setInt(
      CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY,
      0);
  
  conf.setInt(DFSConfigKeys.DFS_HA_ZKFC_PORT_KEY + ".ns1.nn1", 10023);
  conf.setInt(DFSConfigKeys.DFS_HA_ZKFC_PORT_KEY + ".ns1.nn2", 10024);

  MiniDFSNNTopology topology = new MiniDFSNNTopology()
  .addNameservice(new MiniDFSNNTopology.NSConf("ns1")
      .addNN(new MiniDFSNNTopology.NNConf("nn1").setIpcPort(10021))
      .addNN(new MiniDFSNNTopology.NNConf("nn2").setIpcPort(10022)));
  cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .numDataNodes(0)
      .build();
  cluster.waitActive();

  ctx = new TestContext();
  ctx.addThread(thr1 = new ZKFCThread(ctx, 0));
  assertEquals(0, thr1.zkfc.run(new String[]{"-formatZK"}));

  thr1.start();
  waitForHAState(0, HAServiceState.ACTIVE);
  
  ctx.addThread(thr2 = new ZKFCThread(ctx, 1));
  thr2.start();
  
  // Wait for the ZKFCs to fully start up
  ZKFCTestUtil.waitForHealthState(thr1.zkfc,
      HealthMonitor.State.SERVICE_HEALTHY, ctx);
  ZKFCTestUtil.waitForHealthState(thr2.zkfc,
      HealthMonitor.State.SERVICE_HEALTHY, ctx);
  
  fs = HATestUtil.configureFailoverFs(cluster, conf);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:48,代码来源:TestDFSZKFailoverController.java

示例3: setup

import org.apache.hadoop.ha.ZKFCTestUtil; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
  conf = new Configuration();
  // Specify the quorum per-nameservice, to ensure that these configs
  // can be nameservice-scoped.
  conf.set(ZKFailoverController.ZK_QUORUM_KEY + ".ns1", hostPort);
  conf.set(DFSConfigKeys.DFS_HA_FENCE_METHODS_KEY,
      AlwaysSucceedFencer.class.getName());
  conf.setBoolean(DFSConfigKeys.DFS_HA_AUTO_FAILOVER_ENABLED_KEY, true);

  // Turn off IPC client caching, so that the suite can handle
  // the restart of the daemons between test cases.
  conf.setInt(
      CommonConfigurationKeysPublic.IPC_CLIENT_CONNECTION_MAXIDLETIME_KEY,
      0);
  
  conf.setInt(DFSConfigKeys.DFS_HA_ZKFC_PORT_KEY + ".ns1.nn1", 10003);
  conf.setInt(DFSConfigKeys.DFS_HA_ZKFC_PORT_KEY + ".ns1.nn2", 10004);

  MiniDFSNNTopology topology = new MiniDFSNNTopology()
  .addNameservice(new MiniDFSNNTopology.NSConf("ns1")
      .addNN(new MiniDFSNNTopology.NNConf("nn1").setIpcPort(10001))
      .addNN(new MiniDFSNNTopology.NNConf("nn2").setIpcPort(10002)));
  cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .numDataNodes(0)
      .build();
  cluster.waitActive();

  ctx = new TestContext();
  ctx.addThread(thr1 = new ZKFCThread(ctx, 0));
  assertEquals(0, thr1.zkfc.run(new String[]{"-formatZK"}));

  thr1.start();
  waitForHAState(0, HAServiceState.ACTIVE);
  
  ctx.addThread(thr2 = new ZKFCThread(ctx, 1));
  thr2.start();
  
  // Wait for the ZKFCs to fully start up
  ZKFCTestUtil.waitForHealthState(thr1.zkfc,
      HealthMonitor.State.SERVICE_HEALTHY, ctx);
  ZKFCTestUtil.waitForHealthState(thr2.zkfc,
      HealthMonitor.State.SERVICE_HEALTHY, ctx);
  
  fs = HATestUtil.configureFailoverFs(cluster, conf);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:48,代码来源:TestDFSZKFailoverController.java


注:本文中的org.apache.hadoop.ha.ZKFCTestUtil.waitForHealthState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。