博客
关于我
flink快速入门及采坑记录
阅读量:128 次
发布时间:2019-02-26

本文共 1789 字,大约阅读时间需要 5 分钟。

apache flink作为第四代mapreduce计算框架,已经得到越来越多的应用,这里介绍如何快速入门,以及记录一个内存错误的问题。

1、安装jdk

2、下载flink,并解压。

wget https://mirrors.tuna.tsinghua.edu.cn/apache/flink/flink-1.3.2/flink-1.3.2-bin-hadoop27-scala_2.11.tgz

3、运行报错,修改参数运行正常。(如果虚拟机内存1G,会报内存不足的错误)

bin/start-local.sh

启动之后发现没有java进程,查看日志输出,发现Cannot allocate memoery,可以确定是由于内存不足导致的。

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000aaaa0000, 1431699456, 0) failed; error='Cannot allocate memory' (errno=12)## There is insufficient memory for the Java Runtime Environment to continue.# Native memory allocation (mmap) failed to map 1431699456 bytes for committing reserved memory.# An error report file with more information is saved as:# /root/flink-1.3.2/hs_err_pid11115.log

查看内存不足的错误日志hs_err_pid11115.log,发现jvm参数设置超过虚拟机最大内存。

jvm_args: -Xms2048m -Xmx2048m -Dlog.file=/root/flink-1.3.2/log/flink-root-jobmanager-0-buejee.log -Dlog4j.configuration=file:/root/flink-1.3.2/conf/log4j.properties -Dlogback.configurationFile=file:/root/flink-1.3.2/conf/logback.xmljava_command: org.apache.flink.runtime.jobmanager.JobManager --configDir /root/flink-1.3.2/conf --executionMode localjava_class_path (initial): /root/flink-1.3.2/lib/flink-python_2.11-1.3.2.jar:/root/flink-1.3.2/lib/flink-shaded-hadoop2-uber-1.3.2.jar:/root/flink-1.3.2/lib/log4j-1.2.17.jar:/root/flink-1.3.2/lib/slf4j-log4j12-1.7.7.jar:/root/flink-1.3.2/lib/flink-dist_2.11-1.3.2.jar:::Launcher Type: SUN_STANDARD

看到jvm参数默认设置最小内存最大内存均是2g,需要修改conf/flink-conf.yml,默认job.manager.heap.mb: 1024,taskmanager.heap.mb: 1024,将他们均改为512。

# The heap size for the JobManager JVMjobmanager.heap.mb: 512# The heap size for the TaskManager JVMtaskmanager.heap.mb: 512

正常启动的截图

这时候可以通过访问http://ip:8081,来查看flink可视化界面。

通过netcat工具监听9000端口,如果系统没有nc命令,可以通过yum install nc -y来安装。

运行任务

查看结果

你可能感兴趣的文章
MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
查看>>
mysql8的安装与卸载
查看>>
mysqlbinlog报错unknown variable ‘default-character-set=utf8mb4‘
查看>>
mysqldump 导出中文乱码
查看>>
mysqldump备份时忽略某些表
查看>>
mysqlreport分析工具详解
查看>>
MySQL一个表A中多个字段关联了表B的ID,如何关联查询?
查看>>
MYSQL一直显示正在启动
查看>>
MySQL一站到底!华为首发MySQL进阶宝典,基础+优化+源码+架构+实战五飞
查看>>
MySQL万字总结!超详细!
查看>>
Mysql下载以及安装(新手入门,超详细)
查看>>
mysql中cast() 和convert()的用法讲解
查看>>
mysql中floor函数的作用是什么?
查看>>
MySQL中group by 与 order by 一起使用排序问题
查看>>
mysql中having的用法
查看>>
mysql中int、bigint、smallint 和 tinyint的区别、char和varchar的区别详细介绍
查看>>
mysql中json_extract的使用方法
查看>>
mysql中null和空字符串的区别与问题!
查看>>
Mysql中varchar类型数字排序不对踩坑记录
查看>>
Mysql中存储引擎简介、修改、查询、选择
查看>>