flink独立集群部署

#flink独立集群部署说明

安装环境

三台服务器

47.106.23.1(master)
47.112.173.2(worker1)
47.115.162.3 (worker1)
提前装好jdk和ssh,以下操作最好不要用root账号
提前下载好flink的包并解压

设置三台服务器之间ssh免密登录

生成本机秘钥

以47.106.23.1为例(其他两台参考本服务器)

#生成本机秘钥
cd ;ssh-keygen -t rsa -P ""    回车到看到如下信息
The key fingerprint is:
16:38:10:39:1a:f7:6e:da:ff:9f:5a:c6:95:7a:0e:3d user@user-server1
The key's randomart image is:
+--[ RSA 2048]----+
|    oo           |
|  . +. .         |
|   + oo .        |
|  .   .. .     . |
|     .  S     o  |
|      o.   . +   |
|     +      * E  |
|    . .    o = . |
|       ...ooo .  |
+-----------------+
#把秘钥添加到authorized_keys
cat .ssh/id_rsa.pub >> .ssh/authorized_keys
#赋予authorized_keys 文件权限
chmod 600 .ssh/authorized_keys
#验证
ssh localhost
可以不用输密码登录

其他两台服务器同样的操作

设置免密码登录

# 拷贝47.106.23.1上的秘钥到47.112.173.2和47.115.162.3
scp id_rsa.pub [email protected]:/home/user/
scp id_rsa.pub [email protected]:/home/user/

#拷贝完成后把47.106.23.1的秘钥分别添加到47.112.173.2和47.115.162.3的authorized_keys中

#在服务器47.112.173.2中执行
cat /home/user/id_rsa.pub >> /home/user/.ssh/authorized_keys

#在服务器47.115.162.3中执行
cat /home/user/id_rsa.pub >> /home/user/.ssh/authorized_keys

#在47.106.23.1验证是否可以不输入密码登录47.112.173.2和47.115.162.3
ssh 47.112.173.2
ssh 47.115.162.3
#到此47.106.23.1可以免密码登录47.112.173.2和47.115.162.3

同样其他两台服务器一样的操作原理

安装flink独立集群

修改配置文件

#进入到47.106.23.1的flink配置目录下
cd /opt/user/app/flink-1.11.2/conf/
#修改flink-conf.yaml内容如下,其他配置视情况而定
jobmanager.rpc.address: 47.106.23.1  

#修改masters内容如下
47.106.23.1:8081
47.112.173.2:8081
47.115.162.3:8081 

#修改workers内容如下
47.106.23.1
47.112.173.2
47.115.162.3

拷贝flink到47.112.173.2和47.115.162.3

scp -r  /opt/user/app/flink-1.11.2/ [email protected]:/opt/user/app/ 
scp -r  /opt/user/app/flink-1.11.2/ [email protected]:/opt/user/app/

启动flink独立集

cd /opt/user/app/flink-1.11.2/bin

./start-cluster.sh  
#出现下面的信息表示启动成功
Starting cluster.
Starting standalonesession daemon on host user-server1.  
Starting taskexecutor daemon on host user-server1.
Starting taskexecutor daemon on host user-server2.
Starting taskexecutor daemon on host user-server3. 

你可能感兴趣的:(flink,hadoop,linux)