org.apache.solr.common.cloud.ZkConfigManager.uploadConfigDir()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(73)

本文整理了Java中org.apache.solr.common.cloud.ZkConfigManager.uploadConfigDir()方法的一些代码示例,展示了ZkConfigManager.uploadConfigDir()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkConfigManager.uploadConfigDir()方法的具体详情如下:
包路径:org.apache.solr.common.cloud.ZkConfigManager
类名称:ZkConfigManager
方法名:uploadConfigDir

ZkConfigManager.uploadConfigDir介绍

[英]Upload files from a given path to a config in Zookeeper
[中]将文件从给定路径上载到Zookeeper中的配置

代码示例

代码示例来源:origin: org.apache.solr/solr-solrj

public static void upConfig(SolrZkClient zkClient, Path confPath, String confName) throws IOException {
 ZkConfigManager manager = new ZkConfigManager(zkClient);
 // Try to download the configset
 manager.uploadConfigDir(confPath, confName);
}

代码示例来源:origin: org.apache.solr/solr-solrj

/**
 * Upload a set of config files to Zookeeper and give it a name
 *
 * NOTE: You should only allow trusted users to upload configs.  If you
 * are allowing client access to zookeeper, you should protect the
 * /configs node against unauthorised write access.
 *
 * @param configPath {@link java.nio.file.Path} to the config files
 * @param configName the name of the config
 * @throws IOException if an IO error occurs
 */
public void uploadConfig(Path configPath, String configName) throws IOException {
 connect();
 zkStateReader.getConfigManager().uploadConfigDir(configPath, configName);
}

代码示例来源:origin: com.hynnet/solr-solrj

/**
 * Upload a set of config files to Zookeeper and give it a name
 *
 * NOTE: You should only allow trusted users to upload configs.  If you
 * are allowing client access to zookeeper, you should protect the
 * /configs node against unauthorised write access.
 *
 * @param configPath {@link java.nio.file.Path} to the config files
 * @param configName the name of the config
 * @throws IOException if an IO error occurs
 */
public void uploadConfig(Path configPath, String configName) throws IOException {
 connect();
 zkStateReader.getConfigManager().uploadConfigDir(configPath, configName);
}

代码示例来源:origin: jetoile/hadoop-unit

private void populateZkWithCollectionInfo() {
  System.setProperty("zkHost", zkHostString);
  try {
    URL url = ConfigurationUtils.locate(FileSystem.getDefaultFileSystem(), "", solrDirectory + "/collection1/conf");
    if (url == null) {
      try {
        url = new URL(solrDirectory + "/collection1/conf");
      } catch (MalformedURLException e) {
        LOGGER.error("unable to load solr config", e);
      }
    }
    URI solrDirectoryFile = url.toURI();
    try (SolrZkClient zkClient = new SolrZkClient(zkHostString, TIMEOUT, 45000, null)) {
      ZkConfigManager manager = new ZkConfigManager(zkClient);
      manager.uploadConfigDir(Paths.get(solrDirectoryFile), solrCollectionName);
    }
  } catch (URISyntaxException | IOException e) {
    LOGGER.error("unable to populate zookeeper", e);
  }
}

代码示例来源:origin: NGDATA/hbase-indexer

/**
 * Utility method to upload a Solr config into ZooKeeper. If you don't have the config in the form of
 * a filesystem directory, you might want to use {@link #uploadConfig(String, byte[], byte[])}.
 */
public void uploadConfig(String confName, File confDir) throws IOException {
  SolrZkClient zkClient = new SolrZkClient(zkConnectString, 30000, 30000,
      new OnReconnect() {
        @Override
        public void command() {
        }
      });
  new ZkConfigManager(zkClient).uploadConfigDir(confDir.toPath(), confName);
  zkClient.close();
}

代码示例来源:origin: com.ngdata/hbase-indexer-common

/**
 * Utility method to upload a Solr config into ZooKeeper. If you don't have the config in the form of
 * a filesystem directory, you might want to use {@link #uploadConfig(String, byte[], byte[])}.
 */
public void uploadConfig(String confName, File confDir) throws IOException {
  SolrZkClient zkClient = new SolrZkClient(zkConnectString, 30000, 30000,
      new OnReconnect() {
        @Override
        public void command() {
        }
      });
  new ZkConfigManager(zkClient).uploadConfigDir(confDir.toPath(), confName);
  zkClient.close();
}

代码示例来源:origin: org.apache.solr/solr-test-framework

/**
 * Upload a config set
 * @param configDir a path to the config set to upload
 * @param configName the name to give the configset
 */
public void uploadConfigSet(Path configDir, String configName) throws IOException, KeeperException, InterruptedException {
 try(SolrZkClient zkClient = new SolrZkClient(zkServer.getZkAddress(),
   AbstractZkTestCase.TIMEOUT, AbstractZkTestCase.TIMEOUT, null)) {
  ZkConfigManager manager = new ZkConfigManager(zkClient);
  manager.uploadConfigDir(configDir, configName);
 }
}

相关文章