Kafka2.8.0集群安装教程
kafka集群安装,kafka桌面工具kafka-tools安装
·
Kafka2.8.0集群安装教程
准备工作
node01~node04(四个节点机器,三台也可以),
kafka安装node01~~node03
启动zookeeper,这里依次启动node131,node132,node133上的zk。(关于zookeeper集群安装请看https://blog.csdn.net/qq_41578037/article/details/123809220)
[root@node131 ~]# zkServer.sh start
查看zookeeper根目录,查看当前目录,此时只有zookeeper一个节点。
[root@node130 ~]# zkCli.sh
[zk: localhost:2181(CONNECTED) 0] ls /
[zookeeper]
kafka安装
1、解压kafka
这里采用的是直接将包下载好上传,也可以使用wget命令。
[root@node130 usr]# tar -zxvf kafka_2.12-2.8.0.tgz
2、添加kafka配置环境
export KAFKA_HOME=/usr/kafka2.8.0/
export PATH=$PATH:$KAFKA_HOME/bin
3、修改kafka配置文件,修改zk地址,log地址等
这里启动3台,130,131,132
[root@node131 data]# cd /usr/kafka2.8.0/config/
修改server.properties
broker.id=131
#listeners=PLAINTEXT://:9092
host.name=192.168.66.131
zookeeper.connect=192.168.66.131:2181,192.168.66.132:2181,192.168.66.133:2181/kafka
log.dirs=/usr/kafka2.8.0/logs/
启动命令
[root@node131 data]# kafka-server-start.sh /usr/kafka2.8.0/config/server.properties
INFO KafkaConfig values:
advertised.host.name = null
advertised.listeners = null
advertised.port = null
alter.config.policy.class.name = null
alter.log.dirs.replication.quota.window.num = 11
alter.log.dirs.replication.quota.window.size.seconds = 1
authorizer.class.name =
auto.create.topics.enable = true
auto.leader.rebalance.enable = true
background.threads = 10
broker.heartbeat.interval.ms = 2000
broker.id = 131
broker.id.generation.enable = true
………………
[2022-01-04 23:21:12,887] INFO Kafka version: 2.8.0 (org.apache.kafka.common.utils.AppInfoParser)
[2022-01-04 23:21:12,887] INFO Kafka commitId: ebb1d6e21cc92130 (org.apache.kafka.common.utils.AppInfoParser)
[2022-01-04 23:21:12,887] INFO Kafka startTimeMs: 1641309672523 (org.apache.kafka.common.utils.AppInfoParser)
[2022-01-04 23:21:12,889] INFO [KafkaServer id=131] started (kafka.server.KafkaServer)
[2022-01-04 23:21:13,764] INFO [broker-131-to-controller-send-thread]: Recorded new controller, from now on will use broker 192.168.66.131:9092 (id: 131 rack: null) (kafka.server.BrokerToControllerRequestThread)
启动报错:
ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.common.InconsistentClusterIdException: The Cluster ID 4S5KkuX2Q9-eWyOXVm1X3A doesn't match stored clusterId Some(3QYVX3qUScC6IXsXIyIR1g) in meta.properties. The broker is trying to join the wrong cluster. Configured zookeeper.connect may be wrong
主要问题就是启动集群中Cluster ID 与现有的不一致,可以删除 meta.properties(启动kafka后自动生成),也可以修改 meta.properties中的Cluster ID 即可。
查看zk节点:
[zk: localhost:2181(CONNECTED) 4] ls /kafka
[cluster, controller_epoch, controller, brokers, feature, admin, isr_change_notification, consumers, log_dir_event_notification, latest_producer_id_block, config]
后续kafka系列会介绍这里节点的作用。
windows下kafka可视化web页面
这里用的是kafka-tools,一直next。。。。。
安装完运行:
点击确定,开始配置,注意这里选择kafka版本要和安装的版本一致。
填写broker地址(记得要填,不然点连接一直报没有broker node):
安装完成:
更多推荐
已为社区贡献2条内容
所有评论(0)