gpt4 book ai didi

org.apache.solr.client.solrj.impl.ZkClientClusterStateProvider.uploadConfig()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 13:02:09 28 4
gpt4 key购买 nike

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

ZkClientClusterStateProvider.uploadConfig介绍

[英]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.
[中]将一组配置文件上传到Zookeeper,并给它一个名称注释:您应该只允许受信任的用户上传配置。如果您允许客户端访问zookeeper,则应保护/configs节点免受未经授权的写访问。

代码示例

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

/**
 * Configure, run and return the {@link MiniSolrCloudCluster}
 * @throws Exception if an error occurs on startup
 */
public MiniSolrCloudCluster build() throws Exception {
 MiniSolrCloudCluster cluster = new MiniSolrCloudCluster(nodeCount, baseDir, solrxml, jettyConfig, null, securityJson);
 CloudSolrClient client = cluster.getSolrClient();
 for (Config config : configs) {
  ((ZkClientClusterStateProvider)client.getClusterStateProvider()).uploadConfig(config.path, config.name);
 }
 if (clusterProperties.size() > 0) {
  ClusterProperties props = new ClusterProperties(cluster.getSolrClient().getZkStateReader().getZkClient());
  for (Map.Entry<String, String> entry : clusterProperties.entrySet()) {
   props.setClusterProperty(entry.getKey(), entry.getValue());
  }
 }
 return cluster;
}

代码示例来源:origin: edu.byu.hbll/solr

/**
 * Creates a SolrCloud collection if it doesn't already exist with the given config set.
 *
 * @deprecated since 1.2.0 use {@link SolrCollectionInitializer} instead.
 * @param zkHost host and optional port of one of a zookeeper instance (localhost:2181)
 * @param collectionName name of the collection to be created
 * @param configSetName name of the config set to use
 * @param configSetPath location of the config set (folder containing solr configs such as
 *     solrconfig.xml)
 * @throws IOException if something goes wrong with the upload
 * @throws SolrServerException if something goes wrong with the upload
 */
@Deprecated
public static void initSolr(
  String zkHost, String collectionName, String configSetName, Path configSetPath)
  throws IOException, SolrServerException {
 try (ZkClientClusterStateProvider provider = new ZkClientClusterStateProvider(zkHost)) {
  provider.uploadConfig(configSetPath, configSetName);
 }
 try (SolrClient solr = new CloudSolrClient.Builder().withZkHost(zkHost).build()) {
  List<String> existingCollectionNames = CollectionAdminRequest.listCollections(solr);
  if (!existingCollectionNames.contains(collectionName)) {
   solr.request(CollectionAdminRequest.createCollection(collectionName, configSetName, 1, 1));
  }
 }
}

代码示例来源:origin: edu.byu.hbll/solr

try (ZkClientClusterStateProvider provider =
  new ZkClientClusterStateProvider(zkHosts, chroot)) {
 provider.uploadConfig(configsetPath, configsetName);

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com