1、kafka单点安装,参考另一篇
2、这里介绍kafka集群的配置
配置文件介绍
- zookeeper集群安装
#/usr/local/kafka/config
#vim zookeeper.properties
# 创建myid文件
dataDir=/tmp/zookeeper
# the port at which the clients will connect
clientPort=2181
# disable the per-ip limit on the number of connections since this is a non-production config
maxClientCnxns=100
tickTime=2000
initLimit=10
syncLimit=5
server.1=10.1.11.9:2888:3888
server.2=10.1.11.10:2888:3888
# cd /tmp/zookeeper
创建myid文件,并以次写入1,2,3
- kafka集群配置
# /usr/local/kafka/config
# vim server.properties
设置broker.id、host.name、zookeeper.connect - 测试运行
生产者:
./bin/kafka-console-consumer.sh --bootstrap-server 10.1.11.9:9092,10.1.11.10:9092 --topic luyangTest --from-beginning
消费者:
./bin/kafka-console-consumer.sh --bootstrap-server 10.1.11.9:9092,10.1.11.10:9092 --topic luyangTest --from-beginning
常见问题:
问题如下
解决思路:改异常可无需管理,主要是集群环境下,当前服务器请求另一台服务时,另一台服务器未启动,导致的问题。等所有的机器都运行起来就不会报了。一定要关闭防火墙,这一点很重要
参考资料
http://blog.youkuaiyun.com/gongxinju/article/details/53415051
http://blog.youkuaiyun.com/zxy987872674/article/details/72466504