安装配置
【机器3台:
cdh-yhte01-03
】
1、下载kafka_2.9.2-0.8.1.1.tgz(http://mirrors.cnnic.cn/apache/kafka/0.8.1.1/kafka_2.9.2-0.8.1.1.tgz)
2、 解压 tar -zxvf kafka_2.9.2-0.8.1.1.tgz
3、 确认zookeeper已启动
[root@cdh-yhte01 ~]# ps -ef | grep zookeeper
4、修改配置文件 config/server.properties
host.name=cdh-yhte01
log.dirs=/usr/local/kafka/kafka-logs
zookeeper.connect=cdh-yhte01:2181,cdh-yhte02:2181,cdh-yhte03:2181
不配置host.name的话,发送信息时会出现以下错误:
kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:90)
at kafka.producer.async.ProducerSendThread.tryToHandle(ProducerSendThread.scala:104)
at kafka.producer.async.ProducerSendThread$$anonfun$processEvents$3.apply(ProducerSendThread.scala:87)
at kafka.producer.async.ProducerSendThread$$anonfun$processEvents$3.apply(ProducerSendThread.scala:67)
at scala.collection.immutable.Stream.foreach(Stream.scala:526)
at kafka.producer.async.ProducerSendThread.processEvents(ProducerSendThread.scala:66)
at kafka.producer.async.ProducerSendThread.run(ProducerSendThread.scala:44)
5、启动kafka
bin/kafka-server-start.sh config/server.properties &
6、部署到其他机器