|NO.Z.00005|——————————|Deployment|——|Hadoop&Flink计算领域锋利的武器.v05|——|Flink.v02|StandAlone模式测试|

一、在IDEA下导入打jar插件
### --- 将WordCountScalaStream打成jar包

~~~     注意:集群搭建完毕后,Flink程序就可以打成Jar,
~~~     在集群环境下类似于Step7中一样提交执行计算任务打jar包插件:
~~~     该插件可以把包含所有的Flink程序需要的所有的依赖文件,包含scala依赖插件,
~~~     可以不在环境下部署环境
    <build>
        <plugins>
            <!-- 打jar插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
二、maven打成jar包并测试
### --- 在IDEA下打成jar包:WordCountScalaStream
~~~     ——>Maven——>FirstFlink:Lifeycle——>Clean——>
~~~     ——>package——>生成文件:original-FirstFlink-1.0-SNAPSHOT.jar——>END

### --- 在Flink-UI下导入jar包
~~~     ——>http://hadoop01:8081/——>Submit New Job——>Add New——>导入Jar:FirstFlink-1.0-SNAPSHOT.jar——>
~~~     ——>在Submit提交之前在:hadoop01:nc -lp 7777启动起来——>Submit——>END
将并行度设置为1;默认的
可以在Task Managers上查看到任务槽输出
设置并行度为2
三、在命令行下提交jar包:
### --- 集群模式下
~~~     运行example测试

### --- 在UI上查看Running Jobs
~~~     运行程序之前启动nc
[root@hadoop01 ~]# nc -lp 7777
~~~     # 启动运行程序
[root@hadoop01 ~]# cd /opt/yanqi/servers/flink-1.11.1/bin/
[root@hadoop01 bin]# ./flink run -c WordCountScalaStream -p 2 /root/myjars/FirstFlink-1.0-SNAPSHOT.jar
~~~ 输出参数
Job has been submitted with JobID 5431e42d51540000c36e0b0a16a2d3e8

~~~     # 取消应用程序
[root@hadoop01 bin]# ./flink cancel 5431e42d51540000c36e0b0a16a2d3e8
~~~ 输出参数
Cancelling job d6baff0e7472ac13f83f364ce47749ea.
Cancelled job d6baff0e7472ac13f83f364ce47749ea.


 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

posted on   yanqi_vip  阅读(8)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示