当前位置:   article > 正文

CDH 集成 Flink-1.14.3 过程与踩坑记录_cdh flink

cdh flink

一、资源准备与配置

1.1 项目文件下载与配置

  1. #下载 flink-parcel 项目文件
  2. [root@hadoop105 ~]# git clone https://github.com/pkeropen/flink-parcel.git
  3. [root@hadoop105 ~]# cd flink-parcel/
  4. #编辑下载地址,看自己需求哪个版本
  5. [root@hadoop105 flink-parcel]# vi flink-parcel.properties
  6. #FLINK 下载地址
  7. FLINK_URL=https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.12.tgz
  8. #flink版本号
  9. FLINK_VERSION=1.14.3
  10. #扩展版本号
  11. EXTENS_VERSION=BIN-SCALA_2.12
  12. #操作系统版本,以centos为例
  13. OS_VERSION=7
  14. #CDH 小版本
  15. CDH_MIN_FULL=5.2
  16. CDH_MAX_FULL=6.3.2
  17. #CDH大版本
  18. CDH_MIN=5
  19. CDH_MAX=6
  20. #给与 build.sh 文件执行权限
  21. [root@hadoop105 flink-parcel]# chmod 755 build.sh
  22. #查看默认文件
  23. [root@hadoop105 flink-parcel-master]# ll
  24. 总用量 32
  25. -rwxr-xr-x 1 root root 5886 4月 17 14:39 build.sh
  26. drwxr-xr-x 5 root root 53 1月 14 2020 flink-csd-on-yarn-src
  27. drwxr-xr-x 5 root root 53 1月 14 2020 flink-csd-standalone-src
  28. -rw-r--r-- 1 root root 522 4月 19 10:29 flink-parcel.properties
  29. drwxr-xr-x 3 root root 85 1月 14 2020 flink-parcel-src
  30. -rw-r--r-- 1 root root 11357 1月 14 2020 LICENSE
  31. -rw-r--r-- 1 root root 4334 1月 14 2020 README.md

二、生成相关 parcel 和 csd 文件

2.1 生成 parcel 文件

  1. #编译生成 parcel 文件(该过程比较长)
  2. [root@hadoop105 flink-parcel]# ./build.sh parcel
  3. ......
  4. + git clone https://github.com/cloudera/cm_ext.git
  5. 正克隆到 'cm_ext'...
  6. remote: Enumerating objects: 1785, done.
  7. remote: Total 1785 (delta 0), reused 0 (delta 0), pack-reused 1785
  8. 接收对象中: 100% (1785/1785), 870.71 KiB | 725.00 KiB/s, done.
  9. 处理 delta 中: 100% (861/861), done.
  10. + '[' '!' -f cm_ext/validator/target/validator.jar ']'
  11. + cd cm_ext
  12. + mvn install -Dmaven.test.skip=true
  13. ./build.sh:行32: mvn: 未找到命令
  14. #这里提示没有 mvn 命令,安装 maven 即可
  15. [root@hadoop105 flink-parcel]# yum install -y maven
  16. #重新执行
  17. [root@hadoop105 flink-parcel]# ./build.sh parcel
  18. ......
  19. [INFO] ------------------------------------------------------------------------
  20. + cd ..
  21. + build_flink_parcel
  22. + '[' -f FLINK-1.14.3-BIN-SCALA_2.12_build/FLINK-1.14.3-BIN-SCALA_2.12-el7.parcel ']'
  23. + '[' '!' -d FLINK-1.14.3-BIN-SCALA_2.12 ']'
  24. + get_flink
  25. + '[' '!' -f flink-1.14.3-bin-scala_2.12.tgz ']'
  26. + wget https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.12.tgz
  27. --2023-04-14 14:37:21-- https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.12.tgz
  28. 正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
  29. 正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... 已连接。
  30. 错误: 无法验证 mirrors.tuna.tsinghua.edu.cn 的由 “/C=US/O=Let's Encrypt/CN=R3” 颁发的证书:
  31. 颁发的证书已经过期。
  32. 要以不安全的方式连接至 mirrors.tuna.tsinghua.edu.cn,使用“--no-check-certificate”。
  33. #这里又提示要使用 “--no-check-certificate”,编辑 build.sh 文件,在 wget url 后面加上参数
  34. [root@hadoop105 flink-parcel]# vi build.sh
  35. ......
  36. function get_flink {
  37. if [ ! -f "$flink_archive" ]; then
  38. wget $FLINK_URL --no-check-certificate
  39. fi
  40. ......
  41. #重新执行
  42. [root@hadoop105 flink-parcel]# ./build.sh parcel
  43. + wget https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.12.tgz --no-check-certificate
  44. --2023-04-14 14:56:49-- https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.12.tgz
  45. 正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
  46. 正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... 已连接。
  47. 警告: 无法验证 mirrors.tuna.tsinghua.edu.cn 的由 “/C=US/O=Let's Encrypt/CN=R3” 颁发的证书:
  48. 颁发的证书已经过期。
  49. 已发出 HTTP 请求,正在等待回应... 404 Not Found
  50. 2023-04-14 14:56:49 错误 404:Not Found
  51. #报404错误,说明没有这个链接的文件,更换一个下载源(该链接不是国内的,比较满),文件下载下来了,放到最后提供
  52. -rw-r--r-- 1 root root 4334 4月 14 13:48 README.md
  53. [root@hadoop105 flink-parcel]# vi flink-parcel.properties
  54. #FLINK 下载地址
  55. #FLINK_URL=https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.12.tgz
  56. FLINK_URL=https://archive.apache.org/dist/flink/flink-1.14.3/flink-1.14.3-bin-scala_2.12.tgz
  57. #如果你执行到如下位置跑不动了,就是你的网络访问不了github,后面我把cm.ext目录和flink文件一并提供,放到当前目录即可
  58. + git clone https://github.com/cloudera/cm_ext.git
  59. 正克隆到 'cm_ext'...
  60. #将提供的文件放到当前目录下
  61. [root@hadoop105 flink-parcel-master]# ll
  62. 总用量 332576
  63. -rwxr-xr-x 1 root root 5886 4月 17 14:39 build.sh
  64. -rw-r--r-- 1 root root 816428 4月 17 14:50 cm_ext-master.zip
  65. -rw-r--r-- 1 root root 339705501 4月 19 10:40 flink-1.14.3-bin-scala_2.12.tgz
  66. drwxr-xr-x 5 root root 53 1月 14 2020 flink-csd-on-yarn-src
  67. drwxr-xr-x 5 root root 53 1月 14 2020 flink-csd-standalone-src
  68. -rw-r--r-- 1 root root 522 4月 19 10:45 flink-parcel.properties
  69. drwxr-xr-x 3 root root 85 1月 14 2020 flink-parcel-src
  70. -rw-r--r-- 1 root root 11357 1月 14 2020 LICENSE
  71. -rw-r--r-- 1 root root 4334 1月 14 2020 README.md
  72. #解压cm_ext
  73. [root@hadoop105 flink-parcel-master]# unzip cm_ext-master.zip
  74. #重命名目录
  75. [root@hadoop105 flink-parcel-master]# mv cm_ext-master cm_ext
  76. #继续执行生成parcel文件命令
  77. [root@hadoop105 flink-parcel]# ./build.sh parcel
  78. #不出意外的话,当前目录会生成一个 FLINK-1.14.3-BIN-SCALA_2.12_build 目录,parcel 文件都在里面
  79. [root@hadoop105 flink-parcel-master]# ll
  80. 总用量 332576
  81. -rwxr-xr-x 1 root root 5886 4月 17 14:39 build.sh
  82. drwxr-xr-x 5 root root 130 8月 24 2016 cm_ext
  83. -rw-r--r-- 1 root root 816428 4月 17 14:50 cm_ext-master.zip
  84. drwxr-xr-x 4 root root 29 4月 19 10:53 FLINK-1.14.3-BIN-SCALA_2.12
  85. drwxr-xr-x 2 root root 123 4月 19 10:54 FLINK-1.14.3-BIN-SCALA_2.12_build
  86. -rw-r--r-- 1 root root 339705501 4月 19 10:40 flink-1.14.3-bin-scala_2.12.tgz
  87. drwxr-xr-x 5 root root 53 1月 14 2020 flink-csd-on-yarn-src
  88. drwxr-xr-x 5 root root 53 1月 14 2020 flink-csd-standalone-src
  89. -rw-r--r-- 1 root root 522 4月 19 10:45 flink-parcel.properties
  90. drwxr-xr-x 3 root root 85 1月 14 2020 flink-parcel-src
  91. -rw-r--r-- 1 root root 11357 1月 14 2020 LICENSE
  92. -rw-r--r-- 1 root root 4334 1月 14 2020 README.md
  93. -rw-r--r-- 1 root root 4334 1月 14 2020 README.md
  94. [root@hadoop105 flink-parcel-master]# ll FLINK-1.14.3-BIN-SCALA_2.12_build
  95. 总用量 331424
  96. -rw-r--r-- 1 root root 339366311 4月 19 10:54 FLINK-1.14.3-BIN-SCALA_2.12-el7.parcel
  97. -rw-r--r-- 1 root root 41 4月 19 10:54 FLINK-1.14.3-BIN-SCALA_2.12-el7.parcel.sha
  98. -rw-r--r-- 1 root root 583 4月 19 10:54 manifest.json

2.2 生成 csd 文件

  1. [root@hadoop105 flink-parcel]# ./build.sh csd_on_yarn
  2. [root@hadoop105 flink-parcel]# ./build.sh csd_standalone

2.3 获得的相关文件

  1. [root@hadoop105 flink-parcel-master]# ll
  2. 总用量 332588
  3. drwxr-xr-x 2 root root 123 4月 19 10:54 FLINK-1.14.3-BIN-SCALA_2.12_build
  4. -rw-r--r-- 1 root root 8256 4月 19 10:59 FLINK_ON_YARN-1.14.3.jar
  5. [root@hadoop105 flink-parcel-master]# ll FLINK-1.14.3-BIN-SCALA_2.12_build
  6. 总用量 331424
  7. -rw-r--r-- 1 root root 339366311 4月 19 10:54 FLINK-1.14.3-BIN-SCALA_2.12-el7.parcel
  8. -rw-r--r-- 1 root root 41 4月 19 10:54 FLINK-1.14.3-BIN-SCALA_2.12-el7.parcel.sha
  9. -rw-r--r-- 1 root root 583 4月 19 10:54 manifest.json

三、CDH 中集成 Flink 服务

3.1 拷贝相关文件到指定目录

  1. [root@hadoop105 flink-parcel-master]# cp FLINK-1.14.3-BIN-SCALA_2.12_build/* /opt/cloudera/parcel-repo/
  2. [root@hadoop105 flink-parcel-master]# cp FLINK_ON_YARN-1.14.3.jar /opt/cloudera/csd/

3.2 分配与激活

  3.3 启动与错误处理

 (1)查看 stderr 完整日志,得到如下错误信息:

  1. [19/Apr/2023 13:54:57 +0000] 15463 MainThread redactor INFO Started launcher: /opt/cloudera/cm-agent/service/csd/csd.sh start
  2. [19/Apr/2023 13:54:57 +0000] 15463 MainThread redactor ERROR Redaction rules file doesn't exist, not redacting logs. file: redaction-rules.json, directory: /run/cloudera-scm-agent/process/952-flink_on_yarn-FLINK_YARN
  3. [19/Apr/2023 13:54:57 +0000] 15463 MainThread redactor INFO Re-exec watcher: /opt/cloudera/cm-agent/bin/cm proc_watcher 15471
  4. ......
  5. ......
  6. ......
  7. + exec /opt/cloudera/parcels/FLINK/lib/flink/bin/flink-yarn.sh --container 1 --streaming
  8. /opt/cloudera/parcels/FLINK/lib/flink/bin/flink-yarn.sh:行17: rotateLogFilesWithPrefix: 未找到命令
  9. [20/Apr/2023 10:13:37 +0000] 20279 MainThread redactor INFO Started launcher: /opt/cloudera/cm-agent/service/csd/csd.sh start
  10. [20/Apr/2023 10:13:37 +0000] 20279 MainThread redactor ERROR Redaction rules file doesn't exist, not redacting logs. file: redaction-rules.json, directory: /run/cloudera-scm-agent/process/959-flink_on_yarn-FLINK_YARN
  11. [20/Apr/2023 10:13:37 +0000] 20279 MainThread redactor INFO Re-exec watcher: /opt/cloudera/cm-agent/bin/cm proc_watcher 20289
  1. #(1)编辑文件:
  2. [root@hadoop105 ~]# vi /opt/cloudera/parcels/FLINK/lib/flink/bin/flink-yarn.sh
  3. #注释掉这一行:
  4. #rotateLogFilesWithPrefix "$FLINK_LOG_DIR" "$FLINK_LOG_PREFIX"
  5. #(2)下载jar文件
  6. [root@hadoop105 ~]# cd /opt/cloudera/parcels/FLINK/lib/flink/lib
  7. [root@hadoop105 lib]# wget https://repo.maven.apache.org/maven2/org/apache/flink/flink-shaded-hadoop-2-uber/2.6.5-9.0/flink-shaded-hadoop-2-uber-2.6.5-9.0.jar
  8. #编辑环境变量:
  9. [root@hadoop105 ~]# vi /etc/profile
  10. #新增如下内容:
  11. export HADOOP_CLASSPATH=/opt/cloudera/parcels/FLINK/lib/flink/lib
  12. #生效变量:
  13. [root@hadoop105 ~]# source /etc/profile

(2)此时报错依然存在,我们查看 flink 的输出日志

  1. [root@hadoop105 lib]# tail -f /var/log/flink/flink-yarn.out
  2. #错误信息如下:
  3. ERROR StatusLogger Reconfiguration failed: No configuration found for '6d6f6e28' at 'null' in 'null'
  4. 10:50:09.222 [main] ERROR org.apache.flink.yarn.cli.FlinkYarnSessionCli - Error while running the Flink session.
  5. org.apache.flink.configuration.IllegalConfigurationException: Kerberos login configuration is invalid: keytab [/etc/keytab/flink.keytab] doesn't exist!
  6. at org.apache.flink.runtime.security.SecurityConfiguration.validate(SecurityConfiguration.java:151) ~[flink-dist_2.12-1.14.3.jar:1.14.3]
  7. at org.apache.flink.runtime.security.SecurityConfiguration.<init>(SecurityConfiguration.java:97) ~[flink-dist_2.12-1.14.3.jar:1.14.3]
  8. at org.apache.flink.runtime.security.SecurityConfiguration.<init>(SecurityConfiguration.java:69) ~[flink-dist_2.12-1.14.3.jar:1.14.3]
  9. at org.apache.flink.yarn.cli.FlinkYarnSessionCli.main(FlinkYarnSessionCli.java:858) [flink-dist_2.12-1.14.3.jar:1.14.3]

(3)打开 flink-yarn 配置

 (4)将这两行删除掉并保存配置

 (5)最后重新启动 flink 即可

3.4 获取 flink 监控状态

(1)默认启动完成之后我们获取不到 flink 的监控状态

提示:select integral(events_informational_rate) where entityName="flink_on_yarn"' 中未找到与筛选器 'entityName = "flink_on_yarn"' 匹配的实体

 (2)重启一下 cdh 集群和 Cloudera Management Service 即可

四、资源分享

  1. 文件:flink-1.14.3-bin-scala_2.12.tgz、cm_ext-master.zip
  2. 链接:https://pan.baidu.com/s/1IB0J2kbqoMLDd_gucucLQA
  3. 提取码:cs0b
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/494100
推荐阅读
相关标签
  

闽ICP备14008679号