Kafka无法识别的VM选项'PrintGCDateStamps' [英] Kafka Unrecognized VM option 'PrintGCDateStamps'
问题描述
我在远程服务器上安装了Kafka,并且尝试运行时
I installed Kafka on a remote server, and when I tried to run
~/kafka/bin/zookeeper-server-start.sh ~/kafka/config/zookeeper.properties
我收到一个错误
Unrecognized VM option 'PrintGCDateStamps'
kafka服务器无法启动.这不是在vm中运行,而是在已正确安装Java的Ubuntu Server 16.04上直接运行.有什么办法可以简单地纠正吗?
And the kafka server failed to start. This was not being run in a vm, and was being run directly on Ubuntu Server 16.04 with Java properly installed. Any way this can be corrected simply?
推荐答案
实际上,Kafka可以与Java的较新版本配合使用.我遇到了同样的问题,并且在kafka/bin/kafka-run-class.sh
脚本中发现了一个错误,在该脚本中Java版本被错误地解析.
Actually, Kafka works fine with newer versions of Java. I had the same problem, and found an error in the kafka/bin/kafka-run-class.sh
script, where the Java version was incorrectly parsed.
此行捕获了太多的版本字符串:
This line grabs too much of the version string:
JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([^.-]*).*"/\1/p')
这使if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]]
条件无法识别正确的Java版本,并添加了一些不受支持的GC选项.
This makes the if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]]
condition fail to identify the correct Java version, and adds some unsupported GC options.
将上面的行更改为此可以解决我的问题:
Changing the line above to this solved my problem:
JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([^.-]*).*/\1/p')
我将其报告为Kafka的问题.可以在这里找到问题: https://issues.apache.org/jira/browse/KAFKA-6855
I have reported this as an issue with Kafka. The issue can be found here: https://issues.apache.org/jira/browse/KAFKA-6855
对此有一个已提交的修复程序: https://github.com/apache/kafka/commit/e9f86c3085fa8b65e77072389e0dd147b744f117
There is a committed fix for this: https://github.com/apache/kafka/commit/e9f86c3085fa8b65e77072389e0dd147b744f117
这篇关于Kafka无法识别的VM选项'PrintGCDateStamps'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!