gpt4 book ai didi

ssl - 使用 OpenSSL/https 保护多核 solr/jetty 服务器

转载 作者:太空宇宙 更新时间:2023-11-03 13:42:40 27 4
gpt4 key购买 nike

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

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 协议(protocol)向其他分片发送/接收请求,但在谷歌搜索了几个小时后我运气不好。

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。

最佳答案

您应该能够在 core0 的 solrconfig.xml 中设置用于分片调用的 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

关于ssl - 使用 OpenSSL/https 保护多核 solr/jetty 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12504885/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com