当先锋百科网

首页 1 2 3 4 5 6 7

安装

下载页

http://kafka.apache.org/downloads.html

下载地址

https://www.apache.org/dyn/closer.cgi?path=/kafka/0.8.0/kafka_2.8.0-0.8.0.tar.gz

版本:0.80
下载的是Binary版本

  • 安装前提:

zookeeper集群已经安装好,请参考http://blog.csdn.net/luyucia/article/details/17958939
hosts配置好

  • * 机器分布(ip 主机名)
10.234.10.17 master
10.234.10.20 slave1
  • * 修改配置文件config/server.properties:三处需要修改

10.234.10.17上

broker.id=0
log.dirs=/home/cloud/tmp/kafka
zookeeper.connect=master:2181,slave1:2181,slave2:2181

10.234.10.20上

broker.id=1
log.dirs=/home/cloud/tmp/kafka
zookeeper.connect=master:2181,slave1:2181,slave2:2181
  • * 停止、启动 集群
cd /home/cloud/kafka/kafka_2.8.0-0.8.0
./bin/kafka-server-stop.sh
./bin/kafka-server-start.sh ./config/server.properties &
ssh cloud@slave1 /home/cloud/kafka/kafka_2.8.0-0.8.0/bin/kafka-server-stop.sh
ssh cloud@slave1 /home/cloud/kafka/kafka_2.8.0-0.8.0/bin/kafka-server-start.sh /home/cloud/kafka/kafka_2.8.0-0.8.0/config/server.properties &

测试

  • * 创建主题:
kafka-create-topic.sh --zookeeper master:2181 --replica 2 --partition 2 --topic topic_test
  • * 查看主题列表:
kafka-list-topic.sh --zookeeper master:2181