当前位置:网站首页>Flink submitter
Flink submitter
2022-07-02 10:31:00 【Lucky lucky】
flink There are two ways to submit procedures :
1、Standalone HA
2、Flink on yarn
First, introduce the first method with examples :
#Standalone HA
package cn.wc
import org.apache.flink.api.java.utils.ParameterTool
import org.apache.flink.streaming.api.scala._
object StreamWordCount01 {
def main(args: Array[String]): Unit = {
// Create an environment
val env = StreamExecutionEnvironment.getExecutionEnvironment
// Reading data Source
val tool = ParameterTool.fromArgs(args)
val host = tool.get("host")
val port = tool.getInt("port")
//val inputStream = env.socketTextStream("master", 1314)
val inputStream = env.socketTextStream(host, port)
// Conversion operation
val result = inputStream.flatMap(_.split(" "))
.map((_, 1))
.keyBy(_._1)
.sum(1)
// Output Sink
result.print()
// perform
env.execute()
}
}
1. Start the cluster in the virtual machine first start-cluster.sh
2. stay master Node boot port :nc -lk 1314
[root@master ~]# nc -lk 1314
aa bb vv
aakk nn ee
3. Type the program as jar package . stay master:8081 Of Web Interface selection Submit new Job -> AddNew, Select the typed jar package .

4. Fill in the full class name 、 Parallelism 、 Parameters . single click Show Plan, You can see this below job The execution calculation of . Priority of parallelism : Parallelism in code > The parallelism specified when submitting > Parallelism in the configuration file .
Click on Submit Submit the program . Our program began to run .
5. stay Task Manager Click on Task. see Stdout. The result printed by our program will be displayed .

By default, our streaming computing program will not stop automatically . Can be found in Web The interface stops manually
stop . In the top right corner of the Cancel. Or close the port directly .
#Flink on yarn
Use... In actual development Flink on yarn There are many modes
1. start-up yarn, Switch to slave1 node :
start-yarn.sh
2.yarn-session.sh( Open up resources ) + flink run( Submit tasks )
The first jar Upload package to virtual machine
[root@master ~]# ll
Total usage 208
drwxr-xr-x. 2 root root 55 8 month 22 20:25 bin
-rw-r--r--. 1 root root 211918 8 month 28 19:17 flink0823-1.0.jar
drwxr-xr-x. 2 root root 70 8 month 23 09:06 script
3. Open up resources ,master node
stay yarn Previous start one Flink conversation , Execute the following command :
yarn-session.sh -n 2 -tm 800 -s 1 -d
explain :
#-n To apply for 2 A container , This is how many taskmanager
-tm Represent each TaskManager The memory size of
-s Represent each TaskManager Of slots Number
-d Indicates that the later program mode is running
[root@master ~]# yarn-session.sh -n 2 -tm 800 -s 1 -d
4. Open port
[root@master ~]# nc -lk 1314
5.flink run( Submit tasks ),master node
[root@master ~]# flink run -c cn.wc.StreamWordCount01 ./flink0823-1.0.jar --host master --port 1314
6. stay yarn Of 8088 The interface can see Flink session cluster Running .
7、 Go first yarn Of web Interface , adopt yarn Look at the interface again flink Program 
边栏推荐
- MySQL -- time zone / connector / driver type
- Postman -- use
- Applet development summary
- Edge computing accelerates live video scenes: clearer, smoother, and more real-time
- [jetbrain rider] an exception occurred in the construction project: the imported project "d:\visualstudio2017\ide\msbuild\15.0\bin\roslyn\microsoft.csh" was not found
- Vscode auto format
- Ctrip starts mixed office. How can small and medium-sized enterprises achieve mixed office?
- [Fantasy 4] the transformation from U3D to UE4
- 快速做出原型
- Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
猜你喜欢

Blender多鏡頭(多機比特)切換

Feature (5): how to organize information

07 data import sqoop

Post disaster reconstruction -- Floyd thought

Blender石头雕刻

stm32和电机开发(上位系统)

Following nym, the new project Galaxy token announced by coinlist is gal

Delivery mode design of Spartacus UI of SAP e-commerce cloud

Vscode set JSON file to format automatically after saving

Blender ocean production
随机推荐
【Lua】常见知识点汇总(包含常见面试考点)
Blender多镜头(多机位)切换
Leetcode -- the nearest common ancestor of 236 binary tree
[Fantasy 4] the transformation from U3D to UE4
UE4夜间打光笔记
Feature (5): how to organize information
Blender multi lens (multi stand) switching
ERROR 1118 (42000): Row size too large (> 8126)
Flink实时计算topN热榜
07 data import sqoop
Notes de base sur les plans illusoires d'IA (triés en 10 000 mots)
flume 190 INSTALL
【Unity3D】无法正确获取RectTransform的属性值导致计算出错
stm32和電機開發(上比特系統)
Blender体积雾
[200 Shengxin literatures] 96 joint biomarkers of immune checkpoint inhibitor response in advanced solid tumors
2021-10-02
【leetcode】33. Search rotation sort array
Application of rxjs operator withlatestfrom in Spartacus UI of SAP e-commerce cloud
两数之和,求目标值