1

我有一个多核 solr 实例在带有 Jetty 的服务器上运行,我正在努力保护后端。我已将 Jetty 配置为使用 https 协议,当我向 solr 提交 /select 时一切正常,但不使用任何分片,例如:

https://localhost:7450/solr/core0/select?indent=true&rows=10&start=0&q=*:*

我得到了我的搜索结果,一切都很好。

但是当我想搜索所有分片时:

https://localhost:7450/solr/core0/select?indent=true&rows=10&start=0&q=*:*&shards=localhost:7450/solr/core0,localhost:7450/solr/core1,...

我得到以下异常。我猜我需要以某种方式配置 solr 本身,以便它通过 https 协议向其他分片发送/接收请求,但在谷歌搜索数小时后我不走运。

org.apache.solr.common.SolrException
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:275)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
    at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:713)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: org.apache.solr.client.solrj.SolrServerException: org.apache.commons.httpclient.ProtocolException: The server localhost failed to respond with a valid HTTP response
    at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:472)
    at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:249)
    at org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:129)
    at org.apache.solr.handler.component.HttpShardHandler$1.call(HttpShardHandler.java:103)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
    at java.util.concurrent.FutureTask.run(FutureTask.java:123)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
    at java.lang.Thread.run(Thread.java:637)
Caused by: org.apache.commons.httpclient.ProtocolException: The server localhost failed to respond with a valid HTTP response
    at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1987)
    at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:419)
    ... 8 more

我正在使用 Solr 3.6 和 Jetty 6.1-SNAPSHOT。

4

2 回答 2

0

我仍在努力为自己设置此设置,但似乎已在 Solr 4.7 中添加了支持查看原始错误:https ://issues.apache.org/jira/browse/SOLR-3854

于 2014-04-15T18:26:10.300 回答
0

您应该能够在 solrconfig.xml 中为 core0 设置用于分片调用的 URL 方案:

<requestHandler name="standard" class="solr.SearchHandler" default="true">
  <!-- other params go here -->
  <shardHandlerFactory class="HttpShardHandlerFactory">
    <str name="urlScheme">https://</str>
  </shardHandlerFactory>
</requestHandler>

从源代码来看,这似乎适用于 Solr 3.6.0 及更高版本。不过,我仍在使用 Solr 3.4.0,所以我自己没有尝试过。

参考:http ://wiki.apache.org/solr/SolrConfigXml#Configuration_of_Shard_Handlers_for_Distributed_searches

于 2013-01-30T15:12:31.070 回答