一:搭建kafka。
1. 三台机器执行以下命令。
cd /opt
wget wget https://dlcdn.apache.org/kafka/3.6.1/kafka_2.13-3.6.1.tgz
tar zxvf kafka_2.13-3.6.1.tgz
cd kafka_2.13-3.6.1/config
vim server.properties
修改以下俩内容
1.三台机器分别给予各自的broker_id。
2. 配置zk。
3. 启动测试。
3.1 后台启动。
第一步:启动zk。
第二步:执行启动命令
nohup /opt/kafka_2.13-3.6.1/bin/kafka-server-start.sh /opt/kafka_2.13-3.6.1/config/server.properties > /dev/null 2>&1 &
3.2 测试。
在一台机器上执行创建topic命令。
/opt/kafka_2.13-3.6.1/bin/kafka-topics.sh --create --topic my-topic-kraft --bootstrap-server localhost:9092
在另外一台机器上执行查看topic命令。
/opt/kafka_2.13-3.6.1/bin/kafka-topics.sh --list --bootstrap-server localhost:9092
二:搭建flink。
1. 三台机器下载flink。
cd /opt
wget https://www.apache.org/dyn/closer.lua/flink/flink-1.13.6/flink-1.13.6-bin-scala_2.12.tgz
2.修改配置参数。
- 三台机器都修改 flink-conf.yaml
cd /opt/flink-1.13.6/conf
vim flink-conf.yaml
zk地址修改
high-availability: zookeeper
high-availability.zookeeper.quorum: hadoop100:2181,hadoop101:2181,hadoop102:2181
akka.ask.timeout : 20s
web.timeout : 1000000
resourcemanager.taskmanager-timeout : 2592000000
state.backend : docksdb
state.checkpoints.dir : hdfs://hadoop100:8082/cluster/flink/checkpoints;
state.backend.incremental : true
execution.checkpointing.tolerable-failed-checkpoints : 3
high-availability.storageDir: hdfs://hadoop100/flink/ha/
state.checkpoints.dir: hdfs://hadoop100/flink-checkpoints
jobmanager.execution.failover-strategy: region
jobmanager.execution.failover-region-strategy.region-0.minimal-task-managers-to-process: 1
jobma