kafka集群搭建
3.將兩個壓縮包全部上傳到集群的某台機器上,這裡是centos1
4.解壓兩個軟體包,並重新命令kafka
tar -zxvf kafka_2.10-0.8.2.1.tgz
mv kafka_2.10-0.8.2.1 kafka
tar -zxvf slf4j-1.7.25.tar.gz
mv slf4j-1.7.25/slf4j-nop-1.7.25.jar /opt/cdh/kafka/libs/
5.修改kafka中的config目錄下的server.properties檔案中的zookeeper配置
zookeeper.connect=centos1:2181,centos2:2181,centos3:2181
6.複製壓縮包kafka到集群中的centos2和centos3中
scp -r kafka/ centos@centos2:/opt/cdh/
scp -r kafka/ centos@centos3:/opt/cdh/
7.修改centos2和centos3中的kafka目錄下的server.properties中的broker.id分別為1和2,保證集群中的id均不同
8.分別啟動三颱機器中的啟動zookeeper
9.分別啟動三颱機器中的kafka
nohup ./bin/kafka-server-start.sh config/server.properties &
驗證集群
1.建立主題
./bin/kafka-topics.sh --zookeeper centos1:2181,centos2:2181,centos3:2181 --topic testtopic --replication-factor 1 --partitions 1 --create
created topic "testtopic".
2.建立生產者
./bin/kafka-console-producer.sh --broker-list centos1:9092,centos2:9092,centos3:9092 --topic testtopic
[2017-05-21 10:12:41,802] warn property topic is not valid (kafka.utils.verifiableproperties)
slf4j: class path contains multiple slf4j bindings.
slf4j: found binding in [jar:file:/opt/cdh/kafka/libs/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/staticloggerbinder.class]
slf4j: found binding in [jar:file:/opt/cdh/kafka/libs/slf4j-nop-1.7.25.jar!/org/slf4j/impl/staticloggerbinder.class]
slf4j: see for an explanation.
slf4j: actual binding is of type [org.slf4j.impl.log4jlogge***ctory]
3.新建視窗,建立消費者
./bin/kafka-console-consumer.sh --zookeeper centos1:2181,centos2:2181,centos3:2181 --topic testtopic --from-beginning
4.這時候在生產者視窗中輸入helloworld,這時候在消費者視窗會看到訊息
kafka集群搭建
安裝zookeeper kafka自帶了zookeeper,建議還是用外部的zk集群,搭建步驟如下 準備3臺機器,假設我們叫c1 c2 c3,ip分別為ip1 ip2 ip3 將附件zookeeper 3.4.6.tar.gz分別拷貝至3臺機器 c1機器上解壓zookeeper 3.4.6.tar....
kafka 集群搭建
1 前置條件 安裝jdk zookeeper 集群搭建 wget tar xzf kafka 2.11 0.10.2.1.tgz 3 修改 config server.properties 三個地方 1 broker.id 要對上 log.dirs 下 meta.properties broker....
kafka集群搭建
1 上傳安裝包 把安裝包上傳到伺服器 put r d kafka 2.11 0.8.2.0.tgz 2 解壓縮安裝包 3 配置kafka環境變數 vim etc profile export path path kafka home bin 重新整理策略 source etc profile 4 修...