public class MiniSolrCloudCluster extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MiniSolrCloudCluster.JettySolrRunnerWithMetrics |
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CLOUD_SOLR_XML |
static String |
SOLR_TESTS_SHARDS_WHITELIST |
| 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()
Delete all collections (and aliases)
|
void |
deleteAllConfigSets() |
static org.apache.solr.common.cloud.CollectionStatePredicate |
expectedShardsAndActiveReplicas(int expectedShards,
int expectedReplicas) |
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.cloud.Overseer |
getOpenOverseer() |
static org.apache.solr.cloud.Overseer |
getOpenOverseer(List<org.apache.solr.cloud.Overseer> overseers) |
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)
Stop the given Solr instance.
|
void |
uploadConfigSet(Path configDir,
String configName)
Upload a config set
|
void |
waitForActiveCollection(String collection,
int shards,
int totalReplicas) |
void |
waitForActiveCollection(String collection,
long wait,
TimeUnit unit,
int shards,
int totalReplicas) |
void |
waitForAllNodes(int timeout)
This method wait till all Solr JVMs ( Jettys ) are running .
|
void |
waitForJettyToStop(org.apache.solr.client.solrj.embedded.JettySolrRunner runner) |
void |
waitForNode(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty,
int timeoutSeconds) |
public static final String SOLR_TESTS_SHARDS_WHITELIST
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 waitForNode(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty,
int timeoutSeconds)
throws IOException,
InterruptedException,
TimeoutException
public void waitForAllNodes(int timeout)
throws IOException,
InterruptedException,
TimeoutException
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 operationTimeoutException - on timeout before all nodes being readypublic 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 JettyExceptionpublic 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 configurationExceptionpublic 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 JettySolrRunnerExceptionpublic org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner()
throws Exception
Exceptionpublic org.apache.solr.client.solrj.embedded.JettySolrRunner stopJettySolrRunner(int index)
throws Exception
index - the index of node in collection returned by getJettySolrRunners()Exceptionpublic 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
jetty - a JettySolrRunner to be stoppedJettySolrRunner instance provided to this methodException - on errorpublic 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 configsetIOExceptionorg.apache.zookeeper.KeeperExceptionInterruptedExceptionpublic void deleteAllCollections()
throws Exception
Exceptionpublic void deleteAllConfigSets()
throws org.apache.solr.client.solrj.SolrServerException,
IOException
org.apache.solr.client.solrj.SolrServerExceptionIOExceptionpublic void shutdown()
throws Exception
Exceptionpublic 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)
public org.apache.solr.cloud.Overseer getOpenOverseer()
public static org.apache.solr.cloud.Overseer getOpenOverseer(List<org.apache.solr.cloud.Overseer> overseers)
public void waitForActiveCollection(String collection, long wait, TimeUnit unit, int shards, int totalReplicas)
public void waitForActiveCollection(String collection, int shards, int totalReplicas)
public static org.apache.solr.common.cloud.CollectionStatePredicate expectedShardsAndActiveReplicas(int expectedShards,
int expectedReplicas)
public void waitForJettyToStop(org.apache.solr.client.solrj.embedded.JettySolrRunner runner)
throws TimeoutException
TimeoutExceptionCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.