flink安装部署

Flink-1.9.0 Standalone安装部署记录。

环境

硬件环境

1、cpu 4核
2、内存16g

软件环境

1、flink版本为1.9.0
2、CentOS Linux release 7.6.1810 (Core)
3、1.8.0_201 64-Bit Server

节点环境

master 192.168.1.56
slave01 192.168.1.58
slave02 192.168.1.59
slave03 192.168.1.60
修改/etc/hosts文件,添加映射关系

安装步骤

1
2
adduser flink
passwd flink

添加ssh免密码登陆

在master上使用ssh-keygen -t rsa生成公钥后,使用ssh-copyid复制master公钥到salve机器上。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[flink@master ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/flink/.ssh/id_rsa):
Created directory '/home/flink/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/flink/.ssh/id_rsa.
Your public key has been saved in /home/flink/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:dMjfT7GUSv03bXpdYb038gsB5XEcGtWylc9oSDhkLhw flink@master
The key's randomart image is:
+---[RSA 2048]----+
| E.o. +o++|
| o =o +.*++|
| * o+.+=Oo|
| . + ooo=+*|
| S . o+o+B|
| o+oB|
| .o.o|
| ...|
| . |
+----[SHA256]-----+

然后使用ssh-copyid复制
[flink@master ~]$ ssh-copy-id flink@slave01
[flink@master ~]$ ssh-copy-id flink@slave02
[flink@master ~]$ ssh-copy-id flink@slave03
1
2
3
[flink@master ~]$ wget http://archive.apache.org/dist/flink/flink-1.9.0/flink-1.9.0-bin-scala_2.11.tgz

[flink@master ~]$ tar zxvf flink-1.9.0-bin-scala_2.11.tgz

添加flink环境变量

1
2
3
vi ~ /.bash_profile
export FLINK_HOME=/home/flink/flink-1.9.0
export PATH=$PATH:$FLINK_HOME/bin

修改flink配置文件

进入目录/home/flink/flink-1.9.0/conf
修改flink-conf.yaml,主要修改项:jobmanager.rpc.address

1
2
vi flink-conf.yaml
jobmanager.rpc.address: master

修改masters 文件,添加master映射名称到master文件中

1
2
vi /home/flink/flink-1.9.0/conf/masters 
master:8081

修改slaves文件,添加slave到文件中

1
2
3
4
vi /home/flink/flink-1.9.0/conf/slaves
slave01
slave02
slave03

分发flink到slave机器

1
2
3
4
cd /home/flink
scp -r flink-1.9.0/ flink@slave01:/home/flink
scp -r flink-1.9.0/ flink@slave02:/home/flink
scp -r flink-1.9.0/ flink@slave03:/home/flink
1
2
cd /home/flink/flink-1.9.0/bin
./start-cluster.sh
1
2
cd /home/flink/flink-1.9.0/bin
./stop-cluster.sh

查看控制台

打开网址: http://master:8081

文章目录
  1. 1. 环境
    1. 1.1. 硬件环境
    2. 1.2. 软件环境
    3. 1.3. 节点环境
  2. 2. 安装步骤
    1. 2.1. 创建flink账号,密码flink
    2. 2.2. 添加ssh免密码登陆
    3. 2.3. 切换flink账号下载flink,解压flink
    4. 2.4. 添加flink环境变量
    5. 2.5. 修改flink配置文件
    6. 2.6. 分发flink到slave机器
  3. 3. 启动flink
  4. 4. 停止flink
  5. 5. 查看控制台