静态IP设置
shell
# 修改网卡配置文件
vim /etc/sysconfig/network-scripts/ifcfg-ens33
# 修改文件内容
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.18.128
NETMASK=255.255.255.0
GATEWAY=192.168.18.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=2c2371f1-ef29-4514-a568-c4904bd11130
DEVICE=ens33
ONBOOT=true
DNS1=114.114.114.114
# 重启网络
systemctl restart network
Java8环境配置[CentOS7]
shell
cd /usr/local/src
wget https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.tar.gz
tar -xzvf jdk-8u201-linux-x64.tar.gz -C /usr/local
#配置环境变量
vim /etc/profile
#文末添加
export JAVA_HOME=/usr/local/jdk1.8.0_201
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile
java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
Zookeeper单节点部署与配置
shell
# 下载
cd /usr/local/src
wget --no-check-certificate https://dlcdn.apache.org/zookeeper/zookeeper-3.9.1/apache-zookeeper-3.9.1-bin.tar.gz
# 解压安装
tar -xzvf apache-zookeeper-3.9.1-bin.tar.gz -C /usr/local
# 配置配置文件
cd /usr/local/apache-zookeeper-3.9.1-bin/
cp -r /usr/local/apache-zookeeper-3.9.1-bin/conf/zoo_sample.cfg /usr/local/apache-zookeeper-3.9.1-bin/conf/zoo.cfg
# 启停脚本
/usr/local/apache-zookeeper-3.9.1-bin/bin/zkServer.sh start
/usr/local/apache-zookeeper-3.9.1-bin/bin/zkServer.sh status
/usr/local/apache-zookeeper-3.9.1-bin/bin/zkServer.sh stop
Flink部署与配置
下载
shell
cd /usr/local/src
wget --no-check-certifica https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.18.1/flink-1.18.1-bin-scala_2.12.tgz
tar -xzvf flink-1.18.1-bin-scala_2.12.tgz -C /usr/local
修改配置
shell
cd /usr/local/flink-1.18.1
vim /usr/local/flink-1.18.1/conf/flink-conf.yaml
shell
# jobManager 的IP地址
jobmanager.rpc.address: 192.168.18.128
# JobManager 的端口号
jobmanager.rpc.port: 6123
# JobManager 监控IP
jobmanager.bind-host: 0.0.0.0
# JobManager JVM heap 内存大小
jobmanager.memory.process.size: 1600m
# TaskManager 监控IP
taskmanager.bind-host: 0.0.0.0
# 配置为本机task节点ip地址,如测试环境有多个ip,则配置为集群中可以相互通信的ip
taskmanager.host: localhost
# TaskManager JVM heap 内存大小
taskmanager.memory.process.size: 1728m
# 每个 TaskManager 提供的任务 slots 数量大小,默认为1
taskmanager.numberOfTaskSlots: 2
# 程序默认并行计算的个数,默认为1
parallelism.default: 4
rest.port: 8081
rest.address: 0.0.0.0
# web服务绑定的address
rest.bind-address: 0.0.0.0
修改环境变量
shell
vim /etc/profile
export FLINK_HOME=/usr/local/flink-1.18.1
export PATH=$FLINK_HOME/bin:$PATH
source /etc/profile
配置集群
shell
# 配置集群主节点IP及端口
vim /usr/local/flink-1.18.1/conf/masters
localhost:8081
# 配置从节点IP
vim /usr/local/flink-1.18.1/conf/workers
localhost
localhost
localhost
启停脚本
shell
/usr/local/flink-1.18.1/bin/start-cluster.sh
/usr/local/flink-1.18.1/bin/stop-cluster.sh
可视化页面
shell
http://192.168.18.128:8081/