Package org.apache.solr.common.cloud
Class ZkConfigManager
- java.lang.Object
-
- org.apache.solr.common.cloud.ZkConfigManager
-
public class ZkConfigManager extends Object
Class that manages named configs in Zookeeper
-
-
Field Summary
Fields Modifier and Type Field Description static String
CONFIGS_ZKNODE
ZkNode where named configs are storedstatic Pattern
UPLOAD_FILENAME_EXCLUDE_PATTERN
static String
UPLOAD_FILENAME_EXCLUDE_REGEX
-
Constructor Summary
Constructors Constructor Description ZkConfigManager(SolrZkClient zkClient)
Creates a new ZkConfigManager
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Boolean
configExists(String configName)
Check whether a config exists in Zookeepervoid
copyConfigDir(String fromConfig, String toConfig)
Copy a config in ZooKeepervoid
copyConfigDir(String fromConfig, String toConfig, Set<String> copiedToZkPaths)
Copy a config in ZooKeepervoid
deleteConfigDir(String configName)
Delete a config in ZooKeepervoid
downloadConfigDir(String configName, Path dir)
Download a config from Zookeeper and write it to the filesystemstatic Path
getConfigsetPath(String confDir, String configSetDir)
List<String>
listConfigs()
void
uploadConfigDir(Path dir, String configName)
Upload files from a given path to a config in Zookeepervoid
uploadConfigDir(Path dir, String configName, Pattern filenameExclusions)
Upload matching files from a given path to a config in Zookeeper
-
-
-
Field Detail
-
CONFIGS_ZKNODE
public static final String CONFIGS_ZKNODE
ZkNode where named configs are stored- See Also:
- Constant Field Values
-
UPLOAD_FILENAME_EXCLUDE_REGEX
public static final String UPLOAD_FILENAME_EXCLUDE_REGEX
- See Also:
- Constant Field Values
-
UPLOAD_FILENAME_EXCLUDE_PATTERN
public static final Pattern UPLOAD_FILENAME_EXCLUDE_PATTERN
-
-
Constructor Detail
-
ZkConfigManager
public ZkConfigManager(SolrZkClient zkClient)
Creates a new ZkConfigManager- Parameters:
zkClient
- theSolrZkClient
to use
-
-
Method Detail
-
uploadConfigDir
public void uploadConfigDir(Path dir, String configName) throws IOException
Upload files from a given path to a config in Zookeeper- Parameters:
dir
-Path
to the filesconfigName
- the name to give the config- Throws:
IOException
- if an I/O error occurs or the path does not exist
-
uploadConfigDir
public void uploadConfigDir(Path dir, String configName, Pattern filenameExclusions) throws IOException
Upload matching files from a given path to a config in Zookeeper- Parameters:
dir
-Path
to the filesconfigName
- the name to give the configfilenameExclusions
- files matching this pattern will not be uploaded- Throws:
IOException
- if an I/O error occurs or the path does not exist
-
downloadConfigDir
public void downloadConfigDir(String configName, Path dir) throws IOException
Download a config from Zookeeper and write it to the filesystem- Parameters:
configName
- the config to downloaddir
- thePath
to write files under- Throws:
IOException
- if an I/O error occurs or the config does not exist
-
listConfigs
public List<String> listConfigs() throws IOException
- Throws:
IOException
-
configExists
public Boolean configExists(String configName) throws IOException
Check whether a config exists in Zookeeper- Parameters:
configName
- the config to check existance on- Returns:
- whether the config exists or not
- Throws:
IOException
- if an I/O error occurs
-
deleteConfigDir
public void deleteConfigDir(String configName) throws IOException
Delete a config in ZooKeeper- Parameters:
configName
- the config to delete- Throws:
IOException
- if an I/O error occurs
-
copyConfigDir
public void copyConfigDir(String fromConfig, String toConfig) throws IOException
Copy a config in ZooKeeper- Parameters:
fromConfig
- the config to copy fromtoConfig
- the config to copy to- Throws:
IOException
- if an I/O error occurs
-
copyConfigDir
public void copyConfigDir(String fromConfig, String toConfig, Set<String> copiedToZkPaths) throws IOException
Copy a config in ZooKeeper- Parameters:
fromConfig
- the config to copy fromtoConfig
- the config to copy tocopiedToZkPaths
- should be an empty Set, will be filled in by function with the paths that were actually copied to.- Throws:
IOException
- if an I/O error occurs
-
getConfigsetPath
public static Path getConfigsetPath(String confDir, String configSetDir) throws IOException
- Throws:
IOException
-
-