[ https://issues.apache.org/jira/browse/KAFKA-3347?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16477707#comment-16477707 ]
ASF GitHub Bot commented on KAFKA-3347: --------------------------------------- jcustenborder closed pull request #1026: KAFKA-3347 - Configure java to prefer ipv4 URL: https://github.com/apache/kafka/pull/1026 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index f45d8d4af17..53f95dd70e5 100755 --- a/bin/kafka-run-class.sh +++ b/bin/kafka-run-class.sh @@ -161,9 +161,15 @@ fi # JVM performance options if [ -z "$KAFKA_JVM_PERFORMANCE_OPTS" ]; then - KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+DisableExplicitGC -Djava.awt.headless=true" + KAFKA_JVM_PERFORMANCE_OPTS="-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:+DisableExplicitGC -Djava.awt.headless=true " fi +# JVM networking options +if [ -z "$KAFKA_NETWORK_OPTS" ]; then + KAFKA_NETWORK_OPTS="-Djava.net.preferIPv4Stack=true " +fi + + while [ $# -gt 0 ]; do COMMAND=$1 @@ -199,7 +205,7 @@ fi # Launch mode if [ "x$DAEMON_MODE" = "xtrue" ]; then - nohup $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" > "$CONSOLE_OUTPUT_FILE" 2>&1 < /dev/null & + nohup $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_NETWORK_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" > "$CONSOLE_OUTPUT_FILE" 2>&1 < /dev/null & else - exec $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" + exec $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_NETWORK_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@" fi ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Configure java to prefer ipv4 > ----------------------------- > > Key: KAFKA-3347 > URL: https://issues.apache.org/jira/browse/KAFKA-3347 > Project: Kafka > Issue Type: Improvement > Components: core > Affects Versions: 0.9.0.1 > Reporter: Jeremy Custenborder > Assignee: Jeremy Custenborder > Priority: Minor > > I've noticed that ports are sometimes binding on IPv6 addresses rather than > the IPv4 address I'm expecting. Can we change this so we bing on the IPv4 > address rather than the IPv6 address? I'm proposing to add this to > KAFKA_JVM_PERFORMANCE_OPTS. > {code} > -Djava.net.preferIPv4Stack=true > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)