博客
关于我
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修改密码的方法
查看>>
Mysql8在Centos上安装后忘记root密码如何重新设置
查看>>
Mysql8在Windows上离线安装时忘记root密码
查看>>
MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案
查看>>
mysql8的安装与卸载
查看>>
MySQL8,体验不一样的安装方式!
查看>>
MySQL: Host '127.0.0.1' is not allowed to connect to this MySQL server
查看>>
Mysql: 对换(替换)两条记录的同一个字段值
查看>>
mysql:Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘解决方法
查看>>
MYSQL:基础——3N范式的表结构设计
查看>>
MYSQL:基础——触发器
查看>>
Mysql:连接报错“closing inbound before receiving peer‘s close_notify”
查看>>
mysqlbinlog报错unknown variable ‘default-character-set=utf8mb4‘
查看>>
mysqldump 参数--lock-tables浅析
查看>>
mysqldump 导出中文乱码
查看>>
mysqldump 导出数据库中每张表的前n条
查看>>
mysqldump: Got error: 1044: Access denied for user ‘xx’@’xx’ to database ‘xx’ when using LOCK TABLES
查看>>
Mysqldump参数大全(参数来源于mysql5.5.19源码)
查看>>
mysqldump备份时忽略某些表
查看>>