środa, marca 26, 2014

Run Apache Kafka on Windows

Install Cygwin and modify Unix script kafka-run-class.sh:

export KAFKA_HOME="/cygdrive/c/infrastructure/kafka_2.9.2-0.8.1"
base_dir=$KAFKA_HOME
CLASSPATH="."

...

if [ -z "$SCALA_VERSION" ]; then
SC_JAR=$(realpath `find $KAFKA_HOME/libs -name scala-library*.jar` --relative-to $KAFKA_HOME/libs)
SCALA_VERSION=$(echo $SC_JAR | cut -d- -f3 | sed -e 's/\.jar//')
echo "SCALA_VERSION is $SCALA_VERSION"
fi

...

# Log4j settings
if [ -z "$KAFKA_LOG4J_OPTS" ]; then
  LOG4J_FILE=`cygpath -p -w $base_dir/config/tools-log4j.properties`
  KAFKA_LOG4J_OPTS="-Dlog4j.configuration=$LOG4J_FILE"
fi

...

CLASSPATH=`cygpath -w -p $CLASSPATH`
echo "CLASSPATH is $CLASSPATH"

# Which java to use
if [ -z "$JAVA_HOME" ]; then
  JAVA="java"
else
  JAVA="$JAVA_HOME/bin/java"
fi

...

else
  cmd /c $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@"
fi

0 komentarze: