Java 类org.apache.hadoop.hdfs.MiniDFSNNTopology.NSConf 实例源码

项目:hadoop    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().size());

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().size());

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().size());

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
项目:big-c    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
项目:hadoop-plus    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
项目:FlexMap    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
项目:hadoop-TCP    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
项目:hardfs    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}
项目:hadoop-on-lustre2    文件:TestRefreshNamenodes.java   
@Test
public void testRefreshNamenodes() throws IOException {
  // Start cluster with a single NN and DN
  Configuration conf = new Configuration();
  MiniDFSCluster cluster = null;
  try {
    MiniDFSNNTopology topology = new MiniDFSNNTopology()
      .addNameservice(new NSConf("ns1").addNN(
          new NNConf(null).setIpcPort(nnPort1)))
      .setFederation(true);
    cluster = new MiniDFSCluster.Builder(conf)
      .nnTopology(topology)
      .build();

    DataNode dn = cluster.getDataNodes().get(0);
    assertEquals(1, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort2);
    assertEquals(2, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort3);
    assertEquals(3, dn.getAllBpOs().length);

    cluster.addNameNode(conf, nnPort4);

    // Ensure a BPOfferService in the datanodes corresponds to
    // a namenode in the cluster
    Set<InetSocketAddress> nnAddrsFromCluster = Sets.newHashSet();
    for (int i = 0; i < 4; i++) {
      assertTrue(nnAddrsFromCluster.add(
          cluster.getNameNode(i).getNameNodeAddress()));
    }

    Set<InetSocketAddress> nnAddrsFromDN = Sets.newHashSet();
    for (BPOfferService bpos : dn.getAllBpOs()) {
      for (BPServiceActor bpsa : bpos.getBPServiceActors()) {
        assertTrue(nnAddrsFromDN.add(bpsa.getNNSocketAddress()));
      }
    }

    assertEquals("",
        Joiner.on(",").join(
          Sets.symmetricDifference(nnAddrsFromCluster, nnAddrsFromDN)));
  } finally {
    if (cluster != null) {
      cluster.shutdown();
    }
  }
}