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

运行任务

查看结果

你可能感兴趣的文章
MySQL5.7.18主从复制搭建(一主一从)
查看>>
MySQL5.7.19-win64安装启动
查看>>
mysql5.7.19安装图解_mysql5.7.19 winx64解压缩版安装配置教程
查看>>
MySQL5.7.37windows解压版的安装使用
查看>>
mysql5.7免费下载地址
查看>>
mysql5.7命令总结
查看>>
mysql5.7安装
查看>>
mysql5.7性能调优my.ini
查看>>
MySQL5.7新增Performance Schema表
查看>>
Mysql5.7深入学习 1.MySQL 5.7 中的新增功能
查看>>
Webpack 之 basic chunk graph
查看>>
Mysql5.7版本单机版my.cnf配置文件
查看>>
mysql5.7的安装和Navicat的安装
查看>>
mysql5.7示例数据库_Linux MySQL5.7多实例数据库配置
查看>>
Mysql8 数据库安装及主从配置 | Spring Cloud 2
查看>>
mysql8 配置文件配置group 问题 sql语句group不能使用报错解决 mysql8.X版本的my.cnf配置文件 my.cnf文件 能够使用的my.cnf配置文件
查看>>
MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
查看>>
MYSQL8.0以上忘记root密码
查看>>
Mysql8.0以上重置初始密码的方法
查看>>
mysql8.0新特性-自增变量的持久化
查看>>