FastNetMon

четверг, 2 марта 2017 г.

How to install Apache Kafka on Ubuntu 14.04

Install JRE:
sudo apt-get update
sudo apt-get install default-jre

Install Zoo Keeper:
sudo apt-get install zookeeperd

Restrict it to only localhost:
sudo vim /etc/zookeeper/conf/zoo.cfg 

And fix line:
clientPortAddress=127.0.0.1

And apply changes:
sudo service zookeeper restart
Then we need to download pre-compiled Kafka binaries and install them.

wget 'http://www-eu.apache.org/dist/kafka/0.10.2.0/kafka_2.11-0.10.2.0.tgz' -Okafka_2.11-0.10.2.0.tgz
sudo tar -xf kafka_2.11-0.10.2.0.tgz -C /opt
cd /opt/kafka_2.11-0.10.2.0/

Create user for Kafka:
sudo useradd kafka -m 

Change permissions:
sudo chown -R kafka:kafka /opt/kafka_2.11-0.10.2.0/

Create folder for kafka logs:
sudo mkdir /tmp/kafka-logs
sudo chown kafka:kafka /tmp/kafka-logs
Move configuration to proper place:
sudo mkdir /etc/kafka
sudo cp config/server.properties /etc/kafka

Create Kafka Upstart script:
sudo vim /etc/init/kafka.conf

 With following content:
description "Kafka Broker"
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
respawn
respawn limit 2 5
env HOME=/etc/kafka
env KAFKA_HOME=/opt/kafka_2.11-0.10.2.0
umask 007
kill timeout 300
pre-start script
    #Sanity checks
    [ -r $HOME/server.properties ]
end script
setuid kafka
setgid kafka
exec $KAFKA_HOME/bin/kafka-server-start.sh $HOME/server.properties

And finally start Kafka:

1 комментарий :

  1. Thanks for sharing, nice post! Post really provice useful information!

    Giaonhan247 chuyên dịch vụ mua hộ hàng hàn quốc cũng như order hàng hàn quốc giá rẻ và đặt hàng trung quốc giá rẻ ship về VN hay order hàng đức ship về VN và chia sẻ kinh nghiệm mua hàng trên amazon nhật giá rẻ.

    ОтветитьУдалить