SolrCloud-4.10.2源代码启动流程梳理
SolrCloud-4.10.2源代码
web.xml中filter配置 SolrDispatchFilter
<filter-name>SolrRequestFilter</filter-name>
<filter-class>org.apache.solr.servlet.SolrDispatchFilter</filter-class>
SolrRequestFilter继承自Filter,实例化的时候对调用init()方法
this.cores = createCoreContainer();
关键代码
SolrDispatchFilter.execute()
handler = core.getRequestHandler( path )
solrconfig.xml配置的Handler,这里有些handler是不能配置的 比如admin
cat solrconfig.xml |grep 'name="/'
<requestHandler name="/select" class="solr.SearchHandler">
<requestHandler name="/query" class="solr.SearchHandler">
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<requestHandler name="/get" class="solr.RealTimeGetHandler">
<requestHandler name="/browse" class="solr.SearchHandler">
<requestHandler name="/update" class="solr.UpdateRequestHandler">
<requestHandler name="/update/json" class="solr.UpdateRequestHandler">
<requestHandler name="/update/csv" class="solr.UpdateRequestHandler">
<requestHandler name="/update/extract"
<requestHandler name="/analysis/field"
<requestHandler name="/analysis/document"
<requestHandler name="/admin/"
<requestHandler name="/admin/luke" class="solr.admin.LukeRequestHandler" />
<requestHandler name="/admin/system" class="solr.admin.SystemInfoHandler" />
<requestHandler name="/admin/plugins" class="solr.admin.PluginInfoHandler" />
<requestHandler name="/admin/threads" class="solr.admin.ThreadDumpHandler" />
<requestHandler name="/admin/properties" class="solr.admin.PropertiesRequestHandler" />
<requestHandler name="/admin/file" class="solr.admin.ShowFileRequestHandler" >
<requestHandler name="/admin/file"
<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
<requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
<requestHandler name="/replication" class="solr.ReplicationHandler" >
<requestHandler name="/spell" class="solr.SearchHandler" startup="lazy">
<requestHandler name="/suggest" class="solr.SearchHandler" startup="lazy">
<requestHandler name="/tvrh" class="solr.SearchHandler" startup="lazy">
<requestHandler name="/clustering"
<requestHandler name="/terms" class="solr.SearchHandler" startup="lazy">
<requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
执行逻辑主要逻辑
this.execute( req, handler, solrReq, solrRsp );
sreq.getContext().put( "webapp", req.getContextPath() );
sreq.getCore().execute( handler, sreq, rsp );
handler.handleRequest(req,rsp);
RequestHandlerBase
handleRequestBody( req, rsp );