Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-3742

Can't run connect-distributed.sh with -daemon flag

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.10.0.0
    • 0.10.1.0
    • connect
    • None

    Description

      Running on ubuntu 14.04. Discovered while experimenting various different kafka components.

      This error probably applies to other scripts as well.

      Running connect-distributed.sh thusly

      connect-distributed.sh -daemon /tmp/connect-distributed.properties

      gives errors like this

      root@worker1:/home/vagrant# connect-distributed.sh -daemon /tmp/connect-distributed.properties
      Exception in thread "main" java.io.FileNotFoundException: -daemon (No such file or directory)
      	at java.io.FileInputStream.open(Native Method)
      	at java.io.FileInputStream.<init>(FileInputStream.java:146)
      	at java.io.FileInputStream.<init>(FileInputStream.java:101)
      	at org.apache.kafka.common.utils.Utils.loadProps(Utils.java:446)
      	at org.apache.kafka.connect.cli.ConnectDistributed.main(ConnectDistributed.java:61)
      

      Note that this runs:
      connect-distributed.sh /tmp/connect-distributed.properties -daemon
      However, the daemon flag is not activated in this case

      Underlying cause:
      kafka-run-class.sh assumes -daemon comes before the classpath

      The scripts for which -daemon works use something like

      EXTRA_ARGS="-name kafkaServer -loggc"
      
      COMMAND=$1
      case $COMMAND in
        -daemon)
          EXTRA_ARGS="-daemon "$EXTRA_ARGS
          shift
          ;;
        *)
          ;;
      esac
      
      exec $base_dir/kafka-run-class.sh $EXTRA_ARGS io.confluent.support.metrics.SupportedKafka "$@"
      

      but connect-distributed does this:

      exec $(dirname $0)/kafka-run-class.sh org.apache.kafka.connect.cli.ConnectDistributed "$@"
      

      Attachments

        Issue Links

          Activity

            People

              liquanpei Liquan Pei
              granders Geoff Anderson
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: