kafka安装

一:安装

首先查看防火墙是否关闭:

/etc/init.d/iptables status

没有关闭,用下列命令关闭:

/etc/init.d/iptables stop



(1) 下载kafka

kafka下载地址:https://www.apache.org/dyn/closer.cgi?path=/kafka/0.9.0.0/kafka_2.11-0.9.0.0.tgz,下载包放到 /export/servers/目录下

(2)安装kafka

--> tar -xzvf  kafka_2.11-0.9.0.0.tgz

--> cd kafka_2.11-0.9.0.0

vim config/server.properties

编辑内容如下:

一定要注销掉 listeners=PLAINTEXT://:9092


broker.id=0

port=9092

host.name=192.168.1.162

num.network.threads=3

num.io.threads=8

socket.send.buffer.bytes=102400

socket.receive.buffer.bytes=102400

socket.request.max.bytes=104857600

log.dirs=/tmp/kafka-logs

num.partitions=1

num.recovery.threads.per.data.dir=1

log.retention.hours=168


log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
log.cleaner.enable=false
zookeeper.connect=192.168.154.64:2181
zookeeper.connection.timeout.ms=60000

-->启动kafka-server

bin/kafka-server-start.sh config/server.properties

-->create a topic

bin/kafka-topics.sh --create --zookeeper 192.168.154.64:2181 --replication-factor 1 --partitions 1 --topic test


--> topic list

bin/kafka-topics.sh --list --zookeeper 192.168.154.64:2181


-->send messages

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test


-->Start a consumer

bin/kafka-console-consumer.sh --zookeeper 192.168.154.64:2181 --topic test --from-beginning


转自:http://blog.csdn.net/zhangxihangzhuan/article/details/50581423

具体的配置请查看官网地址: http://kafka.apache.org/documentation.html#quickstart
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值