kafka的安装和配置

本文详细介绍了如何在CentOS上安装和配置Kafka,包括从下载Kafka到修改server.properties配置文件,设置broker.id和zookeeper.connect等关键参数,以及启动Kafka服务。接着,文章还涵盖了Kafka的测试步骤,如创建topic、查看topic、发送和接收消息的操作过程。
摘要由CSDN通过智能技术生成

一、Kafka的安装和配置

1.kafka的下载地址
http://kafka.apache.org/downloads.html
2.下载后,可以通过winscp,复制到centos环境下,然后解压:
tar zxvf kafka_2.10-0.8.1.1.tgz
3.进入/kafka_2.10-0.8.1.1/config/目录下,对server.properties进行配置:vi server.properties
broker.id=8 这个broker的id,如果是配置的集群的话,这个id需要唯一

port=9092 kafka消息的端口号

host.name kafka主机的ip

zookeeper.connect配置zookeeper的ip,kafka启动的时候会与zookeeper关联,如果zookeeper没有启动就开始启动kafka的话会报错,当然可以配置一个kafka的集群,只关联一个zookeeper,这样也是可行的。
4.启动kafka:进入到kafka的安装目录下,执行命令:
bin/kafka-server-start.sh config/server.properties &

启动成功后出现下面信息:
[1] 18176
[root@logsrv03 kafka_2.10-0.8.1.1]# [2015-08-17 19:52:06,799] INFO Verifying properties (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,849] INFO Property broker.id is overridden to 8 (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,849] INFO Property host.name is overridden to 172.17.6.148 (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,849] INFO Property log.cleaner.enable is overridden to false (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,850] INFO Property log.dirs is overridden to /tmp/kafka-logs (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,850] INFO Property log.retention.check.interval.ms is overridden to 60000 (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,850] INFO Property log.retention.hours is overridden to 168 (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,850] INFO Property log.segment.bytes is overridden to 536870912 (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,850] INFO Property num.io.threads is overridden to 8 (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,851] INFO Property num.network.threads is overridden to 2 (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,851] INFO Property num.partitions is overridden to 2 (kafka.utils.VerifiableProperties)
[2015-08-17 19:52:06,851] INFO Property port is overridden to 9092 (kafka.utils.VerifiableProperties)
[2
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值