Class StatusTool

  • All Implemented Interfaces:
    Tool

    public class StatusTool
    extends ToolBase
    • Field Detail

      • OPTION_PORT

        public static final org.apache.commons.cli.Option OPTION_PORT
      • OPTION_SHORT

        public static final org.apache.commons.cli.Option OPTION_SHORT
    • Constructor Detail

      • StatusTool

        public StatusTool()
      • StatusTool

        public StatusTool​(PrintStream stdout)
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: Tool
        Defines the interface to a Solr tool that can be run from this command-line app.
      • getOptions

        public List<org.apache.commons.cli.Option> getOptions()
      • waitForSolrUpAndPrintStatus

        public void waitForSolrUpAndPrintStatus​(String solrUrl,
                                                org.apache.commons.cli.CommandLine cli,
                                                int maxWaitSecs)
                                         throws Exception
        Throws:
        Exception
      • waitForSolrUp

        public boolean waitForSolrUp​(String solrUrl,
                                     org.apache.commons.cli.CommandLine cli,
                                     int maxWaitSecs)
                              throws Exception
        Wait for Solr to come online and return true if it does, false otherwise.
        Parameters:
        solrUrl - the URL of the Solr server
        cli - the command line options
        maxWaitSecs - the maximum number of seconds to wait
        Returns:
        true if Solr comes online, false otherwise
        Throws:
        Exception
      • printStatusFromRunningSolr

        public boolean printStatusFromRunningSolr​(String solrUrl,
                                                  org.apache.commons.cli.CommandLine cli)
                                           throws Exception
        Throws:
        Exception
      • statusFromRunningSolr

        public String statusFromRunningSolr​(String solrUrl,
                                            org.apache.commons.cli.CommandLine cli)
                                     throws Exception
        Get the status of a Solr server and responds with a JSON status string.
        Parameters:
        solrUrl - the URL of the Solr server
        cli - the command line options
        Returns:
        the status of the Solr server or null if the server is not online
        Throws:
        Exception - if there is an error getting the status
      • reportStatus

        public Map<String,​Object> reportStatus​(org.apache.solr.common.util.NamedList<Object> info,
                                                     org.apache.solr.client.solrj.SolrClient solrClient)
                                              throws Exception
        Throws:
        Exception
      • getCloudStatus

        protected Map<String,​String> getCloudStatus​(org.apache.solr.client.solrj.SolrClient solrClient,
                                                          String zkHost)
                                                   throws Exception
        Calls the CLUSTERSTATUS endpoint in Solr to get basic status information about the SolrCloud cluster.
        Throws:
        Exception