Class ModifiedCloudSolrClient.Builder
- java.lang.Object
-
- org.apache.manifoldcf.agents.output.solr.ModifiedCloudHttp2SolrClient.Builder
-
- org.apache.manifoldcf.agents.output.solr.ModifiedCloudSolrClient.Builder
-
- Enclosing class:
- ModifiedCloudSolrClient
public static class ModifiedCloudSolrClient.Builder extends ModifiedCloudHttp2SolrClient.Builder
ConstructsCloudSolrClient
instances from provided configuration.
-
-
Field Summary
-
Fields inherited from class org.apache.manifoldcf.agents.output.solr.ModifiedCloudHttp2SolrClient.Builder
directUpdatesToLeadersOnly, httpClient, internalClientBuilder, parallelUpdates, shardLeadersOnly, solrUrls, stateProvider, zkChroot, zkHosts
-
-
Constructor Summary
Constructors Constructor Description Builder(java.util.List<java.lang.String> solrUrls)
Provide a series of Solr URLs to be used when configuringCloudSolrClient
instances.Builder(java.util.List<java.lang.String> zkHosts, java.util.Optional<java.lang.String> zkChroot)
Provide a series of ZK hosts which will be used when configuringCloudSolrClient
instances.
-
Method Summary
-
Methods inherited from class org.apache.manifoldcf.agents.output.solr.ModifiedCloudHttp2SolrClient.Builder
build, sendDirectUpdatesToAnyShardReplica, sendDirectUpdatesToShardLeadersOnly, withHttpClient, withInternalClientBuilder, withParallelUpdates
-
-
-
-
Constructor Detail
-
Builder
public Builder(java.util.List<java.lang.String> solrUrls)
Provide a series of Solr URLs to be used when configuringCloudSolrClient
instances. The solr client will use these urls to understand the cluster topology, which solr nodes are active etc.Provided Solr URLs are expected to point to the root Solr path ("http://hostname:8983/solr"); they should not include any collections, cores, or other path components.
Usage example:
final List<String> solrBaseUrls = new ArrayList<String>(); solrBaseUrls.add("http://solr1:8983/solr"); solrBaseUrls.add("http://solr2:8983/solr"); solrBaseUrls.add("http://solr3:8983/solr"); final SolrClient client = new CloudSolrClient.Builder(solrBaseUrls).build();
-
Builder
public Builder(java.util.List<java.lang.String> zkHosts, java.util.Optional<java.lang.String> zkChroot)
Provide a series of ZK hosts which will be used when configuringCloudSolrClient
instances. This requires a dependency onsolr-solrj-zookeeper
which transitively depends on more JARs. The ZooKeeper based connection is the most reliable and performant means for CloudSolrClient to work. On the other hand, it means exposing ZooKeeper more broadly than to Solr nodes, which is a security risk.Usage example when Solr stores data at the ZooKeeper root ('/'):
final List<String> zkServers = new ArrayList<String>(); zkServers.add("zookeeper1:2181"); zkServers.add("zookeeper2:2181"); zkServers.add("zookeeper3:2181"); final SolrClient client = new CloudSolrClient.Builder(zkServers, Optional.empty()).build();
Usage example when Solr data is stored in a ZooKeeper chroot:final List<String> zkServers = new ArrayList<String>(); zkServers.add("zookeeper1:2181"); zkServers.add("zookeeper2:2181"); zkServers.add("zookeeper3:2181"); final SolrClient client = new CloudSolrClient.Builder(zkServers, Optional.of("/solr")).build();
- Parameters:
zkHosts
- a List of at least one ZooKeeper host and port (e.g. "zookeeper1:2181")zkChroot
- the path to the root ZooKeeper node containing Solr data. Providejava.util.Optional.empty()
if no ZK chroot is used.
-
-