我按照位于 EnablingSSL 的 Solr 手册使用 SSL 设置了 Solr 5.4.1(标准 Solr,无 SolrCloud/Zookeeper)在 Linux 下。
我可以通过浏览器和 https 成功连接到 Solr 管理页面。
但是,无法再使用 Solrs bin/post 工具。例如,下面是我从名为“mycollection”的 Solr 集合中删除所有文档的小脚本:
bin/post -url https://localhost:8983/solr/mycollection/update -d "<delete><query>*:*</query></delete>"
我收到以下异常:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
问题是:如何在启用 SSL 的情况下使用 Solr 的 bin/post 工具?
编辑:我可以用 curl 完成上述操作,下面的命令成功。但是,这个问题是关于从 Solr 获取 post 工具以使用 ssl。
curl -k https://localhost:8983/solr/mycollection/update?commit=true -H Content-Type: text/xml --data-binary '<delete><query>*:*</query></delete>'
最佳答案
该工具使用使用“http://..”而不是所需的“https://..”的 cURL - 即使您在 URL 参数中指定了 HTTPS。据我所知,截至当前版本 6.1.0,仍然无法对此做任何事情。
由于 Solr 不允许同时运行 HTTP 和 HTTPS,因此无法将 bin/post-tool 与 SSL 结合使用。
可能的解决方法是使用 cURL 或使用 post.jar,如 https://cwiki.apache.org/confluence/display/solr/Enabling+SSL
关于ssl - Solr 5 SSL 和 bin/post,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35301129/