1. 解压 tar -zxvf
2.配置/app/kafka_2.9.2-0.8.1.1/config/server.properties
#标识--
broker.id=0
#地址--
host.name=192.168.3.1
#持久化--(多个用逗号分开)多个路径代表多个分区
log.dirs=/app/kafka_2.9.2-0.8.1.1/kafkaLogs
#线程--
num.io.threads=8(要大于日志目录数)
#每个topic数据持久化分区数--
num.partitions=2
#zk地址--zookeeper.connect=192.168.3.91:12181,192.168.3.92:12181,192.168.3.92:12181
#zookeeper连接超时时间
zookeeper.connection.timeout.ms=1000000
#下面是缓存的设置,多大发送
socket.send.buffer.bytes=1048576
socket.receive.buffer.bytes=1048576
socket.request.max.bytes=104857600
#kafka消息失效期。小时
log.retention.hours=168
#消息最大byte
message.max.byte=1048576
#默认的消息副本
default.replication.factor=2
#取消息的最大字节数
replica.fetch.max.bytes=1048576
#持久化文件的最大byte,超过新起一个文件
log.segment.bytes=536870912
#消息失效时间
log.retention.check.interval.ms=60000
#日志压缩,,,听说很傻,不用开启
log.cleaner.enable=false
3.启动 在/app/kafka_2.9.2-0.8.1.1/bin
./kafka-server-start.sh -daemon ../config/server.properties
jps 有kafka进程
4验证bin目录
#创建topic。。。
--replication-factor 2(备份)
--partitions 1(分区)
> ./kafka-topics.sh --create --zookeeper localhost:12181 --replication-factor 1 --partitions 1 --topic test
#查看topic
./kafka-topics.sh --list --zookeeper localhost:12181
./kafka-topics.sh --describe --zookeeper localhost:12181 --topic test
#模拟生产者
./kafka-console-producer.sh --broker-list 192.168.3.91:19092 --topic test
#模拟消费者
> ./kafka-console-consumer.sh --zookeeper localhost:12181 --topic test --from-beginning
--如下错误
Failed to send messages after 3 tries
vim /etc/hosts
192.168.3.91 wchb01
192.168.3.92 wchb02
192.168.3.93 wchb03
立刻生效,运行source /etc/hosts