gpt4 book ai didi

org.apache.hadoop.hbase.zookeeper.ZKMainServer.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 18:09:31 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKMainServer.<init>()方法的一些代码示例,展示了ZKMainServer.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKMainServer.<init>()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKMainServer
类名称:ZKMainServer
方法名:<init>

ZKMainServer.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

/**
  * Run the tool.
  * @param args Command line arguments. First arg is path to zookeepers file.
  */
 public static void main(String[] args) throws Exception {
  String [] newArgs = args;
  if (!hasServer(args)) {
   // Add the zk ensemble from configuration if none passed on command-line.
   Configuration conf = HBaseConfiguration.create();
   String hostport = new ZKMainServer().parse(conf);
   if (hostport != null && hostport.length() > 0) {
    newArgs = new String[args.length + 2];
    System.arraycopy(args, 0, newArgs, 2, args.length);
    newArgs[0] = "-server";
    newArgs[1] = hostport;
   }
  }
  // If command-line arguments, run our hack so they are executed.
  // ZOOKEEPER-1897 was committed to zookeeper-3.4.6 but elsewhere in this class we say
  // 3.4.6 breaks command-processing; TODO.
  if (hasCommandLineArguments(args)) {
   HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm =
    new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs);
   zkm.runCmdLine();
  } else {
   ZooKeeperMain.main(newArgs);
  }
 }
}

代码示例来源:origin: apache/hbase

@Test
public void testHostPortParse() {
 ZKMainServer parser = new ZKMainServer();
 Configuration c = HBaseConfiguration.create();
 assertEquals("localhost:" + c.get(HConstants.ZOOKEEPER_CLIENT_PORT), parser.parse(c));

代码示例来源:origin: org.apache.hbase/hbase-zookeeper

/**
  * Run the tool.
  * @param args Command line arguments. First arg is path to zookeepers file.
  */
 public static void main(String[] args) throws Exception {
  String [] newArgs = args;
  if (!hasServer(args)) {
   // Add the zk ensemble from configuration if none passed on command-line.
   Configuration conf = HBaseConfiguration.create();
   String hostport = new ZKMainServer().parse(conf);
   if (hostport != null && hostport.length() > 0) {
    newArgs = new String[args.length + 2];
    System.arraycopy(args, 0, newArgs, 2, args.length);
    newArgs[0] = "-server";
    newArgs[1] = hostport;
   }
  }
  // If command-line arguments, run our hack so they are executed.
  // ZOOKEEPER-1897 was committed to zookeeper-3.4.6 but elsewhere in this class we say
  // 3.4.6 breaks command-processing; TODO.
  if (hasCommandLineArguments(args)) {
   HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm =
    new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs);
   zkm.runCmdLine();
  } else {
   ZooKeeperMain.main(newArgs);
  }
 }
}

代码示例来源:origin: org.apache.hbase/hbase-zookeeper

@Test
 public void testHostPortParse() {
  ZKMainServer parser = new ZKMainServer();
  Configuration c = HBaseConfiguration.create();
  assertEquals("localhost:" + c.get(HConstants.ZOOKEEPER_CLIENT_PORT), parser.parse(c));
  final String port = "1234";
  c.set(HConstants.ZOOKEEPER_CLIENT_PORT, port);
  c.set("hbase.zookeeper.quorum", "example.com");
  assertEquals("example.com:" + port, parser.parse(c));
  c.set("hbase.zookeeper.quorum", "example1.com,example2.com,example3.com");
  String ensemble = parser.parse(c);
  assertTrue(port, ensemble.matches("(example[1-3]\\.com:1234,){2}example[1-3]\\.com:" + port));

  // multiple servers with its own port
  c.set("hbase.zookeeper.quorum", "example1.com:5678,example2.com:9012,example3.com:3456");
  ensemble = parser.parse(c);
  assertEquals(ensemble, "example1.com:5678,example2.com:9012,example3.com:3456");

  // some servers without its own port, which will be assigned the default client port
  c.set("hbase.zookeeper.quorum", "example1.com:5678,example2.com:9012,example3.com");
  ensemble = parser.parse(c);
  assertEquals(ensemble, "example1.com:5678,example2.com:9012,example3.com:" + port);
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-zookeeper

@Test
 public void testHostPortParse() {
  ZKMainServer parser = new ZKMainServer();
  Configuration c = HBaseConfiguration.create();
  assertEquals("localhost:" + c.get(HConstants.ZOOKEEPER_CLIENT_PORT), parser.parse(c));
  final String port = "1234";
  c.set(HConstants.ZOOKEEPER_CLIENT_PORT, port);
  c.set("hbase.zookeeper.quorum", "example.com");
  assertEquals("example.com:" + port, parser.parse(c));
  c.set("hbase.zookeeper.quorum", "example1.com,example2.com,example3.com");
  String ensemble = parser.parse(c);
  assertTrue(port, ensemble.matches("(example[1-3]\\.com:1234,){2}example[1-3]\\.com:" + port));

  // multiple servers with its own port
  c.set("hbase.zookeeper.quorum", "example1.com:5678,example2.com:9012,example3.com:3456");
  ensemble = parser.parse(c);
  assertEquals(ensemble, "example1.com:5678,example2.com:9012,example3.com:3456");

  // some servers without its own port, which will be assigned the default client port
  c.set("hbase.zookeeper.quorum", "example1.com:5678,example2.com:9012,example3.com");
  ensemble = parser.parse(c);
  assertEquals(ensemble, "example1.com:5678,example2.com:9012,example3.com:" + port);
 }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com