赞
踩
本文将通过 2 种方式在 docker 中部署 flink standalone 集群,集群中共有 4 个节点,分别是 1 个 jobManager 节点和 3 个 taskManager 节点。方式一能快速部署一个 flink 集群,但是使用的是默认配置,不够灵活,方式二使用的是外置配置文件,可以灵活控制集群配置。
准备工作是方式一和方式二都需要执行的工作,准备工作很简单,就是用以下命令创建一个 flink 网络
docker network create flink-network
依次执行以下命令创建 flink 集群
docker run -d -p 8081:8081 --name flink-jobmanager --network flink-network --env FLINK_PROPERTIES="jobmanager.rpc.address: flink-jobmanager" flink:1.16.3-java8 jobmanager
docker run -d --name flink-taskmanager1 --network flink-network --env FLINK_PROPERTIES="jobmanager.rpc.address: flink-jobmanager" flink:1.16.3-java8 taskmanager
docker run -d --name flink-taskmanager2 --network flink-network --env FLINK_PROPERTIES="jobmanager.rpc.address: flink-jobmanager" flink:1.16.3-java8 taskmanager
docker run -d --name flink-taskmanager3 --network flink-network --env FLINK_PROPERTIES="jobmanager.rpc.address: flink-jobmanager" flink:1.16.3-java8 taskmanager
jobmanager.rpc.address: flink-jobmanager
jobmanager.bind-host: 0.0.0.0
#taskmanager.bind-host: localhost
#taskmanager.host: localhost
rest.address: 0.0.0.0
rest.bind-address: 0.0.0.0
jobmanager.rpc.address: flink-jobmanager
jobmanager.bind-host: 0.0.0.0
taskmanager.bind-host: 0.0.0.0
taskmanager.host: flink-taskmanager1
rest.address: 0.0.0.0
rest.bind-address: 0.0.0.0
jobmanager.rpc.address: flink-jobmanager
jobmanager.bind-host: 0.0.0.0
taskmanager.bind-host: 0.0.0.0
taskmanager.host: flink-taskmanager2
rest.address: 0.0.0.0
rest.bind-address: 0.0.0.0
jobmanager.rpc.address: flink-jobmanager
jobmanager.bind-host: 0.0.0.0
taskmanager.bind-host: 0.0.0.0
taskmanager.host: flink-taskmanager3
rest.address: 0.0.0.0
rest.bind-address: 0.0.0.0
依次执行以下命令创建 flink 集群
docker run -d -p 8081:8081 --name flink-jobmanager --network flink-network --mount type=bind,src=/home/debo/dockerData/flink/jobmanager-conf.yaml,target=/opt/flink/conf/flink-conf.yaml flink:1.16.3-java8 jobmanager
docker run -d --name flink-taskmanager1 --network flink-network --mount type=bind,src=/home/debo/dockerData/flink/taskmanager1-conf.yaml,target=/opt/flink/conf/flink-conf.yaml flink:1.16.3-java8 taskmanager
docker run -d --name flink-taskmanager2 --network flink-network --mount type=bind,src=/home/debo/dockerData/flink/taskmanager2-conf.yaml,target=/opt/flink/conf/flink-conf.yaml flink:1.16.3-java8 taskmanager
docker run -d --name flink-taskmanager3 --network flink-network --mount type=bind,src=/home/debo/dockerData/flink/taskmanager3-conf.yaml,target=/opt/flink/conf/flink-conf.yaml flink:1.16.3-java8 taskmanager
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。