一、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