如何在Windows Server上配置Zookeeper SSL

时间:2019-05-01 15:22:52

标签: ssl apache-zookeeper solrcloud

由于局限性,我们不得不使用Windows来托管和管理Zookeeper / SolrCloud集群。

我们正在Microsoft Azure中使用3台Windows Server 2016服务器,并在其前面安装了Azure负载均衡器。

我能够安装和配置所有内容,但是Zookeeper无法与SolrCloud在SSL中通信,因此在创建新集合等内容时,我们的API调用均无法正常工作。

我遵循了Zookeeper文档(https://cwiki.apache.org/confluence/display/ZOOKEEPER/ZooKeeper+SSL+User+Guide),但所有这些都适用于Linux系统。据我所知,我已经对其进行了调整,但是它没有用。

这就是我所做的:

  • zkCli.cmd中添加了以下内容:set CLIENT_JVMFLAGS="-Dzookeeper.clientCnxnSocket=org.apache.zookeeper.ClientCnxnSocketNetty -Dzookeeper.client.secure=true -Dzookeeper.ssl.keyStore.location=C:/solr-7.2.1/server/etc/wildcard_sidlee_cloud.pfx -Dzookeeper.ssl.keyStore.password=somepassword -Dzookeeper.ssl.trustStore.location=C:/solr-7.2.1/server/etc/wildcard_sidlee_cloud.pfx -Dzookeeper.ssl.trustStore.password=somepassword"

  • %CLIENT_JVMFLAGS%

  • 中的Java调用中添加了zkCli.cmd
  • zkServer.cmd中添加了以下内容:set SERVER_JVMFLAGS="-Dzookeeper.serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory -Dzookeeper.ssl.keyStore.location=C:/solr-7.2.1/server/etc/wildcard_sidlee_cloud.pfx -Dzookeeper.ssl.keyStore.password=somepassword -Dzookeeper.ssl.trustStore.location=C:/solr-7.2.1/server/etc/wildcard_sidlee_cloud.pfx -Dzookeeper.ssl.trustStore.password=somepassword"

  • %SERVER_JVMFLAGS%

  • 中的Java调用中添加了zkServer.cmd
  • 已将clientPort=2181中的zoo.cfg修改为secureClientPort=2181

Zookeeper服务“启动”,但实际上没有任何反应。如果我手动启动zkServer.cmd,它将失败并显示以下错误:

java.lang.NumberFormatException: For input string: "-Dzookeeper.serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory -Dzookeeper.ssl.keyStore.location=C:/solr-7.2.1/server/etc/wildcard_sidlee_cloud.pfx -Dzookeeper.ssl.keyStore.password=somepassword -Dzookeeper.ssl.trustStore.location=C:/solr-7.2.1/server/etc/wildcard_sidlee_cloud.pfx -Dzookeeper.ssl.trustStore.password=somepassword"
        at java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at java.lang.Integer.parseInt(Unknown Source)
        at org.apache.zookeeper.server.ServerConfig.parse(ServerConfig.java:63)
        at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:103)
        at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)
        at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:128)
        at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:82)

我真的很茫然,不知道从这里去哪里!

提前感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

我遇到了相同的错误并弄清楚了: 在zkServer.cmd中的Java调用中添加了%SERVER_JVMFLAGS%时,必须将其添加到该行的末尾。尝试将其添加到所有参数旁边。在行末的“%*”之前。 那对我有用。

call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" "%SERVER_JVMFLAGS%" "-Dzookeeper.log.file=%ZOO_LOG_FILE%" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*