Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-bash: kafka-server-start.sh: command not found

Tags:

apache-kafka

After I installed kafka through homebrew, and my current version is 0.9.0.1.

I was following the steps in this post. At step 3, when I run following command in terminal

kafka-server-start.sh /usr/local/etc/kafka/server.properties

I got: -bash: kafka-server-start.sh: command not found

And I tried to solve this and search for solution for this online and anywhere. But I could not find any.

Does anyone know how to fix this?

like image 848
Tony Avatar asked Jun 07 '16 14:06

Tony


People also ask

Where is zkServer sh?

The command zkServer.sh is from the ZooKeeper project. The command zookeeper-server-start.sh is from the Kafka project. As it relies on ZooKeeper, it's useful to have a command to start it directly without needing the full ZooKeeper project. The one you use typically depends how/why you use ZooKeeper.


2 Answers

You probably need to put a ./ in front of your command. Like this:

./kafka-server-start.sh /usr/local/etc/kafka/server.properties

This of course you are currently in the $KAFKA_HOME/bin directory. Alternatively, you could try:

export KAFKA_HOME=/path/to/kafka/install/directory
$KAFKA_HOME/bin/kafka-server-start.sh /usr/local/etc/kafka/server.properties

Or you could do:

export PATH=$KAFKA_HOME/bin:$PATH

And then run your original command without the ./

like image 109
David Griffin Avatar answered Sep 18 '22 12:09

David Griffin


Please Follow the below steps and it should work as I faced the exact issue

to find the JAVA exact path below is the command

ls -l /etc/alternatives/java

lrwxrwxrwx 1 root root 31 Jun  8 01:15 /etc/alternatives/java -> /opt/java/jdk1.8.0_202/bin/java

Set the java home

export JAVA_HOME=/opt/java/jdk1.8.0_202/bin/java
export PATH=$PATH:/opt/java/jdk1.8.0_202/bin/java

set the Kafka path as below

nano .bashrc
export PATH=/home/biraj/kafka_2.12-2.2.1/bin:$PATH

Now the kafka-server-start.sh should work

like image 42
BigData-Guru Avatar answered Sep 18 '22 12:09

BigData-Guru