org.apache.solr.cloud

## Class MiniSolrCloudCluster

- java.lang.Object
- - org.apache.solr.cloud.MiniSolrCloudCluster

-     public class MiniSolrCloudCluster
      extends Object

  "Mini" SolrCloud cluster to be used for testing

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_CLOUD_SOLR_XML`

  - ### Constructor Summary

    Constructors
    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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.apache.solr.client.solrj.impl.CloudSolrClient` | `buildSolrClient()`
    `org.apache.solr.common.util.NamedList<Object>` | `createCollection(String name, int numShards, int replicationFactor, String configName, Map<String,String> collectionProperties)` Deprecated. Use `CollectionAdminRequest.createCollection(String, String, int, int)`
    `org.apache.solr.common.util.NamedList<Object>` | `createCollection(String name, int numShards, int replicationFactor, String configName, String createNodeSet, String asyncId, Map<String,String> collectionProperties)` Deprecated. Use `CollectionAdminRequest.createCollection(String, String, int, int)`
    `void` | `deleteAllCollections()`
    `org.apache.solr.common.util.NamedList<Object>` | `deleteCollection(String name)` Deprecated. use `CollectionAdminRequest.deleteCollection(String)`
    `void` | `expireZkSession(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)` Make the zookeeper session on a particular jetty expire
    `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()`
    `ZkTestServer` | `getZkServer()`
    `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
    `protected org.apache.solr.client.solrj.embedded.JettySolrRunner` | `stopJettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)`
    `void` | `uploadConfigDir(File configDir, String configName)` Deprecated. Use `uploadConfigSet(Path, String)`
    `void` | `uploadConfigSet(Path configDir, String configName)` Upload a config set
    `void` | `waitForAllNodes(int timeout)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_CLOUD_SOLR_XML

          public static final String DEFAULT_CLOUD_SOLR_XML

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MiniSolrCloudCluster

          public MiniSolrCloudCluster(int numServers,
                                      Path baseDir,
                                      org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig)
                               throws Exception

      Create a MiniSolrCloudCluster with default solr.xml
      Parameters:
        `numServers` - number of Solr servers to start
        `baseDir` - base directory that the mini cluster should be run from
        `jettyConfig` - Jetty configuration
      Throws:
        `Exception` - if there was an error starting the cluster

    - #### MiniSolrCloudCluster

          public 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

      Create a MiniSolrCloudCluster
      Parameters:
        `numServers` - number of Solr servers to start
        `hostContext` - context path of Solr servers used by Jetty
        `baseDir` - base directory that the mini cluster should be run from
        `solrXml` - solr.xml file to be uploaded to ZooKeeper
        `extraServlets` - Extra servlets to be started by Jetty
        `extraRequestFilters` - extra filters to be started by Jetty
      Throws:
        `Exception` - if there was an error starting the cluster

    - #### MiniSolrCloudCluster

          public 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

      Create a MiniSolrCloudCluster
      Parameters:
        `numServers` - number of Solr servers to start
        `hostContext` - context path of Solr servers used by Jetty
        `baseDir` - base directory that the mini cluster should be run from
        `solrXml` - solr.xml file to be uploaded to ZooKeeper
        `extraServlets` - Extra servlets to be started by Jetty
        `extraRequestFilters` - extra filters to be started by Jetty
        `sslConfig` - SSL configuration
      Throws:
        `Exception` - if there was an error starting the cluster

    - #### MiniSolrCloudCluster

          public MiniSolrCloudCluster(int numServers,
                                      Path baseDir,
                                      String solrXml,
                                      org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig)
                               throws Exception

      Create a MiniSolrCloudCluster
      Parameters:
        `numServers` - number of Solr servers to start
        `baseDir` - base directory that the mini cluster should be run from
        `solrXml` - solr.xml file to be uploaded to ZooKeeper
        `jettyConfig` - Jetty configuration
      Throws:
        `Exception` - if there was an error starting the cluster

    - #### MiniSolrCloudCluster

          public MiniSolrCloudCluster(int numServers,
                                      Path baseDir,
                                      String solrXml,
                                      org.apache.solr.client.solrj.embedded.JettyConfig jettyConfig,
                                      ZkTestServer zkTestServer)
                               throws Exception

      Create a MiniSolrCloudCluster
      Parameters:
        `numServers` - number of Solr servers to start
        `baseDir` - base directory that the mini cluster should be run from
        `solrXml` - solr.xml file to be uploaded to ZooKeeper
        `jettyConfig` - Jetty configuration
        `zkTestServer` - ZkTestServer to use. If null, one will be created
      Throws:
        `Exception` - if there was an error starting the cluster

  - ### Method Detail

    - #### waitForAllNodes

          public void waitForAllNodes(int timeout)
                               throws IOException,
                                      InterruptedException

      Throws:
        `IOException`
        `InterruptedException`

    - #### getZkServer

          public ZkTestServer getZkServer()

      Returns:
        ZooKeeper server used by the MiniCluster

    - #### getJettySolrRunners

          public List<org.apache.solr.client.solrj.embedded.JettySolrRunner> getJettySolrRunners()

      Returns:
        Unmodifiable list of all the currently started Solr Jettys.

    - #### getRandomJetty

          public org.apache.solr.client.solrj.embedded.JettySolrRunner getRandomJetty(Random random)

      Returns:
        a randomly-selected Jetty

    - #### startJettySolrRunner

          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

      Start a new Solr instance
      Parameters:
        `hostContext` - context path of Solr servers used by Jetty
        `extraServlets` - Extra servlets to be started by Jetty
        `extraRequestFilters` - extra filters to be started by Jetty
      Returns:
        new Solr instance
      Throws:
        `Exception`

    - #### startJettySolrRunner

          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

      Start a new Solr instance
      Parameters:
        `hostContext` - context path of Solr servers used by Jetty
        `extraServlets` - Extra servlets to be started by Jetty
        `extraRequestFilters` - extra filters to be started by Jetty
        `sslConfig` - SSL configuration
      Returns:
        new Solr instance
      Throws:
        `Exception`

    - #### startJettySolrRunner

          public org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner(String name,
                                                                                            String hostContext,
                                                                                            org.apache.solr.client.solrj.embedded.JettyConfig config)
                                                                                     throws Exception

      Start a new Solr instance on a particular servlet context
      Parameters:
        `name` - the instance name
        `hostContext` - the context to run on
        `config` - a JettyConfig for the instance's `JettySolrRunner`
      Returns:
        a JettySolrRunner
      Throws:
        `Exception`

    - #### startJettySolrRunner

          public org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner()
                                                                                     throws Exception

      Start a new Solr instance, using the default config
      Returns:
        a JettySolrRunner
      Throws:
        `Exception`

    - #### stopJettySolrRunner

          public org.apache.solr.client.solrj.embedded.JettySolrRunner stopJettySolrRunner(int index)
                                                                                    throws Exception

      Stop a Solr instance
      Parameters:
        `index` - the index of node in collection returned by `getJettySolrRunners()`
      Returns:
        the shut down node
      Throws:
        `Exception`

    - #### startJettySolrRunner

          public org.apache.solr.client.solrj.embedded.JettySolrRunner startJettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
                                                                                     throws Exception

      Add a previously stopped node back to the cluster
      Parameters:
        `jetty` - a `JettySolrRunner` previously returned by `stopJettySolrRunner(int)`
      Returns:
        the started node
      Throws:
        `Exception` - on error

    - #### stopJettySolrRunner

          protected org.apache.solr.client.solrj.embedded.JettySolrRunner stopJettySolrRunner(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)
                                                                                       throws Exception

      Throws:
        `Exception`

    - #### uploadConfigDir

          @Deprecated
          public void uploadConfigDir(File configDir,
                                                  String configName)
                                           throws IOException,
                                                  org.apache.zookeeper.KeeperException,
                                                  InterruptedException

      Deprecated. Use `uploadConfigSet(Path, String)`
      Throws:
        `IOException`
        `org.apache.zookeeper.KeeperException`
        `InterruptedException`

    - #### uploadConfigSet

          public void uploadConfigSet(Path configDir,
                                      String configName)
                               throws IOException,
                                      org.apache.zookeeper.KeeperException,
                                      InterruptedException

      Upload a config set
      Parameters:
        `configDir` - a path to the config set to upload
        `configName` - the name to give the configset
      Throws:
        `IOException`
        `org.apache.zookeeper.KeeperException`
        `InterruptedException`

    - #### deleteAllCollections

          public void deleteAllCollections()
                                    throws Exception

      Throws:
        `Exception`

    - #### createCollection

          @Deprecated
          public org.apache.solr.common.util.NamedList<Object> createCollection(String name,
                                                                                            int numShards,
                                                                                            int replicationFactor,
                                                                                            String configName,
                                                                                            Map<String,String> collectionProperties)
                                                                                     throws org.apache.solr.client.solrj.SolrServerException,
                                                                                            IOException

      Deprecated. Use `CollectionAdminRequest.createCollection(String, String, int, int)`
      Throws:
        `org.apache.solr.client.solrj.SolrServerException`
        `IOException`

    - #### createCollection

          @Deprecated
          public org.apache.solr.common.util.NamedList<Object> createCollection(String name,
                                                                                            int numShards,
                                                                                            int replicationFactor,
                                                                                            String configName,
                                                                                            String createNodeSet,
                                                                                            String asyncId,
                                                                                            Map<String,String> collectionProperties)
                                                                                     throws org.apache.solr.client.solrj.SolrServerException,
                                                                                            IOException

      Deprecated. Use `CollectionAdminRequest.createCollection(String, String, int, int)`
      Throws:
        `org.apache.solr.client.solrj.SolrServerException`
        `IOException`

    - #### deleteCollection

          @Deprecated
          public org.apache.solr.common.util.NamedList<Object> deleteCollection(String name)
                                                                                     throws org.apache.solr.client.solrj.SolrServerException,
                                                                                            IOException

      Deprecated. use `CollectionAdminRequest.deleteCollection(String)`
      Throws:
        `org.apache.solr.client.solrj.SolrServerException`
        `IOException`

    - #### shutdown

          public void shutdown()
                        throws Exception

      Shut down the cluster, including all Solr nodes and ZooKeeper
      Throws:
        `Exception`

    - #### getSolrClient

          public org.apache.solr.client.solrj.impl.CloudSolrClient getSolrClient()

    - #### buildSolrClient

          protected org.apache.solr.client.solrj.impl.CloudSolrClient buildSolrClient()

    - #### getReplicaJetty

          public org.apache.solr.client.solrj.embedded.JettySolrRunner getReplicaJetty(org.apache.solr.common.cloud.Replica replica)

      Return the jetty that a particular replica resides on

    - #### expireZkSession

          public void expireZkSession(org.apache.solr.client.solrj.embedded.JettySolrRunner jetty)

      Make the zookeeper session on a particular jetty expire

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.