Examples of NameNode


Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

   * with no .append() called.
   */
  public void testNotPrematurelyCompleteWithFailureNotReopened() throws Exception {
    LOG.info("START");
    cluster = new MiniDFSCluster(conf, 3, true, null);
    NameNode nn = cluster.getNameNode();
    FileSystem fs1 = cluster.getFileSystem();
    try {
      short rep = 3; // replication

      file1 = new Path("/delayedReceiveBlock");
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

      loseLeases(fs1);

      // Make the first nextGenerationStamp call get delayed
      DelayAnswer delayer = new DelayAnswer(false);

      NameNode nn = cluster.getNameNode();
      nn.namesystem = spy(nn.namesystem);
      doAnswer(delayer).when(nn.namesystem).nextGenerationStampForBlock(
          (Block)anyObject(), anyBoolean());

      final AtomicReference<Throwable> err = new AtomicReference<Throwable>();
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

    if (!federation) {
      conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "127.0.0.1:" + nameNodePort);
      conf.set("dfs.http.address", "127.0.0.1:0");
      FileSystem.setDefaultUri(conf, "hdfs://localhost:" +
                               Integer.toString(nameNodePort));
      NameNode nn = createNameNode(0, conf, numDataNodes, manageNameDfsDirs,
          format, operation);
      nameNodes[0] = new NameNodeInfo(nn, conf);
    } else {
      Collection<String> nameserviceIds = conf.getStringCollection(
          FSConstants.DFS_FEDERATION_NAMESERVICES);
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

  private void createFederatedNameNode(int nnIndex, Configuration conf,
      int numDataNodes, boolean manageNameDfsDirs, boolean format,
      StartupOption operation, String nameserviceId)
      throws IOException {
    conf.set(FSConstants.DFS_FEDERATION_NAMESERVICE_ID, nameserviceId);
    NameNode nn = createNameNode(nnIndex, conf, numDataNodes, manageNameDfsDirs,
        format, operation, nameserviceId);
    DFSUtil.setGenericConf(conf, nameserviceId,
        NameNode.NAMESERVICE_SPECIFIC_KEYS);
    conf.set(DFSUtil.getNameServiceIdKey(
        FSConstants.DFS_NAMENODE_HTTP_ADDRESS_KEY, nameserviceId), NameNode
        .getHostPortString(nn.getHttpAddress()));
    conf.set(DFSUtil.getNameServiceIdKey(
        NameNode.DATANODE_PROTOCOL_ADDRESS, nameserviceId), NameNode
        .getHostPortString(nn.getNameNodeDNAddress()));
    nameNodes[nnIndex] = new NameNodeInfo(nn, new Configuration(conf));
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

   */
  public void shutdown(boolean remove) {
    System.out.println("Shutting down the Mini HDFS Cluster");
    shutdownDataNodes(remove);
    for (NameNodeInfo nnInfo : nameNodes) {
      NameNode nameNode = nnInfo.nameNode;
      if (nameNode != null) {
        nameNode.stop();
        nameNode.join();
        nameNode = null;
      }
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

  /**
   * Shutdown one namenode
   */
  public synchronized void shutdownNameNode(int nnIndex) {
    NameNode nn = nameNodes[nnIndex].nameNode;
    if (nn != null) {
      System.out.println("Shutting down the namenode");
      nn.stop();
      nn.join();
      Configuration conf = nameNodes[nnIndex].conf;
      nameNodes[nnIndex] = new NameNodeInfo(null, conf);
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

  }

  public synchronized void restartNameNode(int nnIndex, String[] argv, boolean waitActive) throws IOException {
    shutdownNameNode(nnIndex);
    Configuration conf = nameNodes[nnIndex].conf;
    NameNode nn = NameNode.createNameNode(argv, conf);
    nameNodes[nnIndex] = new NameNodeInfo(nn, conf);
    if (!waitActive) {
      return;
    }
    waitClusterUp();
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

  /**
   * Returns true if the NameNode is running and is out of Safe Mode
   * or if waiting for safe mode is disabled.
   */
  public boolean isNameNodeUp(int nnIndex) {
    NameNode nn = nameNodes[nnIndex].nameNode;
    if (nn == null) {
      return false;
    }
    try {
      long[] sizes = nn.getStats();
      boolean isUp = false;
      synchronized (this) {
        isUp = ((!nn.isInSafeMode() || !waitSafeMode) && sizes[0] != 0);
      }
      return isUp;
    } catch (IOException ie) {
      return false;
    }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.NameNode

   */
  public void waitActive(boolean waitHeartbeats, int nnIndex) throws IOException {
    if (nnIndex < 0 || nnIndex >= nameNodes.length || nameNodes[nnIndex] == null) {
      return;
    }
    NameNode nn = nameNodes[nnIndex].nameNode;
    if (nn == null) {
      return;
    }
    InetSocketAddress addr = nn.getNameNodeAddress();
    // Wait for the client server to start if we have two configured
    while (addr == null) {
      try {
        Thread.sleep(100);
      } catch (Exception e) {
      }
      addr = nn.getNameNodeAddress();
    }
    addr = nn.getNameNodeDNAddress();
    DFSClient client = new DFSClient(addr, nn.getConf());

    // make sure all datanodes are alive and sent heartbeat
    while (shouldWait(client.datanodeReport(DatanodeReportType.LIVE),
                      waitHeartbeats, addr)) {
      try {
View Full Code Here

Examples of org.apache.openejb.core.ivm.naming.NameNode

        }
        return context;
    }

    private IvmContext createIvmContext() {
        IvmContext context = new IvmContext(new NameNode(null, new ParsedName("comp"), null, null));
        try {
            context.createSubcontext("comp").createSubcontext("env");
            // todo remove this... IvmContext seems to drop empty nodes
            context.bind("java:comp/env/dummy", "dummy");
        } catch (NamingException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.