Package org.apache.solr.handler.admin
Class ZookeeperStatusHandler
- java.lang.Object
-
- org.apache.solr.handler.RequestHandlerBase
-
- org.apache.solr.handler.admin.ZookeeperStatusHandler
-
- All Implemented Interfaces:
AutoCloseable
,ApiSupport
,SolrInfoBean
,NestedRequestHandler
,SolrMetricProducer
,SolrRequestHandler
,PermissionNameProvider
public class ZookeeperStatusHandler extends RequestHandlerBase
Zookeeper Status handler, talks to ZK using sockets and four-letter words- Since:
- solr 7.5
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.handler.RequestHandlerBase
RequestHandlerBase.HandlerMetrics
-
Nested classes/interfaces inherited from interface org.apache.solr.security.PermissionNameProvider
PermissionNameProvider.Name
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
-
Fields inherited from class org.apache.solr.handler.RequestHandlerBase
aggregateNodeLevelMetricsEnabled, appends, defaults, httpCaching, initArgs, invariants, metrics, solrMetricsContext
-
Fields inherited from interface org.apache.solr.security.PermissionNameProvider
ANY, NULL, values
-
Fields inherited from interface org.apache.solr.request.SolrRequestHandler
TYPE
-
-
Constructor Summary
Constructors Constructor Description ZookeeperStatusHandler(CoreContainer cc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SolrInfoBean.Category
getCategory()
Category of this componentString
getDescription()
Simple one or two line descriptionPermissionNameProvider.Name
getPermissionName(AuthorizationContext request)
protected List<String>
getZkRawResponse(String zkHostPort, String fourLetterWordCommand)
Sends a four-letter-word command to one particular Zookeeper server and returns the response as list of stringsprotected Map<String,Object>
getZkStatus(String zkHost, org.apache.solr.common.cloud.ZkDynamicConfig zkDynamicConfig)
For each zk host, resolved either from zk connection string or from zk dynamic reconfiguration config, fetch all config and status info from ZK API and returns as a map, where key is hostnamevoid
handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
protected Map<String,Object>
monitorZookeeper(String zkHostPort)
protected boolean
validateZkRawResponse(List<String> response, String zkHostPort, String fourLetterWordCommand)
Takes the raw response lines returned bygetZkRawResponse(String, String)
and runs some validations-
Methods inherited from class org.apache.solr.handler.RequestHandlerBase
getApis, getInitArgs, getMetricsForThisRequest, getName, getPluginInfo, getRequestHandler, getSolrMetricsContext, getSolrParamsFromNamedList, getSubHandler, handleRequest, init, initializeMetrics, isInternalShardRequest, normalizeReceivedException, processErrorMetricsOnException, setPluginInfo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.api.ApiSupport
getJerseyResources, registerV1, registerV2
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close
-
-
-
-
Constructor Detail
-
ZookeeperStatusHandler
public ZookeeperStatusHandler(CoreContainer cc)
-
-
Method Detail
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBean
Simple one or two line description- Specified by:
getDescription
in interfaceSolrInfoBean
- Specified by:
getDescription
in classRequestHandlerBase
-
getCategory
public SolrInfoBean.Category getCategory()
Description copied from interface:SolrInfoBean
Category of this component- Specified by:
getCategory
in interfaceSolrInfoBean
- Overrides:
getCategory
in classRequestHandlerBase
-
handleRequestBody
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception
- Specified by:
handleRequestBody
in classRequestHandlerBase
- Throws:
Exception
-
getZkStatus
protected Map<String,Object> getZkStatus(String zkHost, org.apache.solr.common.cloud.ZkDynamicConfig zkDynamicConfig)
For each zk host, resolved either from zk connection string or from zk dynamic reconfiguration config, fetch all config and status info from ZK API and returns as a map, where key is hostname- Parameters:
zkHost
- zookeeper connection stringzkDynamicConfig
- list of zk dynamic config objects- Returns:
- map of zookeeper config and status per zk host
-
monitorZookeeper
protected Map<String,Object> monitorZookeeper(String zkHostPort) throws org.apache.solr.common.SolrException
- Throws:
org.apache.solr.common.SolrException
-
getZkRawResponse
protected List<String> getZkRawResponse(String zkHostPort, String fourLetterWordCommand)
Sends a four-letter-word command to one particular Zookeeper server and returns the response as list of strings- Parameters:
zkHostPort
- the host:port for one zookeeper server to accessfourLetterWordCommand
- the custom 4-letter command to send to Zookeeper- Returns:
- a list of lines returned from Zookeeper
-
validateZkRawResponse
protected boolean validateZkRawResponse(List<String> response, String zkHostPort, String fourLetterWordCommand)
Takes the raw response lines returned bygetZkRawResponse(String, String)
and runs some validations- Parameters:
response
- the lineszkHostPort
- the hostfourLetterWordCommand
- the 4lw command- Returns:
- true if validation succeeds
- Throws:
org.apache.solr.common.SolrException
- if validation fails
-
getPermissionName
public PermissionNameProvider.Name getPermissionName(AuthorizationContext request)
-
-