public class ZkMaintenanceUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ZkMaintenanceUtils.VISIT_ORDER |
static interface |
ZkMaintenanceUtils.ZkVisitor |
Modifier and Type | Method and Description |
---|---|
static void |
clean(SolrZkClient zkClient,
String path) |
static void |
clean(SolrZkClient zkClient,
String path,
Predicate<String> filter)
Delete a path and all of its sub nodes
|
static String |
createZkNodeName(String zkRoot,
Path root,
Path file) |
static void |
downConfig(SolrZkClient zkClient,
String confName,
Path confPath) |
static void |
downloadFromZK(SolrZkClient zkClient,
String zkPath,
Path file) |
static String |
listZnode(SolrZkClient zkClient,
String path,
Boolean recurse)
Lists a ZNode child and (optionally) the znodes of all the children.
|
static void |
moveZnode(SolrZkClient zkClient,
String src,
String dst) |
static void |
traverseZkTree(SolrZkClient zkClient,
String path,
ZkMaintenanceUtils.VISIT_ORDER visitOrder,
ZkMaintenanceUtils.ZkVisitor visitor)
Recursively visit a zk tree rooted at path and apply the given visitor to each path.
|
static void |
upConfig(SolrZkClient zkClient,
Path confPath,
String confName) |
static void |
uploadToZK(SolrZkClient zkClient,
Path fromPath,
String zkPath,
Pattern filenameExclusions) |
static void |
zkTransfer(SolrZkClient zkClient,
String src,
Boolean srcIsZk,
String dst,
Boolean dstIsZk,
Boolean recurse)
Copy between local file system and Zookeeper, or from one Zookeeper node to another,
optionally copying recursively.
|
public static String listZnode(SolrZkClient zkClient, String path, Boolean recurse) throws org.apache.zookeeper.KeeperException, InterruptedException, SolrServerException
path
- The node to remove on Zookeeperrecurse
- Whether to remove children.org.apache.zookeeper.KeeperException
- Could not perform the Zookeeper operation.InterruptedException
- Thread interruptedSolrServerException
- zookeeper node has children and recurse not specified.public static void zkTransfer(SolrZkClient zkClient, String src, Boolean srcIsZk, String dst, Boolean dstIsZk, Boolean recurse) throws SolrServerException, org.apache.zookeeper.KeeperException, InterruptedException, IOException
src
- Source to copy from. Both src and dst may be Znodes. However, both may NOT be localdst
- The place to copy the files too. Both src and dst may be Znodes. However both may NOT be localrecurse
- if the source is a directory, reccursively copy the contents iff this is true.SolrServerException
- Explanatory exception due to bad params, failed operation, etc.org.apache.zookeeper.KeeperException
- Could not perform the Zookeeper operation.InterruptedException
- Thread interruptedIOException
public static void moveZnode(SolrZkClient zkClient, String src, String dst) throws SolrServerException, org.apache.zookeeper.KeeperException, InterruptedException
SolrServerException
org.apache.zookeeper.KeeperException
InterruptedException
public static void downConfig(SolrZkClient zkClient, String confName, Path confPath) throws IOException
IOException
public static void upConfig(SolrZkClient zkClient, Path confPath, String confName) throws IOException
IOException
public static void clean(SolrZkClient zkClient, String path) throws InterruptedException, org.apache.zookeeper.KeeperException
InterruptedException
org.apache.zookeeper.KeeperException
public static void clean(SolrZkClient zkClient, String path, Predicate<String> filter) throws InterruptedException, org.apache.zookeeper.KeeperException
filter
- for node to be deletedInterruptedException
org.apache.zookeeper.KeeperException
public static void uploadToZK(SolrZkClient zkClient, Path fromPath, String zkPath, Pattern filenameExclusions) throws IOException
IOException
public static void downloadFromZK(SolrZkClient zkClient, String zkPath, Path file) throws IOException
IOException
public static void traverseZkTree(SolrZkClient zkClient, String path, ZkMaintenanceUtils.VISIT_ORDER visitOrder, ZkMaintenanceUtils.ZkVisitor visitor) throws InterruptedException, org.apache.zookeeper.KeeperException
path
- the path to start fromvisitOrder
- whether to call the visitor at the at the ending or beginning of the run.visitor
- the operation to perform on each pathInterruptedException
org.apache.zookeeper.KeeperException
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.