/** * 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); } } }
public static void main(String[] args) throws Exception { ZooKeeperMain.main(args); // 列出根节点下的所有子节点:ls / // 列出某节点下的所有子节点:ls /dubbo } }
@Override public void execute(final String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(ZooKeeperMain.class.getName(), args); try (ServerContext context = new ServerContext(new SiteConfiguration())) { FileSystem fs = context.getVolumeManager().getDefaultVolume().getFileSystem(); String baseDir = ServerConstants.getBaseUris(context)[0]; System.out.println("Using " + fs.makeQualified(new Path(baseDir + "/instance_id")) + " to lookup accumulo instance"); if (opts.servers == null) { opts.servers = context.getZooKeepers(); } System.out.println("The accumulo instance id is " + context.getInstanceID()); if (!opts.servers.contains("/")) opts.servers += "/accumulo/" + context.getInstanceID(); org.apache.zookeeper.ZooKeeperMain .main(new String[] {"-server", opts.servers, "-timeout", "" + (opts.timeout * 1000)}); } } }
public static void main(String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(ZooKeeperMain.class.getName(), args); FileSystem fs = FileSystem.get(CachedConfiguration.getInstance()); String baseDir = Constants.getBaseDir(ServerConfiguration.getSiteConfiguration()); System.out.println("Using " + fs.makeQualified(new Path(baseDir + "/instance_id")) + " to lookup accumulo instance"); Instance instance = HdfsZooInstance.getInstance(); if (opts.servers == null) { opts.servers = instance.getZooKeepers(); } System.out.println("The accumulo instance id is " + instance.getInstanceID()); if (!opts.servers.contains("/")) opts.servers += "/accumulo/" + instance.getInstanceID(); org.apache.zookeeper.ZooKeeperMain.main(new String[] {"-server", opts.servers, "-timeout", "" + (opts.timeout * 1000)}); } }
@Override public void execute(final String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(ZooKeeperMain.class.getName(), args); FileSystem fs = VolumeManagerImpl.get().getDefaultVolume().getFileSystem(); String baseDir = ServerConstants.getBaseUris()[0]; System.out.println("Using " + fs.makeQualified(new Path(baseDir + "/instance_id")) + " to lookup accumulo instance"); Instance instance = HdfsZooInstance.getInstance(); if (opts.servers == null) { opts.servers = instance.getZooKeepers(); } System.out.println("The accumulo instance id is " + instance.getInstanceID()); if (!opts.servers.contains("/")) opts.servers += "/accumulo/" + instance.getInstanceID(); org.apache.zookeeper.ZooKeeperMain .main(new String[] {"-server", opts.servers, "-timeout", "" + (opts.timeout * 1000)}); } }
/** * 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 ZooKeeperMainServer().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. if (hasCommandLineArguments(args)) { HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain zkm = new HACK_UNTIL_ZOOKEEPER_1897_ZooKeeperMain(newArgs); zkm.runCmdLine(); } else { ZooKeeperMain.main(newArgs); } } }
/** * 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); } } }