• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JournalNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hdfs.qjournal.server.JournalNode的典型用法代码示例。如果您正苦于以下问题:Java JournalNode类的具体用法?Java JournalNode怎么用?Java JournalNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



JournalNode类属于org.apache.hadoop.hdfs.qjournal.server包,在下文中一共展示了JournalNode类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testStartStop

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
@Test
public void testStartStop() throws IOException {
  Configuration conf = new Configuration();
  MiniJournalCluster c = new MiniJournalCluster.Builder(conf)
    .build();
  try {
    URI uri = c.getQuorumJournalURI("myjournal");
    String[] addrs = uri.getAuthority().split(";");
    assertEquals(3, addrs.length);
    
    JournalNode node = c.getJournalNode(0);
    String dir = node.getConf().get(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_KEY);
    assertEquals(
        new File(MiniDFSCluster.getBaseDirectory() + "journalnode-0")
          .getAbsolutePath(),
        dir);
  } finally {
    c.shutdown();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestMiniJournalCluster.java


示例2: MiniJournalCluster

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
private MiniJournalCluster(Builder b) throws IOException {
  LOG.info("Starting MiniJournalCluster with " +
      b.numJournalNodes + " journal nodes");
  
  if (b.baseDir != null) {
    this.baseDir = new File(b.baseDir);
  } else {
    this.baseDir = new File(MiniDFSCluster.getBaseDirectory());
  }

  nodes = new JNInfo[b.numJournalNodes];

  for (int i = 0; i < b.numJournalNodes; i++) {
    if (b.format) {
      File dir = getStorageDir(i);
      LOG.debug("Fully deleting JN directory " + dir);
      FileUtil.fullyDelete(dir);
    }
    JournalNode jn = new JournalNode();
    jn.setConf(createConfForNode(b, i));
    jn.start();
    nodes[i] = new JNInfo(jn);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:MiniJournalCluster.java


示例3: restartJournalNode

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
public void restartJournalNode(int i) throws InterruptedException, IOException {
  JNInfo info = nodes[i];
  JournalNode jn = info.node;
  Configuration conf = new Configuration(jn.getConf());
  if (jn.isStarted()) {
    jn.stopAndJoin(0);
  }
  
  conf.set(DFSConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY,
      NetUtils.getHostPortString(info.ipcAddr));

  final String uri = info.httpServerURI;
  if (uri.startsWith("http://")) {
    conf.set(DFSConfigKeys.DFS_JOURNALNODE_HTTP_ADDRESS_KEY,
        uri.substring(("http://".length())));
  } else if (info.httpServerURI.startsWith("https://")) {
    conf.set(DFSConfigKeys.DFS_JOURNALNODE_HTTPS_ADDRESS_KEY,
        uri.substring(("https://".length())));
  }

  JournalNode newJN = new JournalNode();
  newJN.setConf(conf);
  newJN.start();
  info.node = newJN;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:MiniJournalCluster.java


示例4: testStartStop

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
@Test
public void testStartStop() throws IOException {
  Configuration conf = new Configuration();
  MiniJournalCluster c = new MiniJournalCluster.Builder(conf)
    .build();
  c.waitActive();
  try {
    URI uri = c.getQuorumJournalURI("myjournal");
    String[] addrs = uri.getAuthority().split(";");
    assertEquals(3, addrs.length);
    
    JournalNode node = c.getJournalNode(0);
    String dir = node.getConf().get(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_KEY);
    assertEquals(
        new File(MiniDFSCluster.getBaseDirectory() + "journalnode-0")
          .getAbsolutePath(),
        dir);
  } finally {
    c.shutdown();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:TestMiniJournalCluster.java


示例5: setup

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  File editsDir = new File(MiniDFSCluster.getBaseDirectory() +
      File.separator + "TestJournalNode");
  FileUtil.fullyDelete(editsDir);
  
  conf.set(DFSConfigKeys.DFS_JOURNALNODE_EDITS_DIR_KEY,
      editsDir.getAbsolutePath());
  conf.set(DFSConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY,
      "0.0.0.0:0");
  jn = new JournalNode();
  jn.setConf(conf);
  jn.start();
  journalId = "test-journalid-" + GenericTestUtils.uniqueSequenceId();
  journal = jn.getOrCreateJournal(journalId);
  journal.format(FAKE_NSINFO);
  
  ch = new IPCLoggerChannel(conf, FAKE_NSINFO, journalId, jn.getBoundIpcAddress());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:20,代码来源:TestJournalNode.java


示例6: testStartStop

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
@Test
public void testStartStop() throws IOException {
  Configuration conf = new Configuration();
  MiniJournalCluster c = new MiniJournalCluster.Builder(conf)
    .build();
  try {
    URI uri = c.getQuorumJournalURI("myjournal");
    String[] addrs = uri.getAuthority().split(";");
    assertEquals(3, addrs.length);
    
    JournalNode node = c.getJournalNode(0);
    String dir = node.getConf().get(JournalConfigKeys.DFS_JOURNALNODE_DIR_KEY);
    assertEquals(
        new File(MiniDFSCluster.getBaseDirectory(conf) , "journalnode-0")
          .getAbsolutePath(),
        dir);
  } finally {
    c.shutdown();
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:21,代码来源:TestMiniJournalCluster.java


示例7: assertManifest

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
/**
 * Rolls the image and asserts contents of the manifests.
 */
private void assertManifest(int iteration, MD5Hash digest,
    boolean skipPartial) throws IOException {
  if (!skipPartial) {
    for (int i = 0; i < cluster.getNumNodes(); i++) {
      JournalNode jn = cluster.getJournalNodes()[i];

      RemoteImageManifest rim = jn.getJournal(JID.getBytes())
          .getImageManifest(-1);
      assertEquals(iteration + 1, rim.getImages().size());
      for (int j = 0; j <= iteration; j++) {
        assertEquals(startTxId + j, rim.getImages().get(j).getTxId());
      }
    }
  }

  // get manifest through qjm
  RemoteImageManifest rm = qjm.getImageManifest(-1);
  for (int j = 0; j <= iteration; j++) {
    assertEquals(startTxId + j, rm.getImages().get(j).getTxId());
  }

  assertEquals(startTxId + iteration, qjm.getLatestImage()
      .getCheckpointTxId());
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:28,代码来源:TestImageUploadStream.java


示例8: simulateFailute

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
private void simulateFailute(InjectionEventI event, Object... args)
    throws IOException {
  // get the journal node
  ServletContext context = (ServletContext) args[0];
  JournalNode jn = (JournalNode) context
      .getAttribute(JournalNodeHttpServer.JN_ATTRIBUTE_KEY);
  // configuration stores the index of the node
  Configuration conf = jn.getConf();
  // check which node this is
  int jid = conf.getInt(MiniJournalCluster.DFS_JOURNALNODE_TEST_ID, 0);
  // fail if we are supposed to fail on this event
  if (event == failOn[jid]) {
    exceptionsThrown.incrementAndGet();
    throw new IOException("Testing failures");
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:17,代码来源:TestImageUploadStream.java


示例9: getTailingJN

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
/**
 * Get the journal node we are tailing from, and indicate which stream this is.
 */
private JournalNode getTailingJN(EditLogInputStream str,
    URLLogInputStream[] tailingStream) throws Exception {
  RedundantEditLogInputStream is = (RedundantEditLogInputStream) str;

  Field curIdxF = RedundantEditLogInputStream.class
      .getDeclaredField("curIdx");
  curIdxF.setAccessible(true);
  int curIdx = curIdxF.getInt(is);

  URLLogInputStream[] streams = getStreams(is);

  JournalNode jn = null;
  for (JournalNode j : cluster.getJournalNodes()) {
    if (streams[curIdx].getName().contains(
        Integer.toString(j.getBoundHttpAddress().getPort()))) {
      jn = j;
      break;
    }
  }
  tailingStream[0] = streams[curIdx];
  return jn;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:26,代码来源:TestQuorumJournalManagerInputStream.java


示例10: setup

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  File editsDir = new File(MiniDFSCluster.getBaseDirectory(null)
      + File.separator + "TestJournalNode");
  FileUtil.fullyDelete(editsDir);

  conf.set(JournalConfigKeys.DFS_JOURNALNODE_DIR_KEY,
      editsDir.getAbsolutePath());
  conf.set(JournalConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY, "0.0.0.0:0");
  int port = MiniJournalCluster.getFreeHttpPortAndUpdateConf(conf, true);
  httpAddress = "http://localhost:" + port;

  jn = new JournalNode();
  jn.setConf(conf);
  jn.start();
  journalId = "test-journalid-" + QJMTestUtil.uniqueSequenceId();
  journal = jn.getOrCreateJournal(QuorumJournalManager
      .journalIdStringToBytes(journalId));
  journal.transitionJournal(FAKE_NSINFO, Transition.FORMAT, null);
  journal.transitionImage(FAKE_NSINFO, Transition.FORMAT, null);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:22,代码来源:TestHttpImageUploadChannel.java


示例11: setup

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
@Before
public void setup() throws Exception {
  File editsDir = new File(MiniDFSCluster.getBaseDirectory(null) +
      File.separator + "TestJournalNode");
  FileUtil.fullyDelete(editsDir);
  
  conf.set(JournalConfigKeys.DFS_JOURNALNODE_DIR_KEY,
      editsDir.getAbsolutePath());
  conf.set(JournalConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY,
      "0.0.0.0:0");    
  MiniJournalCluster.getFreeHttpPortAndUpdateConf(conf, true);
  
  jn = new JournalNode();
  jn.setConf(conf);
  jn.start();
  journalId = "test-journalid-" + QJMTestUtil.uniqueSequenceId();
  journal = jn.getOrCreateJournal(QuorumJournalManager
      .journalIdStringToBytes(journalId));
  journal.transitionJournal(FAKE_NSINFO, Transition.FORMAT, null);
  
  ch = new IPCLoggerChannel(conf, FAKE_NSINFO, journalId, jn.getBoundIpcAddress());
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:23,代码来源:TestJournalNode.java


示例12: assertJNFailsToStart

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
private static void assertJNFailsToStart(Configuration conf,
    String errString) {
  try {
    JournalNode jn = new JournalNode();
    jn.setConf(conf);
    jn.start();
  } catch (Exception e) {
    GenericTestUtils.assertExceptionContains(errString, e);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:11,代码来源:TestJournalNode.java


示例13: shutdown

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
/**
 * Shutdown all of the JournalNodes in the cluster.
 * @throws IOException if one or more nodes failed to stop
 */
public void shutdown() throws IOException {
  boolean failed = false;
  for (JournalNode jn : nodes) {
    try {
      jn.stopAndJoin(0);
    } catch (Exception e) {
      failed = true;
      LOG.warn("Unable to stop journal node " + jn, e);
    }
  }
  if (failed) {
    throw new IOException("Unable to shut down. Check log for details");
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:19,代码来源:MiniJournalCluster.java


示例14: restartJournalNode

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
public void restartJournalNode(int i) throws InterruptedException, IOException {
  Configuration conf = new Configuration(nodes[i].getConf());
  if (nodes[i].isStarted()) {
    nodes[i].stopAndJoin(0);
  }
  
  conf.set(JournalConfigKeys.DFS_JOURNALNODE_RPC_ADDRESS_KEY, "127.0.0.1:" +
      ipcAddrs[i].getPort());
  conf.set(JournalConfigKeys.DFS_JOURNALNODE_HTTP_ADDRESS_KEY, "127.0.0.1:" +
      httpAddrs[i].getPort());
  
  JournalNode jn = new JournalNode();
  jn.setConf(conf);
  jn.start();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:16,代码来源:MiniJournalCluster.java


示例15: getJournalDir

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
/**
 * Return the directory inside configured storage
 * dir which corresponds to a given journal. 
 * Edits storage.
 */
public static File getJournalDir(JournalNode jn, String jid) {
  String dir = jn.getConf().get(JournalConfigKeys.DFS_JOURNALNODE_DIR_KEY,
      JournalConfigKeys.DFS_JOURNALNODE_DIR_DEFAULT);
  Preconditions.checkArgument(jid != null &&
      !jid.isEmpty(),
      "bad journal identifier: %s", jid);
  return new File(new File(new File(dir), "edits"), jid);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:14,代码来源:MiniJournalCluster.java


示例16: getImageDir

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
/**
 * Return the directory inside our configured storage
 * dir which corresponds to a given journal. 
 * Image storage.
 */
public static File getImageDir(JournalNode jn, String jid) {
  String dir = jn.getConf().get(JournalConfigKeys.DFS_JOURNALNODE_DIR_KEY,
      JournalConfigKeys.DFS_JOURNALNODE_DIR_DEFAULT);
  Preconditions.checkArgument(jid != null &&
      !jid.isEmpty(),
      "bad journal identifier: %s", jid);
  return new File(new File(new File(dir), "image"), jid);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:14,代码来源:MiniJournalCluster.java


示例17: getStandbyTailingJN

import org.apache.hadoop.hdfs.qjournal.server.JournalNode; //导入依赖的package包/类
private JournalNode getStandbyTailingJN() {
  assertTrue(handler.currentJournalHttpPort != -1);
  // Find the journal node the Standby is tailing from.
  JournalNode jn = null;
  for (JournalNode j : journalCluster.getJournalNodes()) {
    if (j.getBoundHttpAddress().getPort() == handler.currentJournalHttpPort) {
      jn = j;
      break;
    }
  }
  handler.currentJournalRPCPort = jn.getBoundIpcAddress().getPort();
  return jn;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:14,代码来源:TestAvatarQJMFailures.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MockRM类代码示例发布时间:2022-05-22
下一篇:
Java X509Data类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap