public class MiniSolrCloudCluster extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CLOUD_SOLR_XML |
Constructor and Description |
---|
MiniSolrCloudCluster(int numServers,
Path baseDir,
org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig)
Create a MiniSolrCloudCluster with default solr.xml
|
MiniSolrCloudCluster(int numServers,
Path baseDir,
String solrXml,
org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig)
Create a MiniSolrCloudCluster
|
MiniSolrCloudCluster(int numServers,
Path baseDir,
String solrXml,
org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig,
ZkTestServer zkTestServer)
Create a MiniSolrCloudCluster
|
MiniSolrCloudCluster(int numServers,
String hostContext,
Path baseDir,
String solrXml,
SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> extraServlets,
SortedMap<Class<? extends javax.servlet.Filter>,String> extraRequestFilters)
Create a MiniSolrCloudCluster
|
MiniSolrCloudCluster(int numServers,
String hostContext,
Path baseDir,
String solrXml,
SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> extraServlets,
SortedMap<Class<? extends javax.servlet.Filter>,String> extraRequestFilters,
org.apache.solr.client.solrj.embedded.SSLConfig sslConfig)
Create a MiniSolrCloudCluster
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.solr.client.solrj.impl.CloudSolrClient |
buildSolrClient() |
void |
deleteAllCollections() |
void |
expireZkSession(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
Make the zookeeper session on a particular jetty expire
|
Path |
getBaseDir() |
org.apache.solr.client.solrj.embedded.JettySolrRunner |
getJettySolrRunner(int index) |
List<org.apache.solr.client.solrj.embedded.JettySolrRunner> |
getJettySolrRunners() |
org.apache.solr.client.solrj.embedded.JettySolrRunner |
getRandomJetty(Random random) |
org.apache.solr.client.solrj.embedded.JettySolrRunner |
getReplicaJetty(org.apache.solr.common.cloud.Replica replica)
Return the jetty that a particular replica resides on
|
org.apache.solr.client.solrj.impl.CloudSolrClient |
getSolrClient() |
org.apache.solr.common.cloud.SolrZkClient |
getZkClient() |
ZkTestServer |
getZkServer() |
void |
injectChaos(Random random) |
void |
shutdown()
Shut down the cluster, including all Solr nodes and ZooKeeper
|
org.apache.solr.client.solrj.embedded.JettySolrRunner |
startJettySolrRunner()
Start a new Solr instance, using the default config
|
org.apache.solr.client.solrj.embedded.JettySolrRunner |
startJettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
Add a previously stopped node back to the cluster
|
org.apache.solr.client.solrj.embedded.JettySolrRunner |
startJettySolrRunner(String name,
String hostContext,
org.apache.solr.client.solrj.embedded.JettyConfig config)
Start a new Solr instance on a particular servlet context
|
org.apache.solr.client.solrj.embedded.JettySolrRunner |
startJettySolrRunner(String name,
String hostContext,
SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> extraServlets,
SortedMap<Class<? extends javax.servlet.Filter>,String> extraRequestFilters)
Start a new Solr instance
|
org.apache.solr.client.solrj.embedded.JettySolrRunner |
startJettySolrRunner(String name,
String hostContext,
SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> extraServlets,
SortedMap<Class<? extends javax.servlet.Filter>,String> extraRequestFilters,
org.apache.solr.client.solrj.embedded.SSLConfig sslConfig)
Start a new Solr instance
|
org.apache.solr.client.solrj.embedded.JettySolrRunner |
stopJettySolrRunner(int index)
Stop a Solr instance
|
org.apache.solr.client.solrj.embedded.JettySolrRunner |
stopJettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty) |
void |
uploadConfigSet(Path configDir,
String configName)
Upload a config set
|
void |
waitForAllNodes(int timeout)
Wait for all Solr nodes to be live
|
public static final String DEFAULT_CLOUD_SOLR_XML
public MiniSolrCloudCluster(int numServers, Path baseDir, org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig) throws Exception
numServers
- number of Solr servers to startbaseDir
- base directory that the mini cluster should be run fromjettyConfig
- Jetty configurationException
- if there was an error starting the clusterpublic MiniSolrCloudCluster(int numServers, String hostContext, Path baseDir, String solrXml, SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> extraServlets, SortedMap<Class<? extends javax.servlet.Filter>,String> extraRequestFilters) throws Exception
numServers
- number of Solr servers to starthostContext
- context path of Solr servers used by JettybaseDir
- base directory that the mini cluster should be run fromsolrXml
- solr.xml file to be uploaded to ZooKeeperextraServlets
- Extra servlets to be started by JettyextraRequestFilters
- extra filters to be started by JettyException
- if there was an error starting the clusterpublic MiniSolrCloudCluster(int numServers, String hostContext, Path baseDir, String solrXml, SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> extraServlets, SortedMap<Class<? extends javax.servlet.Filter>,String> extraRequestFilters, org.apache.solr.client.solrj.embedded.SSLConfig sslConfig) throws Exception
numServers
- number of Solr servers to starthostContext
- context path of Solr servers used by JettybaseDir
- base directory that the mini cluster should be run fromsolrXml
- solr.xml file to be uploaded to ZooKeeperextraServlets
- Extra servlets to be started by JettyextraRequestFilters
- extra filters to be started by JettysslConfig
- SSL configurationException
- if there was an error starting the clusterpublic MiniSolrCloudCluster(int numServers, Path baseDir, String solrXml, org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig) throws Exception
numServers
- number of Solr servers to startbaseDir
- base directory that the mini cluster should be run fromsolrXml
- solr.xml file to be uploaded to ZooKeeperjettyConfig
- Jetty configurationException
- if there was an error starting the clusterpublic MiniSolrCloudCluster(int numServers, Path baseDir, String solrXml, org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig, ZkTestServer zkTestServer) throws Exception
numServers
- number of Solr servers to startbaseDir
- base directory that the mini cluster should be run fromsolrXml
- solr.xml file to be uploaded to ZooKeeperjettyConfig
- Jetty configurationzkTestServer
- ZkTestServer to use. If null, one will be createdException
- if there was an error starting the clusterpublic void waitForAllNodes(int timeout) throws IOException, InterruptedException
timeout
- number of seconds to wait before throwing an IllegalStateExceptionIOException
- if there was an error communicating with ZooKeeperInterruptedException
- if the calling thread is interrupted during the wait operationpublic ZkTestServer getZkServer()
public List<org.apache.solr.client.solrj.embedded.JettySolrRunner> getJettySolrRunners()
public org.apache.solr.client.solrj.embedded.JettySolrRunner getRandomJetty(Random random)
public org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner(String name, String hostContext, SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> extraServlets, SortedMap<Class<? extends javax.servlet.Filter>,String> extraRequestFilters) throws Exception
hostContext
- context path of Solr servers used by JettyextraServlets
- Extra servlets to be started by JettyextraRequestFilters
- extra filters to be started by JettyException
public org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner(String name, String hostContext, SortedMap<org.eclipse.jetty.servlet.ServletHolder,String> extraServlets, SortedMap<Class<? extends javax.servlet.Filter>,String> extraRequestFilters, org.apache.solr.client.solrj.embedded.SSLConfig sslConfig) throws Exception
hostContext
- context path of Solr servers used by JettyextraServlets
- Extra servlets to be started by JettyextraRequestFilters
- extra filters to be started by JettysslConfig
- SSL configurationException
public org.apache.solr.client.solrj.embedded.JettySolrRunner getJettySolrRunner(int index)
public org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner(String name, String hostContext, org.apache.solr.client.solrj.embedded.JettyConfig config) throws Exception
name
- the instance namehostContext
- the context to run onconfig
- a JettyConfig for the instance's JettySolrRunner
Exception
public org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner() throws Exception
Exception
public org.apache.solr.client.solrj.embedded.JettySolrRunner stopJettySolrRunner(int index) throws Exception
index
- the index of node in collection returned by getJettySolrRunners()
Exception
public org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty) throws Exception
jetty
- a JettySolrRunner
previously returned by stopJettySolrRunner(int)
Exception
- on errorpublic org.apache.solr.client.solrj.embedded.JettySolrRunner stopJettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty) throws Exception
Exception
public void uploadConfigSet(Path configDir, String configName) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException
configDir
- a path to the config set to uploadconfigName
- the name to give the configsetIOException
org.apache.zookeeper.KeeperException
InterruptedException
public void shutdown() throws Exception
Exception
public Path getBaseDir()
public org.apache.solr.client.solrj.impl.CloudSolrClient getSolrClient()
public org.apache.solr.common.cloud.SolrZkClient getZkClient()
protected org.apache.solr.client.solrj.impl.CloudSolrClient buildSolrClient()
public org.apache.solr.client.solrj.embedded.JettySolrRunner getReplicaJetty(org.apache.solr.common.cloud.Replica replica)
public void expireZkSession(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.