1.采用parcels包的方式来安装flink
编译parcels请参考:制作Flink的Parcel包和csd文件
2.将parcels包拷贝到对应目录
1 | lintong@master:/opt/cloudera/parcel-repo$ ls | grep FLINK |
csd包
1 | lintong@master:/opt/cloudera/csd$ ls |
3.安装
配置主机
配置flink集群参数
部署成功
flink集群部署后会在YARN上启动一个以flink用户运行的flink session,注意此时在此flink session中是不能认证成其他用户的,只能是flink用户,可以参考:Flink on Yarn with Kerberos
比如使用flink-scala-shell就会运行在此flink session中,而在里面认证是不会生效
部署成功
参考:Cloudera Manager中安装部署Flink服务
4.遇到的一些问题:
其中kerberos相关的参数如果集群没有启用kerberos的话可以不填写
如果有开启kerberos的话,需要在首先在os上添加flink用户
1 | sudo groupadd flink |
然后创建生成flink用户的keytab
如果集成了ldap,需要在ldap中创建flink Group和People
如果重启flink集群的时候遇到
1 | security.UserGroupInformation: PriviledgedActionException as:flink (auth:KERBEROS) cause:javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)] |
需要先使用flink用户进行kinit认证
1 | sudo -u flink kinit -kt /etc/keytab/flink.keytab flink/master@HADOOP.COM |
启动flink-scala-shell验证
1 | lintong@master:/opt/cloudera/parcels/FLINK/lib/flink/bin$ ./start-scala-shell.sh yarn |
如果遇到
1 | Exception in thread "main" java.lang.NoSuchMethodError: jline.console.completer.CandidateListCompletionHandler.setPrintSpaceAfterFullCompletion(Z |
请下载 jline-2.14.3.jar包 到flink的lib目录
1 | lintong@master:/opt/cloudera/parcels/FLINK/lib/flink/lib$ wget https://repo1.maven.org/maven2/jline/jline/2.14.3/jline-2.14.3.jar |
如果遇到
1 | Error: A JNI error has occurred, please check your installation and try again |
请下载 flink-shaded-hadoop-2-uber-2.7.5-7.0.jar包,放到flink的lib目录下
1 | lintong@master:/opt/cloudera/parcels/FLINK/lib/flink/lib$ wget https://repo1.maven.org/maven2/org/apache/flink/flink-shaded-hadoop-2-uber/2.7.5-7.0/flink-shaded-hadoop-2-uber-2.7.5-7.0.jar |
读取文件并打印
1 | scala> val dataSet = benv.readTextFile("hdfs:///user/hive/warehouse/test/000000_0") |