场景:solr8.11.1+zookeeper3.8.0+tomcat8.5.38.0组成的solrcloud环境,单numShards正常,多numShards时异常报错,信息如下:
2023-01-11 16:46:08.074 ERROR (http-nio-8862-exec-8) [c:test s:shard1 r:core_node3 x:test_shard1_replica_n1] o.a.s.s.HttpSolrCall org.apache.solr.common.SolrException: or
g.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: null => org.apache.solr.common.SolrException: org.apache.solr.client.solrj.
SolrServerException: IOException occured when talking to server at: null
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:490)
org.apache.solr.common.SolrException: org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: null
at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:490) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b5
0 - janhoy - 2021-12-14 13:50:55]
at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:216) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 -
janhoy - 2021-12-14 13:50:55]
at org.apache.solr.core.SolrCore.execute(SolrCore.java:2637) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - janhoy - 2021-12-14 13:50:55
]
at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:794) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - janhoy - 2021-12-1
4 13:50:55]
at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:567) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - janhoy - 2021-12-14 1
3:50:55]
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:427) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - janho
y - 2021-12-14 13:50:55]
at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:357) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - janho
y - 2021-12-14 13:50:55]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[catalina.jar:8.5.38]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[catalina.jar:8.5.38]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[catalina.jar:8.5.38]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[catalina.jar:8.5.38]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) ~[catalina.jar:8.5.38]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) ~[catalina.jar:8.5.38]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) ~[catalina.jar:8.5.38]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) ~[catalina.jar:8.5.38]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) ~[catalina.jar:8.5.38]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) ~[tomcat-coyote.jar:8.5.38]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-coyote.jar:8.5.38]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) ~[tomcat-coyote.jar:8.5.38]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) ~[tomcat-coyote.jar:8.5.38]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:8.5.38]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_11]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:8.5.38]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_11]
Caused by: org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: null
at org.apache.solr.client.solrj.impl.Http2SolrClient.request(Http2SolrClient.java:437) ~[solr-solrj-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - j
anhoy - 2021-12-14 13:50:57]
at org.apache.solr.client.solrj.impl.Http2SolrClient.request(Http2SolrClient.java:776) ~[solr-solrj-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - j
anhoy - 2021-12-14 13:50:57]
at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1290) ~[solr-solrj-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - janhoy - 2021-1
2-14 13:50:57]
at org.apache.solr.handler.component.HttpShardHandler.request(HttpShardHandler.java:80) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - j
anhoy - 2021-12-14 13:50:55]
at org.apache.solr.handler.component.ShardRequestor.call(ShardRequestor.java:130) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - janhoy
- 2021-12-14 13:50:55]
at org.apache.solr.handler.component.ShardRequestor.call(ShardRequestor.java:41) ~[solr-core-8.11.1.jar:8.11.1 0b002b11819df70783e83ef36b42ed1223c14b50 - janhoy -
2021-12-14 13:50:55]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_11]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_11]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_11]
at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:180) ~[metrics-core-4.1.5.jar:4.1.5]
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:218) ~[solr-solrj-8.11.1.jar:8.11.1 0b002b11819df70783e8
3ef36b42ed1223c14b50 - janhoy - 2021-12-14 13:50:57]
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$$Lambda$31/62315285.run(Unknown Source) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_11]
... 1 more
Caused by: java.nio.channels.ClosedChannelException
at org.eclipse.jetty.http2.HTTP2Session$StreamsState.onShutdown(HTTP2Session.java:1728) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Session$StreamsState.access$1500(HTTP2Session.java:1436) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Session.onShutdown(HTTP2Session.java:923) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Connection$HTTP2Producer.produce(HTTP2Connection.java:296) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produceTask(EatWhatYouKill.java:362) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:186) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:137) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Connection.produce(HTTP2Connection.java:183) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.client.HTTP2ClientConnectionFactory$HTTP2ClientConnection.succeeded(HTTP2ClientConnectionFactory.java:129) ~[http2-client-9.4.44.v20210
927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.Callback$Nested.succeeded(Callback.java:285) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.CountingCallback.succeeded(CountingCallback.java:68) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.Callback$Nested.succeeded(Callback.java:285) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Session$ControlEntry.succeeded(HTTP2Session.java:1259) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Flusher$$Lambda$644/1425965810.accept(Unknown Source) ~[?:?]
at java.util.ArrayList.forEach(ArrayList.java:1234) ~[?:1.8.0_11]
at org.eclipse.jetty.http2.HTTP2Flusher.finish(HTTP2Flusher.java:326) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Flusher.succeeded(HTTP2Flusher.java:318) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:293) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:381) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Flusher.process(HTTP2Flusher.java:295) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:223) ~[jetty-util-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Session.frame(HTTP2Session.java:729) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.HTTP2Session.frames(HTTP2Session.java:701) ~[http2-common-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.http2.client.HTTP2ClientConnectionFactory$HTTP2ClientConnection.onOpen(HTTP2ClientConnectionFactory.java:116) ~[http2-client-9.4.44.v20210927
.jar:9.4.44.v20210927]
at org.eclipse.jetty.io.SelectorManager.connectionOpened(SelectorManager.java:324) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.io.ManagedSelector.createEndPoint(ManagedSelector.java:402) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.io.ManagedSelector.access$2100(ManagedSelector.java:65) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.eclipse.jetty.io.ManagedSelector$Accept.run(ManagedSelector.java:890) ~[jetty-io-9.4.44.v20210927.jar:9.4.44.v20210927]
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:218) ~[solr-solrj-8.11.1.jar:8.11.1 0b002b11819df70783e8
3ef36b42ed1223c14b50 - janhoy - 2021-12-14 13:50:57]
at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor$$Lambda$31/62315285.run(Unknown Source) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_11]
... 1 more
根据solr8 shard之间默认使用的是http2协议,但因环境下皆为solr8 并未想到是http协议问题导致,后验证使用tomcat而非内置jetty时才会报该错误,所以为tomcat增加配置-Dsolr.http1=true ,使用http1协议;
JAVA_OPTS="-Dsolr.http1=true -Dsolr.solr.home=/mnt/solrcloud/freeware/solr-8.11.1/solrhome -DzkHost=**.**.**.**:2181,**.**.**.**:2181,**.**.**.**:2181"