卡夫卡并不是一项服务

时间:2018-04-24 06:00:28

标签: apache-kafka

我们刚迁移到kafka_2.12-1.0.0。当我尝试启动kafka作为服务时,我收到以下错误

[2018-04-24 01:46:25,292] FATAL  (kafka.Kafka$)
java.lang.IllegalArgumentException: Signal already used by VM: INT
    at com.ibm.misc.SignalDispatcher.registerSignal(SignalDispatcher.java:127)
    at sun.misc.Signal.handle(Signal.java:184)
    at kafka.Kafka$.registerHandler$1(Kafka.scala:67)
    at kafka.Kafka$.registerLoggingSignalHandler(Kafka.scala:74)
    at kafka.Kafka$.main(Kafka.scala:85)
    at kafka.Kafka.main(Kafka.scala)$

以下是我的启动脚本

#! /bin/sh
### BEGIN INIT INFO
# Provides:          kafka
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: a distributed commit log.
# Description:       Apache Kafka is publish-subscribe messaging rethought
#                    as a distributed commit log.
### END INIT INFO

KAFKA_PATH=/opt/kafka
PATH=$PATH:$KAFKA_PATH/bin
NAME=kafka


# See how we were called.
case "$1" in
  start)
        # Start daemon.
        pid=`ps ax | grep -i "$KAFKA_PATH" | grep -v grep | awk '{print $1}'`
         if [ -n "$pid" ]
           then
         echo "Kafka is Running as PID: $pid"
         else
         echo "Starting $NAME";
         sh $KAFKA_PATH/bin/kafka-server-start.sh  $KAFKA_PATH/config/server1.properties 2>&1 >> $KAFKA_PATH/kafka.log 2>&1 &
         fi
        ;;


  stop)
        # Stop daemons.
        echo "Shutting down $NAME";
        pid=`ps ax | grep -i "$KAFKA_PATH" | grep -v grep | awk '{print $1}'`
        if [ -n "$pid" ]
          then
          kill -9 $pid
        else
          echo "$NAME was not Running"
        fi
        ;;
  restart)
        $0 stop
        sleep 2
        $0 start
        ;;

  status)
        pid=`ps ax | grep -i "$KAFKA_PATH" | grep -v grep | awk '{print $1}'`
        if [ -n "$pid" ]
          then
          echo "$NAME is Running as PID: $pid"
        else
          echo "$NAME is not Running"
        fi
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac

exit 0

我还尝试在脚本中使用下面的命令启动kafaka作为守护进程,但没有成功

 sh $KAFKA_PATH/bin/kafka-server-start.sh  -daemon $KAFKA_PATH/config/server1.properties 2>&1 >> $KAFKA_PATH/kafka.log 2>&1 &

另请找到Java版本

 java version "1.8.0"
     Java(TM) SE Runtime Environment (build pxa6480sr4fp1-20170215_01(SR4 FP1))
     IBM J9 VM (build 2.8, JRE 1.8.0 Linux amd64-64 Compressed References 
     20170209_336038 (JIT enabled, AOT enabled)
     J9VM - R28_20170209_0201_B336038
     JIT  - tr.r14.java.green_20170125_131456
     GC   - R28_20170209_0201_B336038_CMPRSS
     J9CL - 20170209_336038)
     JCL - 20170215_01 based on Oracle jdk8u121-b13

有人可以帮助我吗

1 个答案:

答案 0 :(得分:0)

据我所知,最近已解决此问题: https://github.com/apache/kafka/pull/5047