我在Linux下的EnablingSSL上使用Solr手册设置了Solr 5.4.1(标准Solr,没有SolrCloud / Zookeeper)和SSL。
我可以通过浏览器和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>'
该工具使用cURL使用“http:// ..”而不是所需的“https:// ..” - 即使您在URL参数中指定了HTTPS。截至目前的版本6.1.0,据我所知,它仍然无法做任何事情。
由于Solr不允许同时运行HTTP和HTTPS,因此无法使用带有SSL的bin / post-tool。
可能的解决方法是使用cURL或使用post.jar,如https://cwiki.apache.org/confluence/display/solr/Enabling+SSL所示