当前位置:网站首页>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 
边栏推荐
- 2021-10-02
- 2021-10-04
- Tee command usage example
- Understand the composition of building energy-saving system
- What is call / cc- What is call/cc?
- 【MySQL】连接MySQL时出现异常:Connection must be valid and open
- [tutorial] how to make the Helpviewer help document of VisualStudio run independently
- Blender石头雕刻
- Considerations for Apache deploying static web page projects
- flink 提交程序
猜你喜欢
![[illusory] automatic door blueprint notes](/img/7a/14a66e5b623c7740dc91a15a328b10.png)
[illusory] automatic door blueprint notes

【MySQL】连接MySQL时出现异常:Connection must be valid and open

This article takes you to learn in detail what is fiber to home FTTH

【虚幻】按键开门蓝图笔记

Considerations for Apache deploying static web page projects

【JetBrain Rider】构建项目出现异常:未找到导入的项目“D:\VisualStudio2017\IDE\MSBuild\15.0\Bin\Roslyn\Microsoft.CSh
![[ue5] blueprint making simple mine tutorial](/img/87/d0bec747a6b6276d63a315f88745ec.png)
[ue5] blueprint making simple mine tutorial

Test -- Summary of interview questions

Application of rxjs operator withlatestfrom in Spartacus UI of SAP e-commerce cloud

Bookmark collection management software suspension reading and data migration between knowledge base and browser bookmarks
随机推荐
[leetcode] sword finger offer 53 - I. find the number I in the sorted array
Metaclass type and using metaclass to implement model class ORM
[200 Shengxin literatures] 95 multiomics exploration TNBC
Project practice, redis cluster technology learning (VII)
AutoCAD - layer Linetype
Blender体积雾
Post disaster reconstruction -- Floyd thought
Database -- acid of transaction -- introduction / explanation
Aiphacode is not a substitute for programmers, but a tool for developers
MPLS experiment
Excuse me, is it cost-effective to insure love life patron saint 2.0 increased lifelong life insurance? What are the advantages of this product?
[ue5] blueprint making simple mine tutorial
VLAN experiment
JS reduce accumulator
MongoDB-快速上手MongoDB命令行的一些简单操作
[unreal] key to open the door blueprint notes
【虚幻4】从U3D到UE4的转型之路
[pit avoidance guide] pit encountered using ugui: the text component cannot indent the first line by two spaces
lunix重新分配root 和 home 空间内存
Sum the two numbers to find the target value