博客
关于我
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来安装。

运行任务

查看结果

你可能感兴趣的文章
Multimodal Unsupervised Image-to-Image Translation多通道无监督图像翻译
查看>>
MySQL Cluster与MGR集群实战
查看>>
multipart/form-data与application/octet-stream的区别、application/x-www-form-urlencoded
查看>>
mysql cmake 报错,MySQL云服务器应用及cmake报错解决办法
查看>>
Multiple websites on single instance of IIS
查看>>
mysql CONCAT()函数拼接有NULL
查看>>
multiprocessing.Manager 嵌套共享对象不适用于队列
查看>>
multiprocessing.pool.map 和带有两个参数的函数
查看>>
MYSQL CONCAT函数
查看>>
multiprocessing.Pool:map_async 和 imap 有什么区别?
查看>>
MySQL Connector/Net 句柄泄露
查看>>
multiprocessor(中)
查看>>
mysql CPU使用率过高的一次处理经历
查看>>
Multisim中555定时器使用技巧
查看>>
MySQL CRUD 数据表基础操作实战
查看>>
multisim变压器反馈式_穿过隔离栅供电:认识隔离式直流/ 直流偏置电源
查看>>
mysql csv import meets charset
查看>>
multivariate_normal TypeError: ufunc ‘add‘ output (typecode ‘O‘) could not be coerced to provided……
查看>>
MySQL DBA 数据库优化策略
查看>>
multi_index_container
查看>>