public static void downConfig(SolrZkClient zkClient, String confName, Path confPath) throws IOException { ZkConfigManager manager = new ZkConfigManager(zkClient); // Try to download the configset manager.downloadConfigDir(confName, confPath); }
/** * Download and return the config directory from ZK */ public File downloadConfigDir(SolrZkClient zkClient, String configName, File dir) throws IOException, InterruptedException, KeeperException { Preconditions.checkArgument(dir.exists()); Preconditions.checkArgument(dir.isDirectory()); ZkConfigManager manager = new ZkConfigManager(zkClient); manager.downloadConfigDir(configName, dir.toPath()); File confDir = new File(dir, "conf"); if (!confDir.isDirectory()) { // create a temporary directory with "conf" subdir and mv the config in there. This is // necessary because of CDH-11188; solrctl does not generate nor accept directories with e.g. // conf/solrconfig.xml which is necessary for proper solr operation. This should work // even if solrctl changes. confDir = new File(Files.createTempDir().getAbsolutePath(), "conf"); confDir.getParentFile().deleteOnExit(); Files.move(dir, confDir); dir = confDir.getParentFile(); } verifyConfigDir(confDir); return dir; }
/** * Download a named config from Zookeeper to a location on the filesystem * @param configName the name of the config * @param downloadPath the path to write config files to * @throws IOException if an I/O exception occurs */ public void downloadConfig(String configName, Path downloadPath) throws IOException { connect(); zkStateReader.getConfigManager().downloadConfigDir(configName, downloadPath); }
/** * Download a named config from Zookeeper to a location on the filesystem * @param configName the name of the config * @param downloadPath the path to write config files to * @throws IOException if an I/O exception occurs */ public void downloadConfig(String configName, Path downloadPath) throws IOException { connect(); zkStateReader.getConfigManager().downloadConfigDir(configName, downloadPath); }
/** * Download and return the config directory from ZK */ public File downloadConfigDir(SolrZkClient zkClient, String configName, File dir) throws IOException, InterruptedException, KeeperException { Preconditions.checkArgument(dir.exists()); Preconditions.checkArgument(dir.isDirectory()); ZkConfigManager manager = new ZkConfigManager(zkClient); manager.downloadConfigDir(configName, dir.toPath()); File confDir = new File(dir, "conf"); if (!confDir.isDirectory()) { // create a temporary directory with "conf" subdir and mv the config in there. This is // necessary because of CDH-11188; solrctl does not generate nor accept directories with e.g. // conf/solrconfig.xml which is necessary for proper solr operation. This should work // even if solrctl changes. confDir = new File(Files.createTempDir().getAbsolutePath(), "conf"); confDir.getParentFile().deleteOnExit(); Files.move(dir, confDir); dir = confDir.getParentFile(); } verifyConfigDir(confDir); return dir; }
dir.deleteOnExit(); ZkConfigManager configManager = new ZkConfigManager(zkClient); configManager.downloadConfigDir(configName, dir.toPath()); File confDir = new File(dir, "conf"); if (!confDir.isDirectory()) {