问题似乎出在 httpclient 上。
我为所有库打开了调试日志记录,并在失败前看到来自 httpclient 的消息“响应垃圾”。
这是一个日志 sn-p:
31 Oct 2013 18:10:40,360 [explicit-fetchindex-cmd] DEBUG DefaultClientConnection - Sending request: GET /solr-master/replication?comman
d=filecontent&generation=6814&qt=%2Freplication&file=_aa7_Lucene41_0.pos&checksum=true&wt=filestream HTTP/1.1
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试线 - >> "GET /solr-master/replication?command=filecontent&generation=6814&qt
=%2Freplication&file=_aa7_Lucene41_0.pos&checksum=true&wt=filestream HTTP/1.1[\r][\n]"
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试线 - >> “用户代理:Solr [org.apache.solr.client.solrj.impl.HttpSolrServer]
1.0[\r][\n]"
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试线 - >> “主机:solr-master.saltdev.sealdoc.com:8081[\r][\n]”
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试线 - >> “连接:保持活动 [\r][\n]”
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试线 - >> “[\r][\n]”
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试标头 - >> GET /solr-master/replication?command=filecontent&generation=6814&
qt=%2Freplication&file=_aa7_Lucene41_0.pos&checksum=true&wt=filestream HTTP/1.1
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] DEBUG headers - >> User-Agent: Solr[org.apache.solr.client.solrj.impl.HttpSolrServer
] 1.0
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试标头 - >> 主机:solr-master.saltdev.sealdoc.com:8081
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试头 - >> 连接:保持活动
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试线 - 2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试 DefaultHttpResponseParser - 垃圾响应:
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试线 - 2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试 DefaultHttpResponseParser - 垃圾响应:4
2013 年 10 月 31 日 18:10:40,361 [explicit-fetchindex-cmd] 调试线 - 172.16.77.121:8081 已关闭
2013 年 10 月 31 日 18:10:40,398 [explicit-fetchindex-cmd] 调试 DefaultClientConnection - 连接 0.0.0.0:55266172.16.77.121:8081 关闭
2013 年 10 月 31 日 18:10:40,398 [explicit-fetchindex-cmd] 调试 DefaultClientConnection - 连接 0.0.0.0:55266172.16.77.121:8081 已关闭
2013 年 10 月 31 日 18:10:40,398 [explicit-fetchindex-cmd] DEBUG PoolingClientConnectionManager - 连接已发布:[id: 0][route: {}->http://solr-master.saltdev.sealdoc.com:8081][存活总数:1;分配的路线:10000 条;总分配:1 of 10000]
2013 年 10 月 31 日 18:10:40,425 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 发布目录:/opt/watchdox/solr-slave/data/index 2 false
2013 年 10 月 31 日 18:10:40,425 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 重用缓存目录:CachedDir
2013 年 10 月 31 日 18:10:40,425 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 发布目录:/opt/watchdox/solr-slave/data 0 false
2013 年 10 月 31 日 18:10:40,425 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 重用缓存目录:CachedDir
2013 年 10 月 31 日 18:10:40,427 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 发布目录:/opt/watchdox/solr-slave/data 0 false
2013 年 10 月 31 日 18:10:40,428 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 使用目录完成:CachedDir
2013 年 10 月 31 日 18:10:40,428 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 发布目录:/opt/watchdox/solr-slave/data/index.20131031180837277 0 true
2013 年 10 月 31 日 18:10:40,428 [explicit-fetchindex-cmd] INFO CachingDirectoryFactory - 正在寻找关闭 /opt/watchdox/solr-slave/data/index.20131031180837277 [CachedDir]
2013 年 10 月 31 日 18:10:40,428 [explicit-fetchindex-cmd] INFO CachingDirectoryFactory - 关闭目录:/opt/watchdox/solr-slave/data/index.20131031180837277
2013 年 10 月 31 日 18:10:40,428 [explicit-fetchindex-cmd] INFO CachingDirectoryFactory - 在核心关闭之前删除目录:/opt/watchdox/solr-slave/data/index.20131031180837277
2013 年 10 月 31 日 18:10:40,878 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 从缓存中删除:CachedDir
2013 年 10 月 31 日 18:10:40,878 [explicit-fetchindex-cmd] DEBUG CachingDirectoryFactory - 发布目录:/opt/watchdox/solr-slave/data/index 1 false
2013 年 10 月 31 日 18:10:40,879 [explicit-fetchindex-cmd] 错误 ReplicationHandler - SnapPull 失败:org.apache.solr.common.SolrException:无法完全下载 _aa7_Lucene41_0.pos。已下载 0!=1081710
在 org.apache.solr.handler.SnapPuller$DirectoryFileFetcher.cleanup(SnapPuller.java:1212)
在 org.apache.solr.handler.SnapPuller$DirectoryFileFetcher.fetchFile(SnapPuller.java:1092)
在 org.apache.solr.handler.SnapPuller.downloadIndexFiles(SnapPuller.java:719)
在 org.apache.solr.handler.SnapPuller.fetchLatestIndex(SnapPuller.java:397)
在 org.apache.solr.handler.ReplicationHandler.doFetch(ReplicationHandler.java:317)
在 org.apache.solr.handler.ReplicationHandler$1.run(ReplicationHandler.java:218)
2013 年 10 月 31 日 18:10:40,910 [http-bio-8080-exec-8] 调试 CachingDirectoryFactory - 重用缓存目录:CachedDir
所以我将 httpcomponents jar 升级到最新的 4.3.x 版本,问题就消失了。
httpcomponents jars 是 solrj 的依赖项,在 4.2.x 版本中,我升级到 httpclient-4.3.1 、 httpcore-4.3 和 httpmime-4.3.1
我现在运行了几次复制,完全没有问题,它现在按预期工作。
似乎只有从属端需要升级,但我也要升级主控端。