mirror of https://github.com/apache/lucene.git
SOLR-4498: Add list command to ZkCLI that prints out the contents of ZooKeeper.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1449578 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
36d854be91
commit
1115ba8aba
|
@ -81,6 +81,9 @@ New Features
|
|||
* SOLR-4488: Return slave replication details for a master if the master has
|
||||
also acted like a slave. (Mark Miller)
|
||||
|
||||
* SOLR-4498: Add list command to ZkCLI that prints out the contents of
|
||||
ZooKeeper. (Roman Shaposhnik via Mark Miller)
|
||||
|
||||
Bug Fixes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ public class ZkCLI {
|
|||
private static final String UPCONFIG = "upconfig";
|
||||
private static final String COLLECTION = "collection";
|
||||
private static final String CLEAR = "clear";
|
||||
private static final String LIST = "list";
|
||||
private static final String CMD = "cmd";
|
||||
|
||||
/**
|
||||
|
@ -85,7 +86,7 @@ public class ZkCLI {
|
|||
.hasArg(true)
|
||||
.withDescription(
|
||||
"cmd to run: " + BOOTSTRAP + ", " + UPCONFIG + ", " + DOWNCONFIG
|
||||
+ ", " + LINKCONFIG + ", " + MAKEPATH + ", "+ CLEAR).create(CMD));
|
||||
+ ", " + LINKCONFIG + ", " + MAKEPATH + ", "+ LIST + ", " +CLEAR).create(CMD));
|
||||
|
||||
Option zkHostOption = new Option("z", ZKHOST, true,
|
||||
"ZooKeeper host address");
|
||||
|
@ -129,6 +130,7 @@ public class ZkCLI {
|
|||
System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + LINKCONFIG + " -" + COLLECTION + " collection1" + " -" + CONFNAME + " myconf");
|
||||
System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + MAKEPATH + " /apache/solr");
|
||||
System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + CLEAR + " /solr");
|
||||
System.out.println("zkcli.sh -zkhost localhost:9983 -cmd " + LIST);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -216,6 +218,8 @@ public class ZkCLI {
|
|||
String confName = line.getOptionValue(CONFNAME);
|
||||
|
||||
ZkController.linkConfSet(zkClient, collection, confName);
|
||||
} else if (line.getOptionValue(CMD).equals(LIST)) {
|
||||
zkClient.printLayoutToStdOut();
|
||||
} else if (line.getOptionValue(CMD).equals(CLEAR)) {
|
||||
List arglist = line.getArgList();
|
||||
if (arglist.size() != 1) {
|
||||
|
|
|
@ -121,6 +121,14 @@ public class ZkCLITest extends SolrTestCaseJ4 {
|
|||
assertTrue(zkClient.exists("/path/mynewpath", true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testList() throws Exception {
|
||||
zkClient.makePath("/test", true);
|
||||
String[] args = new String[] {"-zkhost", zkServer.getZkAddress(), "-cmd",
|
||||
"list"};
|
||||
ZkCLI.main(args);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpConfigLinkConfigClearZk() throws Exception {
|
||||
// test upconfig
|
||||
|
|
Loading…
Reference in New Issue