Package org.apache.hadoop.hdfs

Examples of org.apache.hadoop.hdfs.MiniAvatarCluster


      f.delete();
    }
    conf.set("dfs.hosts", HOST_FILE_PATH);
    conf.setInt("dfs.datanode.failed.volumes.tolerated", 0);
    if (!federation) {
      cluster = new MiniAvatarCluster(conf, 1, true, null, null);
    } else {
      cluster = new MiniAvatarCluster(conf, 1, true, null, null, 2, true);
    }
    federation = false;
  }
View Full Code Here


  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    MiniAvatarCluster.createAndStartZooKeeper();
    conf = new Configuration();
    cluster = new MiniAvatarCluster(conf, 3, true, null, null);
    fs = cluster.getFileSystem();
  }
View Full Code Here

    Configuration conf = new Configuration();
    // populate repl queues on standby (in safe mode)
    conf.setFloat("dfs.namenode.replqueue.threshold-pct", 0f);
    conf.setLong("fs.avatar.standbyfs.initinterval", 1000);
    conf.setLong("fs.avatar.standbyfs.checkinterval", 1000);
    MiniAvatarCluster cluster = new MiniAvatarCluster(conf, 1, true, null, null, 2, true);
    try {
      List<AvatarDataNode> datanodes = cluster.getDataNodes();
      Assert.assertEquals(datanodes.size(), 1);
      checkMXBean(datanodes.get(0));
    } finally {
      if (cluster != null) {
        cluster.shutDown();
      }
      MiniAvatarCluster.shutDownZooKeeper();
    }
  }
View Full Code Here

    MiniAvatarCluster.createAndStartZooKeeper();
  }

  @Before
  public void setUp() throws Exception {
    cluster = new MiniAvatarCluster(new Configuration(), 1, true, null, null);
  }
View Full Code Here

    conf = new Configuration();
    conf.setInt("dfs.block.size", BLOCK_SIZE);
    conf.setInt("dfs.replication.min", 3);
    conf.setBoolean("dfs.support.append", true);
    conf.setInt("dfs.datanode.blockreceived.retry.internval", 1000);
    cluster = new MiniAvatarCluster(conf, 3, true, null, null);
    dafs = cluster.getFileSystem();
  }
View Full Code Here

    conf.set(FSConstants.DFS_FEDERATION_NAMESERVICES, nameserviceIdList);
  }
 
  @Test
  public void testRefreshNamenodes() throws Exception {
    MiniAvatarCluster cluster = null;
    try {
      cluster = new MiniAvatarCluster(conf, 1, true, null, null, 1, true);
      DataNode dn = cluster.getDataNodes().get(0);
      assertEquals(dn.getAllNamespaceServices().length, 1);
     
      cluster.addNameNode(conf);
      assertEquals(dn.getAllNamespaceServices().length, 2);
     
      cluster.addNameNode(conf);
      assertEquals(dn.getAllNamespaceServices().length, 3);
     
      cluster.addNameNode(conf);
      assertEquals(dn.getAllNamespaceServices().length, 4);
      int[] nns = null;
      nns = new int[]{0, 1, 2, 3};
      compareAddress(cluster, dn, nns);
      nns = new int[]{0, 1};
      Configuration conf1 = new Configuration(conf);
      setupAddress(conf1, new int[]{0, 1});
      dn.refreshNamenodes(conf1);
      waitDataNodeInitialized(dn);
      compareAddress(cluster, dn, nns);
     
      nns = new int[]{0,2,3};
      Configuration conf2 = new Configuration(conf);
      setupAddress(conf2, new int[]{0,2,3});
      dn.refreshNamenodes(conf2);
      waitDataNodeInitialized(dn);
      compareAddress(cluster, dn, nns);
    } finally {
      cluster.shutDown();
    }
  }
View Full Code Here

  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    MiniAvatarCluster.createAndStartZooKeeper();
    conf = new Configuration();
    cluster = new MiniAvatarCluster(conf, 1, true, null, null);
  }
View Full Code Here

    conf.setLong("fs.avatar.standbyfs.checkinterval", 1000);
  }
 
  @Test
  public void testMergeNamespaces() throws Exception {
    MiniAvatarCluster cluster1 = null;
    MiniAvatarCluster cluster2 = null;
    Configuration conf1 = new Configuration(conf);
    conf1.set(MiniDFSCluster.DFS_CLUSTER_ID, Long.toString(System.currentTimeMillis() + 1));
    Configuration conf2 = new Configuration(conf);
    conf2.set(MiniDFSCluster.DFS_CLUSTER_ID, Long.toString(System.currentTimeMillis() + 2));
   
    try {
      LOG.info("Start cluster1 and cluster2");
      cluster1 = new MiniAvatarCluster(conf1, 1, true, null, null, 1, true);
      cluster2 = new MiniAvatarCluster(conf2, 1, true, null, null, 2, true);
      LOG.info("Write data to cluster2 and cluster1");
      Path p = new Path("/testFile");
      TestMergeNamespaces.createFile(cluster1.getFileSystem(0), p, 512 * 1024L);
      TestMergeNamespaces.createFile(cluster2.getFileSystem(0), p, 1024 * 1024L);
      TestMergeNamespaces.createFile(cluster2.getFileSystem(1), p, 1536 * 1024L);
      LOG.info("Add cluster2 to cluster1");
      cluster1.addCluster(cluster2, false);
      TestMergeNamespaces.verifyFile(cluster1.getFileSystem(0), p, 512 * 1024L);
      TestMergeNamespaces.verifyFile(cluster1.getFileSystem(1), p, 1024 * 1024L);
      TestMergeNamespaces.verifyFile(cluster1.getFileSystem(2), p, 1536 * 1024L);
 
View Full Code Here

    conf.set(FSConstants.DFS_FEDERATION_NAMESERVICES, nameserviceIdList);
  }
 
  @Test
  public void testRefreshNamenodes() throws Exception {
    MiniAvatarCluster cluster =
      new MiniAvatarCluster(conf, 1, true, null, null, 1, true);
    try {
      DataNode dn = cluster.getDataNodes().get(0);
      assertEquals(dn.getAllNamespaceServices().length, 1);
     
      cluster.addNameNode(conf);
      assertEquals(dn.getAllNamespaceServices().length, 2);
     
      cluster.addNameNode(conf);
      assertEquals(dn.getAllNamespaceServices().length, 3);
     
      cluster.addNameNode(conf);
      assertEquals(dn.getAllNamespaceServices().length, 4);
      int[] nns = null;
      nns = new int[]{0, 1, 2, 3};
      compareAddress(cluster, dn, nns);
      nns = new int[]{0, 1};
      Configuration conf1 = new Configuration(conf);
      setupAddress(conf1, new int[]{0, 1});
      dn.refreshNamenodes(conf1);
      waitDataNodeInitialized(dn);
      compareAddress(cluster, dn, nns);
     
      nns = new int[]{0,2,3};
      Configuration conf2 = new Configuration(conf);
      setupAddress(conf2, new int[]{0,2,3});
      dn.refreshNamenodes(conf2);
      waitDataNodeInitialized(dn);
      compareAddress(cluster, dn, nns);
    } finally {
      cluster.shutDown();
    }
  }
View Full Code Here

  @BeforeClass
  public static void setUpBeforeClass() throws Exception {
    MiniAvatarCluster.createAndStartZooKeeper();
    conf = new Configuration();
    cluster = new MiniAvatarCluster(conf, 1, true, null, null);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hdfs.MiniAvatarCluster

Copyright © 2018 www.massapicom. 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.