debian安装kafka
Kafka安装
1.安装zookeeperd
apt-get install zookeeperd
2.安装Kafka
wget http://mirror.bit.edu.cn/apache/kafka/2.3.1/kafka_2.11-2.3.1.tgz
tar -zxvf kafka_2.11-2.3.1.tgz
mv kafka_2.11-2.3.1 kafka
设置环境变量
vim /etc/profile
export KAFKA_HOME=/opt/kafka
export PATH=$PATH:$KAFKA_HOME/bin
使环境变量生效
source /etc/profile
kafka启动
启动 zookeeper
/etc/init.d/zookeeper start
cd kafka
bin/zookeeper-server-start.sh config/zookeeper.properties
启动kafka
bin/kafka-server-start.sh config/server.properties
创建集群
cp config/server.properties config/server-1.properties
cp config/server.properties config/server-2.properties
编辑这些新建的文件,设置以下属性:
config/server-1.properties:
broker.id=1
listeners=PLAINTEXT://:9093
log.dir=/tmp/kafka-logs-1
config/server-2.properties:
broker.id=2
listeners=PLAINTEXT://:9094
log.dir=/tmp/kafka-logs-2
启动其他kafka 服务
bin/kafka-server-start.sh config/server-1.properties &
bin/kafka-server-start.sh config/server-2.properties &