public class SolrCLI extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SolrCLI.ApiTool
Used to send an arbitrary HTTP request to a Solr API endpoint.
|
static class |
SolrCLI.AssertionFailureException |
static class |
SolrCLI.AssertTool
Asserts various conditions and exists with error code if fails, else continues with no output
|
static class |
SolrCLI.AuthTool |
static class |
SolrCLI.AutoscalingTool |
static class |
SolrCLI.ConfigSetDownloadTool |
static class |
SolrCLI.ConfigSetUploadTool |
static class |
SolrCLI.ConfigTool
Sends a POST to the Config API to perform a specified action.
|
static class |
SolrCLI.CreateCollectionTool
Supports create_collection command in the bin/solr script.
|
static class |
SolrCLI.CreateCoreTool |
static class |
SolrCLI.CreateTool |
static class |
SolrCLI.DeleteTool |
static class |
SolrCLI.HealthcheckTool
Requests health information about a specific collection in SolrCloud.
|
static class |
SolrCLI.RunExampleTool
Supports an interactive session with the user to launch (or relaunch the -e cloud example)
|
static class |
SolrCLI.SolrCloudTool
Helps build SolrCloud aware tools by initializing a CloudSolrClient
instance before running the tool.
|
static class |
SolrCLI.StatusTool
Get the status of a Solr server.
|
static interface |
SolrCLI.Tool
Defines the interface to a Solr tool that can be run from this command-line app.
|
static class |
SolrCLI.ToolBase |
static class |
SolrCLI.UtilsTool |
static class |
SolrCLI.ZkCpTool |
static class |
SolrCLI.ZkLsTool |
static class |
SolrCLI.ZkMkrootTool |
static class |
SolrCLI.ZkMvTool |
static class |
SolrCLI.ZkRmTool |
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.cli.Option[] |
cloudOptions |
static String |
DEFAULT_SOLR_URL |
static String |
JSON_CONTENT_TYPE |
static String |
ZK_HOST |
Constructor and Description |
---|
SolrCLI() |
Modifier and Type | Method and Description |
---|---|
static List<String> |
asList(String jsonPath,
Map<String,Object> json)
Helper function for reading a List of Strings from a JSON Object tree.
|
static Long |
asLong(String jsonPath,
Map<String,Object> json)
Helper function for reading a Long value from a JSON Object tree.
|
static Map<String,Object> |
asMap(String jsonPath,
Map<String,Object> json)
Helper function for reading a Map from a JSON Object tree.
|
static String |
asString(String jsonPath,
Map<String,Object> json)
Helper function for reading a String value from a JSON Object tree.
|
static Object |
atPath(String jsonPath,
Map<String,Object> json)
Helper function for reading an Object of unknown type from a JSON Object tree.
|
static boolean |
checkCommunicationError(Exception exc)
Determine if a request to Solr failed due to a communication error,
which is generally retry-able.
|
protected static void |
checkSslStoreSysProp(String solrInstallDir,
String key) |
static void |
closeHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient) |
static SolrCLI.Tool |
findTool(String[] args) |
static org.apache.commons.cli.Option[] |
getCommonToolOptions()
Support options common to all tools.
|
static org.apache.http.impl.client.CloseableHttpClient |
getHttpClient() |
static Map<String,Object> |
getJson(org.apache.http.client.HttpClient httpClient,
String getUrl)
Utility function for sending HTTP GET request to Solr and then doing some
validation of the response.
|
static Map<String,Object> |
getJson(org.apache.http.client.HttpClient httpClient,
String getUrl,
int attempts,
boolean isFirstAttempt)
Utility function for sending HTTP GET request to Solr with built-in retry support.
|
static Map<String,Object> |
getJson(String getUrl)
Useful when a tool just needs to send one request to Solr.
|
static String |
getZkHost(org.apache.commons.cli.CommandLine cli)
Get the ZooKeeper connection string from either the zkHost command-line option or by looking it
up from a running Solr instance based on the solrUrl option.
|
static org.apache.commons.cli.Option[] |
joinCommonAndToolOptions(org.apache.commons.cli.Option[] toolOpts) |
static org.apache.commons.cli.Option[] |
joinOptions(org.apache.commons.cli.Option[] lhs,
org.apache.commons.cli.Option[] rhs) |
static void |
main(String[] args)
Runs a tool.
|
static org.apache.commons.cli.CommandLine |
parseCmdLine(String[] args,
org.apache.commons.cli.Option[] toolOptions) |
static <T> T |
pathAs(Class<T> clazz,
String jsonPath,
Map<String,Object> json) |
static NamedList<Object> |
postJsonToSolr(SolrClient solrClient,
String updatePath,
String jsonBody) |
static org.apache.commons.cli.CommandLine |
processCommandLineArgs(org.apache.commons.cli.Option[] customOptions,
String[] args)
Parses the command-line arguments passed by the user.
|
static String |
resolveSolrUrl(org.apache.commons.cli.CommandLine cli)
Get the base URL of a live Solr instance from either the solrUrl command-line option from ZooKeeper.
|
static boolean |
safeCheckCollectionExists(String url,
String collection) |
static boolean |
safeCheckCoreExists(String coreStatusUrl,
String coreName) |
public static final String DEFAULT_SOLR_URL
public static final String ZK_HOST
public static org.apache.commons.cli.Option[] cloudOptions
public static final String JSON_CONTENT_TYPE
public static SolrCLI.Tool findTool(String[] args) throws Exception
Exception
public static org.apache.commons.cli.CommandLine parseCmdLine(String[] args, org.apache.commons.cli.Option[] toolOptions) throws Exception
Exception
public static org.apache.commons.cli.Option[] getCommonToolOptions()
public static org.apache.commons.cli.Option[] joinCommonAndToolOptions(org.apache.commons.cli.Option[] toolOpts)
public static org.apache.commons.cli.Option[] joinOptions(org.apache.commons.cli.Option[] lhs, org.apache.commons.cli.Option[] rhs)
public static org.apache.commons.cli.CommandLine processCommandLineArgs(org.apache.commons.cli.Option[] customOptions, String[] args)
public static boolean checkCommunicationError(Exception exc)
public static org.apache.http.impl.client.CloseableHttpClient getHttpClient()
public static void closeHttpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)
public static NamedList<Object> postJsonToSolr(SolrClient solrClient, String updatePath, String jsonBody) throws Exception
Exception
public static Map<String,Object> getJson(String getUrl) throws Exception
Exception
public static Map<String,Object> getJson(org.apache.http.client.HttpClient httpClient, String getUrl, int attempts, boolean isFirstAttempt) throws Exception
Exception
public static Map<String,Object> getJson(org.apache.http.client.HttpClient httpClient, String getUrl) throws Exception
Exception
public static String asString(String jsonPath, Map<String,Object> json)
public static Long asLong(String jsonPath, Map<String,Object> json)
public static List<String> asList(String jsonPath, Map<String,Object> json)
public static Map<String,Object> asMap(String jsonPath, Map<String,Object> json)
public static Object atPath(String jsonPath, Map<String,Object> json)
public static String resolveSolrUrl(org.apache.commons.cli.CommandLine cli) throws Exception
Exception
public static String getZkHost(org.apache.commons.cli.CommandLine cli) throws Exception
Exception
public static boolean safeCheckCollectionExists(String url, String collection)
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.