flink单机部署实战centos7.6+1.11.6

一、下载flink安装包

https://dlcdn.apache.org/flink/flink-1.11.6/flink-1.11.6-bin-scala_2.12.tgz

二、部署及配置

2.1 解压

tar -vxzf  flink-1.11.6-bin-scala_2.12.tgz

2.2 配置flink-conf.yaml

jobmanager.rpc.address: 127.0.0.1 #指定服务器ip
jobmanager.memory.process.size: 1600m #jobmanager进程总内存
taskmanager.memory.process.size: 2048m #taskmanager进程总内存
taskmanager.numberOfTaskSlots: 3 #任务槽数,控制taskmanager可以接收的计算任务数
web.tmpdir: /data/flink/tmp #算法jar上传存储地址,重启会被删除
web.upload.dir: /data/flink/upload #算法jar包存储地址,不设置重启后丢失之前上传的文件
env.java.opts: "-Dfile.encoding=UTF-8 -Duser.timezone=GMT+08" #设置任务编码及时区

2.3 配置日志

默认配置不会拆分日志,导致单个日志过大,通过配置可实现日志按照固定大小拆分

# 滚动日志的配置
# This affects logging for both user code and Flink
rootLogger.level = INFO
rootLogger.appenderRef.rolling.ref = RollingFileAppender
 
# Uncomment this if you want to _only_ change Flink's logging
#logger.flink.name = org.apache.flink
#logger.flink.level = INFO
 
# The following lines keep the log level of common libraries/connectors on
# log level INFO. The root logger does not override this. You have to manually
# change the log levels here.
logger.akka.name = akka
logger.akka.level = INFO
logger.kafka.name= org.apache.kafka
logger.kafka.level = INFO
logger.hadoop.name = org.apache.hadoop
logger.hadoop.level = INFO
logger.zookeeper.name = org.apache.zookeeper
logger.zookeeper.level = INFO
 
# Log all infos in the given rolling file
appender.rolling.name = RollingFileAppender
appender.rolling.type = RollingFile
appender.rolling.append = false
#日志文件名
appender.rolling.fileName = ${sys:log.file}
#指定当发生文件滚动时,文件重命名规则
appender.rolling.filePattern = ${sys:log.file}.%i.%d{yyyy-MM-dd}
#${sys:log.file}.%i
appender.rolling.layout.type = PatternLayout
# 输出模板
appender.rolling.layout.pattern = %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %-60c %x - %m%n
# 指定记录文件的保存策略,该策略主要是完成周期性的日志文件保存工作
appender.rolling.policies.type = Policies
# 基于日志文件大小的触发策略
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
# 当日志文件大小大于size指定的值时,触发滚动
appender.rolling.policies.size.size = 5MB
# 文件保存的覆盖策略
appender.rolling.strategy.type = DefaultRolloverStrategy
# 生成分割(保存)文件的个数,默认为5(-1,-2,-3,-4,-5)
appender.rolling.strategy.max = 50
 
# Suppress the irrelevant (wrong) warnings from the Netty channel handler
logger.netty.name = org.apache.flink.shaded.akka.org.jboss.netty.channel.DefaultChannelPipeline
logger.netty.level = OFF

三、启动

/bin/start-cluster.sh

四、访问

端口8081

flink单机部署实战centos7.6+1.11.6_第1张图片

你可能感兴趣的:(linux,大数据,大数据,flink)