云服务器 Flexus X 实例,Docker 集成搭建搭建 Flink
Apache Flink 是一个分布式大数据计算引擎,专为处理无界和有界数据流上的有状态计算而设计,以其高吞吐量、低延迟和高性能在实时流处理和批量计算领域脱颖而出,Flink 支持批流一体化,即能够同时处理实时数据流和静态数据集,使得数据处理更加灵活高效
华为云端口放行
• 服务器放行对应端口 8082
Docker 安装并配置镜像加速
1、购买华为云 Flexus X 实例
Flexus云服务器X实例-华为云 (huaweicloud.com)
2、docker 安装
yum install -y docker-ce
3、验证 Docker 是否安装成功,启动 docker 服务并设置开机自启动,且查看 docker 状态
docker --versionsystemctl enable dockersystemctl start dockersystemctl status docker
4、docker-ce 下载
wget -O /etc/yum.repos.d/docker-ce.repo https://mirrors.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo
5、路径/etc/yum.repos.d 修改配置文件
[docker-ce-stable]name=Docker CE Stable - $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/$basearch/stableenabled=1gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-stable-debuginfo]name=Docker CE Stable - Debuginfo $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/debug-$basearch/stableenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-stable-source]name=Docker CE Stable - Sourcesbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/source/stableenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test]name=Docker CE Test - $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/$basearch/testenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test-debuginfo]name=Docker CE Test - Debuginfo $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/debug-$basearch/testenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-test-source]name=Docker CE Test - Sourcesbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/source/testenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly]name=Docker CE Nightly - $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/$basearch/nightlyenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly-debuginfo]name=Docker CE Nightly - Debuginfo $basearchbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/debug-$basearch/nightlyenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg[docker-ce-nightly-source]name=Docker CE Nightly - Sourcesbaseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/9.9/source/nightlyenabled=0gpgcheck=1gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
6、清除和构建缓存
yum clean allyum makecache
7、docker 配置镜像加速(在华为云镜像中心可获取自己的镜像加速配置)
8、创建镜像加速配置文件
vim /etc/docker/daemon.json
{"registry-mirrors": [ "https://fd0cfec0ac0d446db7fd9d27e92d4a8e.mirror.swr.myhuaweicloud.com" ]}
9、重新加载配置文件,重新启动 docker,查看是否配置成功
systemctl daemon-reloadsystemctl restart docker.service
10、docker info 查看配置信息,是否配置成功镜像加速
docker info
搭建 Flink
1、创建文件夹
mkdir /flink
2、编写 docker-compose.yml 文件
vim docker-compose.yml
version: "2.2"services:jobmanager: image: flink:1.14.4-scala_2.11 ports: - "8082:8082" command: jobmanager environment: - | FLINK_PROPERTIES= jobmanager.rpc.address: jobmanager taskmanager: image: flink:1.14.4-scala_2.11 depends_on: - jobmanager command: taskmanager scale: 1 environment: - | FLINK_PROPERTIES= jobmanager.rpc.address: jobmanager taskmanager.numberOfTaskSlots: 2
3、运行 docker-compose.yml 文件
docker-compose up -d
4、关闭服务器防火墙
systemctl stop firewalldsystemctl status firewalld
5、浏览器地址访问公网 IP:8082
总结
华为云服务器 Flexus X 实例,Docker 集成搭建搭建 Flink,Flink 能够同时处理实时数据流和静态数据集,使得数据处理更加灵活高效,欢迎搭建一起购买华为云服务器搭建,目前服务器正在大力促销优惠,有需要的小伙伴可以购买!
评论