You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by muliliao <gi...@git.apache.org> on 2016/11/23 09:43:55 UTC

[GitHub] kafka pull request #2162: Fixed kafka stop error

GitHub user muliliao opened a pull request:

    https://github.com/apache/kafka/pull/2162

    Fixed kafka stop error

        when user want to stop the zookeeper or kafka server, they will exec the script kafka-server-stop.sh or kafka-server-stop.sh.
    
        In kafka-server-stop.sh and kafka-server-stop.sh, it get the pid with ps command, as below:
    PIDS=$(ps ax | grep -i 'kafka\.Kafka' | grep java | grep -v grep | awk '{print $1}')
    PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}')
    
        Since linux limit process command in 4096 bytes, the above command will fail when the user install kafka in a  folder with long path, just like "/opt/bigdata/kafka_2.10-0.10.0.0".
    
        To fix this issue, we need to modify it as below:
    step1. modify kafka-run-class.sh, add -D parameter to the command; 
    for kafka ,it is  :  java -Dproc_kafkaServer
    for zookeeper, it is : java -Dproc_zookeeper
    step2. modify kafka-server-stop.sh and kafka-server-stop.sh, get the PID with -D parameter information.
     if [ -z "$PIDS" ]; then
      PIDS=$(ps ax | grep java | grep -i proc_kafkaServer| grep -v grep | awk '{print $1}')
    fi
     if [ -z "$PIDS" ]; then
      PIDS=$(ps ax | grep java | grep -i proc_zookeeper| grep -v grep | awk '{print $1}')
    fi


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/muliliao/kafka fixed_kafka_stop_error

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/kafka/pull/2162.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2162
    
----
commit 4a63862d37afa8885d45ce5379a72093f2fa816e
Author: muliliao <mu...@163.com>
Date:   2016-11-23T09:12:59Z

    full command reach 4096 character issue
    
    if the command reach 4096 character, the stop script can not get the pid, and can not stop the service.

commit de93f62463d6e91e056579446517f613ebccad1b
Author: muliliao <mu...@163.com>
Date:   2016-11-23T09:18:08Z

    full command reach 4096 character issue
    
    if the command reach 4096 character, the stop script can not get the pid, and can not stop the service.

commit d72565566ea5848c75c788dc9dce2d719b4e7f1e
Author: muliliao <mu...@163.com>
Date:   2016-11-23T09:20:51Z

    full command reach 4096 character issue
    
    if the command reach 4096 character, the stop script can not get the pid, and can not stop the service.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] kafka pull request #2162: Fixed kafka stop error

Posted by muliliao <gi...@git.apache.org>.
Github user muliliao closed the pull request at:

    https://github.com/apache/kafka/pull/2162


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---