如何在 Windows 中安装的 Zookeeper 中设置 SSL

How to set up SSL in Zookeeper installed in Windows

我想在 windows 环境中的 Zookeeper 3.6.1 中启用 SSL。我在环境变量中添加了ZOOKEEPER_HOME

ZkServer.cmd:

set SERVER_JVMFLAGS="
-Dzookeeper.serverCnxnFactory=org.apache.zookeeper.server.NettyServerCnxnFactory
-Dzookeeper.ssl.keyStore.location=C:/apache-zookeeper-3.6.1/ssl/testKeyStore.jks 
-Dzookeeper.ssl.keyStore.password=testpass 
-Dzookeeper.ssl.trustStore.location=C:/apache-zookeeper-3.6.1/ssl/testTrustStore.jks
-Dzookeeper.ssl.trustStore.password=testpass" 
echo on 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%" %*

尝试 运行 zkServer 时出现以下错误:

C:\Users\e092344>zkServer start '-Dzookeeper.serverCnxnFactory' is not recognized as an internal or external command, operable program or batch file. '-Dzookeeper.ssl.keyStore.location' is not recognized as an internal or external command, operable program or batch file. '-Dzookeeper.ssl.keyStore.password' is not recognized as an internal or external command, operable program or batch file. '-Dzookeeper.ssl.trustStore.location' is not recognized as an internal or external command, operable program or batch file. '-Dzookeeper.ssl.trustStore.password' is not recognized as an internal or external command, operable program or batch file. '-Djava.security.properties' is not recognized as an internal or external command, operable program or batch file.

集合SERVER_JVMFLAGS的值应该是单行字符串。它不应该在下一行。