Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EventTracking
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨林
EventTracking
Commits
0e703196
Commit
0e703196
authored
Jul 23, 2021
by
杨林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建flink表运行环境
parent
8637cc17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
33 deletions
+65
-33
src/main/scala/flink/FlinkEnv.scala
src/main/scala/flink/FlinkEnv.scala
+65
-0
src/main/scala/flink/GetEnvironment.scala
src/main/scala/flink/GetEnvironment.scala
+0
-33
No files found.
src/main/scala/flink/FlinkEnv.scala
0 → 100644
View file @
0e703196
package
flink
import
org.apache.flink.streaming.api.CheckpointingMode
import
org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
import
org.apache.flink.table.api.EnvironmentSettings
import
org.apache.flink.table.api.bridge.scala.StreamTableEnvironment
/**
* Created with IntelliJ IDEA.
* Class: GetEnvironment
* Description:
* User: lin
* Date: 2021-07-16
* Time: 9:35
*/
object
FlinkEnv
{
// 创建流环境
private
[
this
]
val
environment
:
StreamExecutionEnvironment
=
StreamExecutionEnvironment
.
getExecutionEnvironment
// 设置流表
private
[
this
]
val
settings
:
EnvironmentSettings
=
EnvironmentSettings
.
newInstance
.
useBlinkPlanner
.
inStreamingMode
.
build
// private val config: TableConfig = TableConfig.getDefault
// 设置检查点
environment
.
enableCheckpointing
(
1000
)
.
getCheckpointConfig
.
setCheckpointingMode
(
CheckpointingMode
.
AT_LEAST_ONCE
)
// 设置检查点在一分钟完成
// environment
// .getCheckpointConfig
// .setCheckpointTimeout(60000)
// 确保检查点之间有500毫秒的进程
environment
.
getCheckpointConfig
.
setMinPauseBetweenCheckpoints
(
500
)
//只允许同时有一个检查点
environment
.
getCheckpointConfig
.
setMaxConcurrentCheckpoints
(
1
)
// 启用保留的外部检查点
// environment
// .getCheckpointConfig
// .enableExternalizedCheckpoints(CheckpointConfig.ExternalizedCheckpointCleanup.RETAIN_ON_CANCELLATION)
//
environment
.
getCheckpointConfig
.
setTolerableCheckpointFailureNumber
(
2
)
// environment.setParallelism(3)
/**
* 获取flink运行环境
*
* @return 运行环境
*/
def
env
:
StreamExecutionEnvironment
=
environment
/**
* 获取flink表环境
*
* @return 运行环境
*/
def
tEnv
:
StreamTableEnvironment
=
StreamTableEnvironment
.
create
(
environment
,
settings
)
}
src/main/scala/flink/GetEnvironment.scala
deleted
100644 → 0
View file @
8637cc17
package
flink
import
org.apache.flink.streaming.api.CheckpointingMode
import
org.apache.flink.streaming.api.environment.CheckpointConfig
import
org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
/**
* Created with IntelliJ IDEA.
* Class: GetEnvironment
* Description:
* User: lin
* Date: 2021-07-16
* Time: 9:35
*/
object
GetEnvironment
{
def
env
:
StreamExecutionEnvironment
=
{
val
environment
=
StreamExecutionEnvironment
.
getExecutionEnvironment
// 设置检查点
environment
.
enableCheckpointing
(
5000
)
.
getCheckpointConfig
.
setCheckpointingMode
(
CheckpointingMode
.
EXACTLY_ONCE
)
// 设置检查点在一分钟完成
environment
.
getCheckpointConfig
.
setCheckpointTimeout
(
60000
)
// 确保检查点之间有500毫秒的进程
environment
.
getCheckpointConfig
.
setMinPauseBetweenCheckpoints
(
500
)
//只允许同时有一个检查点
environment
.
getCheckpointConfig
.
setMaxConcurrentCheckpoints
(
1
)
// 启用保留的外部检查点
environment
.
getCheckpointConfig
.
enableExternalizedCheckpoints
(
CheckpointConfig
.
ExternalizedCheckpointCleanup
.
RETAIN_ON_CANCELLATION
)
environment
.
setParallelism
(
3
)
environment
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment