USDP使用笔记(八)Flink配置及简单测试

news2024/11/19 2:41:59

Flink配置Flink配置及简单测试

上一篇:https://lizhiyong.blog.csdn.net/article/details/123560865
将USDP2.0自带的Flink更换为Flink1.14后,还没有来得及改配置。不改配置用起来是有问题的,所以。。。本文主要就是改配置及简单测试效果。

USDP默认的配置

################################################################################
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
# limitations under the License.
################################################################################


#==============================================================================
# Common
#==============================================================================

# The external address of the host on which the JobManager runs and can be
# reached by the TaskManagers and any clients which want to connect. This setting
# is only used in Standalone mode and may be overwritten on the JobManager side
# by specifying the --host <hostname> parameter of the bin/jobmanager.sh executable.
# In high availability mode, if you use the bin/start-cluster.sh script and setup
# the conf/masters file, this will be taken care of automatically. Yarn/Mesos
# automatically configure the host name based on the hostname of the node where the
# JobManager runs.

jobmanager.rpc.address: localhost

# The RPC port where the JobManager is reachable.

jobmanager.rpc.port: 6123


# The total process memory size for the JobManager.
#
# Note this accounts for all memory usage within the JobManager process, including JVM metaspace and other overhead.

jobmanager.memory.process.size: 1600m


# The total process memory size for the TaskManager.
#
# Note this accounts for all memory usage within the TaskManager process, including JVM metaspace and other overhead.

taskmanager.memory.process.size: 1728m

# To exclude JVM metaspace and overhead, please, use total Flink memory size instead of 'taskmanager.memory.process.size'.
# It is not recommended to set both 'taskmanager.memory.process.size' and Flink memory.
#
# taskmanager.memory.flink.size: 1280m

# The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.

taskmanager.numberOfTaskSlots: 1

# The parallelism used for programs that did not specify and other parallelism.

parallelism.default: 1

# The default file system scheme and authority.
#
# By default file paths without scheme are interpreted relative to the local
# root file system 'file:///'. Use this to override the default and interpret
# relative paths relative to a different file system,
# for example 'hdfs://mynamenode:12345'
#
# fs.default-scheme

#==============================================================================
# High Availability
#==============================================================================

# The high-availability mode. Possible options are 'NONE' or 'zookeeper'.
#
# high-availability: zookeeper

# The path where metadata for master recovery is persisted. While ZooKeeper stores
# the small ground truth for checkpoint and leader election, this location stores
# the larger objects, like persisted dataflow graphs.
#
# Must be a durable file system that is accessible from all nodes
# (like HDFS, S3, Ceph, nfs, ...)
#
# high-availability.storageDir: hdfs:///flink/ha/

# The list of ZooKeeper quorum peers that coordinate the high-availability
# setup. This must be a list of the form:
# "host1:clientPort,host2:clientPort,..." (default clientPort: 2181)
#
# high-availability.zookeeper.quorum: localhost:2181


# ACL options are based on https://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html#sc_BuiltinACLSchemes
# It can be either "creator" (ZOO_CREATE_ALL_ACL) or "open" (ZOO_OPEN_ACL_UNSAFE)
# The default value is "open" and it can be changed to "creator" if ZK security is enabled
#
# high-availability.zookeeper.client.acl: open

#==============================================================================
# Fault tolerance and checkpointing
#==============================================================================

# The backend that will be used to store operator state checkpoints if
# checkpointing is enabled.
#
# Supported backends are 'jobmanager', 'filesystem', 'rocksdb', or the
# <class-name-of-factory>.
#
# state.backend: filesystem

# Directory for checkpoints filesystem, when using any of the default bundled
# state backends.
#
# state.checkpoints.dir: hdfs://namenode-host:port/flink-checkpoints

# Default target directory for savepoints, optional.
#
# state.savepoints.dir: hdfs://namenode-host:port/flink-savepoints

# Flag to enable/disable incremental checkpoints for backends that
# support incremental checkpoints (like the RocksDB state backend).
#
# state.backend.incremental: false

# The failover strategy, i.e., how the job computation recovers from task failures.
# Only restart tasks that may have been affected by the task failure, which typically includes
# downstream tasks and potentially upstream tasks if their produced data is no longer available for consumption.

jobmanager.execution.failover-strategy: region

#==============================================================================
# Rest & web frontend
#==============================================================================

# The port to which the REST client connects to. If rest.bind-port has
# not been specified, then the server will bind to this port as well.
#
#rest.port: 8081

# The address to which the REST client will connect to
#
#rest.address: 0.0.0.0

# Port range for the REST and web server to bind to.
#
#rest.bind-port: 8080-8090

# The address that the REST & web server binds to
#
#rest.bind-address: 0.0.0.0

# Flag to specify whether job submission is enabled from the web-based
# runtime monitor. Uncomment to disable.

#web.submit.enable: false

#==============================================================================
# Advanced
#==============================================================================

# Override the directories for temporary files. If not specified, the
# system-specific Java temporary directory (java.io.tmpdir property) is taken.
#
# For framework setups on Yarn or Mesos, Flink will automatically pick up the
# containers' temp directories without any need for configuration.
#
# Add a delimited list for multiple directories, using the system directory
# delimiter (colon ':' on unix) or a comma, e.g.:
#     /data1/tmp:/data2/tmp:/data3/tmp
#
# Note: Each directory entry is read from and written to by a different I/O
# thread. You can include the same directory multiple times in order to create
# multiple I/O threads against that directory. This is for example relevant for
# high-throughput RAIDs.
#
# io.tmp.dirs: /tmp

# The classloading resolve order. Possible values are 'child-first' (Flink's default)
# and 'parent-first' (Java's default).
#
# Child first classloading allows users to use different dependency/library
# versions in their application than those in the classpath. Switching back
# to 'parent-first' may help with debugging dependency issues.
#
# classloader.resolve-order: child-first

# The amount of memory going to the network stack. These numbers usually need 
# no tuning. Adjusting them may be necessary in case of an "Insufficient number
# of network buffers" error. The default min is 64MB, the default max is 1GB.
# 
# taskmanager.memory.network.fraction: 0.1
# taskmanager.memory.network.min: 64mb
# taskmanager.memory.network.max: 1gb

#==============================================================================
# Flink Cluster Security Configuration
#==============================================================================

# Kerberos authentication for various components - Hadoop, ZooKeeper, and connectors -
# may be enabled in four steps:
# 1. configure the local krb5.conf file
# 2. provide Kerberos credentials (either a keytab or a ticket cache w/ kinit)
# 3. make the credentials available to various JAAS login contexts
# 4. configure the connector to use JAAS/SASL

# The below configure how Kerberos credentials are provided. A keytab will be used instead of
# a ticket cache if the keytab path and principal are set.

# security.kerberos.login.use-ticket-cache: true
# security.kerberos.login.keytab: /path/to/kerberos/keytab
# security.kerberos.login.principal: flink-user

# The configuration below defines which JAAS login contexts

# security.kerberos.login.contexts: Client,KafkaClient

#==============================================================================
# ZK Security Configuration
#==============================================================================

# Below configurations are applicable if ZK ensemble is configured for security

# Override below configuration to provide custom ZK service name if configured
# zookeeper.sasl.service-name: zookeeper

# The configuration below must match one of the values set in "security.kerberos.login.contexts"
# zookeeper.sasl.login-context-name: Client

#==============================================================================
# HistoryServer
#==============================================================================

# The HistoryServer is started and stopped via bin/historyserver.sh (start|stop)

# Directory to upload completed jobs to. Add this directory to the list of
# monitored directories of the HistoryServer as well (see below).
jobmanager.archive.fs.dir: hdfs://zhiyong-1/zhiyong-1/flink-completed-jobs/

# The address under which the web-based HistoryServer listens.
# historyserver.web.address: zhiyong3

# History Server所绑定的ip,0.0.0.0代表允许所有ip访问
historyserver.web.address: 0.0.0.0

# 指定History Server间隔多少毫秒扫描一次归档目录
historyserver.archive.fs.refresh-interval: 10000


# The port under which the web-based HistoryServer listens, default 8082.
historyserver.web.port: 8082

# Comma separated list of directories to monitor for completed jobs.
historyserver.archive.fs.dir: hdfs://zhiyong-1/zhiyong-1/flink-completed-jobs/

# Interval in milliseconds for refreshing the monitored directories, default 10000.
historyserver.archive.fs.refresh-interval: 10000
historyserver.web.tmpdir: /data/udp/2.0.0.0/flink
env.java.opts: -Dlog4j2.formatMsgNoLookups=true

开启HA

修改Yaml

################################################################################
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
# limitations under the License.
################################################################################


#==============================================================================
# Common
#==============================================================================

# The external address of the host on which the JobManager runs and can be
# reached by the TaskManagers and any clients which want to connect. This setting
# is only used in Standalone mode and may be overwritten on the JobManager side
# by specifying the --host <hostname> parameter of the bin/jobmanager.sh executable.
# In high availability mode, if you use the bin/start-cluster.sh script and setup
# the conf/masters file, this will be taken care of automatically. Yarn/Mesos
# automatically configure the host name based on the hostname of the node where the
# JobManager runs.

jobmanager.rpc.address: zhiyong2

# The RPC port where the JobManager is reachable.

jobmanager.rpc.port: 6123


# The total process memory size for the JobManager.
#
# Note this accounts for all memory usage within the JobManager process, including JVM metaspace and other overhead.

jobmanager.memory.process.size: 1600m


# The total process memory size for the TaskManager.
#
# Note this accounts for all memory usage within the TaskManager process, including JVM metaspace and other overhead.

taskmanager.memory.process.size: 1728m

# To exclude JVM metaspace and overhead, please, use total Flink memory size instead of 'taskmanager.memory.process.size'.
# It is not recommended to set both 'taskmanager.memory.process.size' and Flink memory.
#
# taskmanager.memory.flink.size: 1280m

# The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.

taskmanager.numberOfTaskSlots: 1

# The parallelism used for programs that did not specify and other parallelism.

parallelism.default: 1

# The default file system scheme and authority.
#
# By default file paths without scheme are interpreted relative to the local
# root file system 'file:///'. Use this to override the default and interpret
# relative paths relative to a different file system,
# for example 'hdfs://mynamenode:12345'
#
# fs.default-scheme

#==============================================================================
# High Availability
#==============================================================================

# The high-availability mode. Possible options are 'NONE' or 'zookeeper'.
#
high-availability: zookeeper

# The path where metadata for master recovery is persisted. While ZooKeeper stores
# the small ground truth for checkpoint and leader election, this location stores
# the larger objects, like persisted dataflow graphs.
#
# Must be a durable file system that is accessible from all nodes
# (like HDFS, S3, Ceph, nfs, ...)
#
high-availability.storageDir: hdfs://zhiyong-1/flink/ha/

# The list of ZooKeeper quorum peers that coordinate the high-availability
# setup. This must be a list of the form:
# "host1:clientPort,host2:clientPort,..." (default clientPort: 2181)
#
high-availability.zookeeper.quorum: zhiyong2:2181,zhiyong3:2181,zhiyong4:2181


# ACL options are based on https://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html#sc_BuiltinACLSchemes
# It can be either "creator" (ZOO_CREATE_ALL_ACL) or "open" (ZOO_OPEN_ACL_UNSAFE)
# The default value is "open" and it can be changed to "creator" if ZK security is enabled
#
# high-availability.zookeeper.client.acl: open

#==============================================================================
# Fault tolerance and checkpointing
#==============================================================================

# The backend that will be used to store operator state checkpoints if
# checkpointing is enabled.
#
# Supported backends are 'jobmanager', 'filesystem', 'rocksdb', or the
# <class-name-of-factory>.
#
state.backend: filesystem

# Directory for checkpoints filesystem, when using any of the default bundled
# state backends.
#
state.checkpoints.dir: hdfs://zhiyong-1/flink-checkpoints

# Default target directory for savepoints, optional.
#
state.savepoints.dir: hdfs://zhiyong-1/flink-savepoints

# Flag to enable/disable incremental checkpoints for backends that
# support incremental checkpoints (like the RocksDB state backend).
#
# state.backend.incremental: false

# The failover strategy, i.e., how the job computation recovers from task failures.
# Only restart tasks that may have been affected by the task failure, which typically includes
# downstream tasks and potentially upstream tasks if their produced data is no longer available for consumption.

jobmanager.execution.failover-strategy: region

#==============================================================================
# Rest & web frontend
#==============================================================================

# The port to which the REST client connects to. If rest.bind-port has
# not been specified, then the server will bind to this port as well.
#
#rest.port: 8081

# The address to which the REST client will connect to
#
#rest.address: 0.0.0.0

# Port range for the REST and web server to bind to.
#
#rest.bind-port: 8080-8090

# The address that the REST & web server binds to
#
#rest.bind-address: 0.0.0.0

# Flag to specify whether job submission is enabled from the web-based
# runtime monitor. Uncomment to disable.

web.submit.enable: true

#==============================================================================
# Advanced
#==============================================================================

# Override the directories for temporary files. If not specified, the
# system-specific Java temporary directory (java.io.tmpdir property) is taken.
#
# For framework setups on Yarn or Mesos, Flink will automatically pick up the
# containers' temp directories without any need for configuration.
#
# Add a delimited list for multiple directories, using the system directory
# delimiter (colon ':' on unix) or a comma, e.g.:
#     /data1/tmp:/data2/tmp:/data3/tmp
#
# Note: Each directory entry is read from and written to by a different I/O
# thread. You can include the same directory multiple times in order to create
# multiple I/O threads against that directory. This is for example relevant for
# high-throughput RAIDs.
#
# io.tmp.dirs: /tmp

# The classloading resolve order. Possible values are 'child-first' (Flink's default)
# and 'parent-first' (Java's default).
#
# Child first classloading allows users to use different dependency/library
# versions in their application than those in the classpath. Switching back
# to 'parent-first' may help with debugging dependency issues.
#
# classloader.resolve-order: child-first

# The amount of memory going to the network stack. These numbers usually need 
# no tuning. Adjusting them may be necessary in case of an "Insufficient number
# of network buffers" error. The default min is 64MB, the default max is 1GB.
# 
# taskmanager.memory.network.fraction: 0.1
# taskmanager.memory.network.min: 64mb
# taskmanager.memory.network.max: 1gb

#==============================================================================
# Flink Cluster Security Configuration
#==============================================================================

# Kerberos authentication for various components - Hadoop, ZooKeeper, and connectors -
# may be enabled in four steps:
# 1. configure the local krb5.conf file
# 2. provide Kerberos credentials (either a keytab or a ticket cache w/ kinit)
# 3. make the credentials available to various JAAS login contexts
# 4. configure the connector to use JAAS/SASL

# The below configure how Kerberos credentials are provided. A keytab will be used instead of
# a ticket cache if the keytab path and principal are set.

# security.kerberos.login.use-ticket-cache: true
# security.kerberos.login.keytab: /path/to/kerberos/keytab
# security.kerberos.login.principal: flink-user

# The configuration below defines which JAAS login contexts

# security.kerberos.login.contexts: Client,KafkaClient

#==============================================================================
# ZK Security Configuration
#==============================================================================

# Below configurations are applicable if ZK ensemble is configured for security

# Override below configuration to provide custom ZK service name if configured
# zookeeper.sasl.service-name: zookeeper

# The configuration below must match one of the values set in "security.kerberos.login.contexts"
# zookeeper.sasl.login-context-name: Client

#==============================================================================
# HistoryServer
#==============================================================================

# The HistoryServer is started and stopped via bin/historyserver.sh (start|stop)

# Directory to upload completed jobs to. Add this directory to the list of
# monitored directories of the HistoryServer as well (see below).
jobmanager.archive.fs.dir: hdfs://zhiyong-1/zhiyong-1/flink-completed-jobs/

# The address under which the web-based HistoryServer listens.
# historyserver.web.address: zhiyong3

# History Server所绑定的ip,0.0.0.0代表允许所有ip访问
historyserver.web.address: 0.0.0.0

# 指定History Server间隔多少毫秒扫描一次归档目录
historyserver.archive.fs.refresh-interval: 10000


# The port under which the web-based HistoryServer listens, default 8082.
historyserver.web.port: 8082

# Comma separated list of directories to monitor for completed jobs.
historyserver.archive.fs.dir: hdfs://zhiyong-1/zhiyong-1/flink-completed-jobs/

# Interval in milliseconds for refreshing the monitored directories, default 10000.
historyserver.archive.fs.refresh-interval: 10000
historyserver.web.tmpdir: /data/udp/2.0.0.0/flink
env.java.opts: -Dlog4j2.formatMsgNoLookups=true

修改后直接USDP确定,USDP会自动分发。

修改其它文件

masters

[root@zhiyong2 ~]# cd /srv/udp/2.0.0.0/flink/conf/
[root@zhiyong2 conf]# ll
总用量 60
-rwxrwxrwx 1 hadoop hadoop 10732 41 11:29 flink-conf.yaml
-rwxr-xr-x 1 root   root    4469 41 11:29 hive-site.xml
-rwxrwxrwx 1 hadoop hadoop  2917 314 23:15 log4j-cli.properties
-rwxrwxrwx 1 hadoop hadoop  3041 314 23:15 log4j-console.properties
-rwxrwxrwx 1 hadoop hadoop  2694 314 23:15 log4j.properties
-rwxrwxrwx 1 hadoop hadoop  2041 314 23:15 log4j-session.properties
-rwxrwxrwx 1 hadoop hadoop  2740 41 11:29 logback-console.xml
-rwxrwxrwx 1 hadoop hadoop  1550 314 23:15 logback-session.xml
-rwxrwxrwx 1 hadoop hadoop  2327 41 11:29 logback.xml
-rwxrwxrwx 1 hadoop hadoop    15 314 23:15 masters
drwxr-xr-x 2 root   root     300 41 11:29 old
-rwxrwxrwx 1 hadoop hadoop    10 314 23:15 workers
-rwxrwxrwx 1 hadoop hadoop  1434 314 23:15 zoo.cfg
[root@zhiyong2 conf]# cat masters
localhost:8081
[root@zhiyong2 conf]# vim masters
[root@zhiyong2 conf]# cat masters
zhiyong3:8081
zhiyong4:8081

zoo.cfg

[root@zhiyong2 conf]# vim zoo.cfg
[root@zhiyong2 conf]# cat zoo.cfg
################################################################################
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

# The number of milliseconds of each tick
tickTime=2000

# The number of ticks that the initial  synchronization phase can take
initLimit=10

# The number of ticks that can pass between  sending a request and getting an acknowledgement
syncLimit=5

# The directory where the snapshot is stored.
# dataDir=/tmp/zookeeper

# The port at which the clients will connect
clientPort=2181

# ZooKeeper quorum peers
server.1=zhiyong2:2888:3888
server.2=zhiyong3:2888:3888
server.3=zhiyong4:2888:3888
# server.2=host:peer-port:leader-port

workers

[root@zhiyong2 conf]# cat workers
localhost
[root@zhiyong2 conf]# vim workers
[root@zhiyong2 conf]# cat workers
zhiyong2
zhiyong3
zhiyong4

分发

[root@zhiyong2 conf]# pwd
/srv/udp/2.0.0.0/flink/conf
[root@zhiyong2 conf]# scp ./masters root@zhiyong3:$PWD
masters                                                                                                                     100%   28    11.5KB/s   00:00
[root@zhiyong2 conf]# scp ./masters root@zhiyong4:$PWD
masters                                                                                                                     100%   28     9.0KB/s   00:00
[root@zhiyong2 conf]# scp ./zoo.cfg root@zhiyong3:$PWD
zoo.cfg                                                                                                                     100% 1489   759.7KB/s   00:00
[root@zhiyong2 conf]# scp ./zoo.cfg root@zhiyong4:$PWD
zoo.cfg                                                                                                                     100% 1489   530.4KB/s   00:00
[root@zhiyong2 conf]# scp ./workers root@zhiyong3:$PWD
workers                                                                                                                     100%   27     7.0KB/s   00:00
[root@zhiyong2 conf]# scp ./workers root@zhiyong4:$PWD
workers                                                                                                                     100%   27     8.9KB/s   00:00
[root@zhiyong2 conf]#

测试on Yarn

在Yarn做资源容器的情况下,主要是3种模式:Session模式,Per-Job模式,Application模式。

Session模式适用于频繁交互的小任务【比如当即席查询来用的sql-client】。这种模式随便玩玩就好,生产环境不合适。

Per-Job好处就是资源隔离的比较彻底,坏处当然就是资源占用率可能不高,没办法充分压榨CPU的算力。

Application模式是后来新增的,当然也就先进一些。

在目前最新的官网文档:https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/deployment/resource-providers/yarn/#per-job-mode-deprecated

已经白底黑字清清楚楚地写了:

Per-job mode is only supported by YARN and has been deprecated in Flink 1.15. It will be dropped in FLINK-26000. Please consider application mode to launch a dedicated cluster per-job on YARN.

从Flink1.15开始Per-Job模式就要淘汰了,所以之后的新版本Flink应该逐步切换位Application模式。如果有必要,那也是基于Application模式构建专用集群模拟出Per-Job的效果。

Session模式

提交任务:

./bin/flink run -t yarn-session \
  -Dyarn.application.id=application_XXXX_YY \
  ./examples/streaming/TopSpeedWindowing.jar

或者指定Yarn的ID:

./bin/yarn-session.sh -id application_XXXX_YY

Per-Job模式

这是我们prod使用的部署模式,用法简单:

./bin/flink run -t yarn-per-job --detached ./examples/streaming/TopSpeedWindowing.jar

查看和cancel掉任务也很简单:

# List running job on the cluster
./bin/flink list -t yarn-per-job -Dyarn.application.id=application_XXXX_YY
# Cancel running job
./bin/flink cancel -t yarn-per-job -Dyarn.application.id=application_XXXX_YY <jobId>

Application模式

提交任务:

./bin/flink run-application -t yarn-application ./examples/streaming/TopSpeedWindowing.jar

查看和Cancel任务:

# List running job on the cluster
./bin/flink list -t yarn-application -Dyarn.application.id=application_XXXX_YY
# Cancel running job
./bin/flink cancel -t yarn-application -Dyarn.application.id=application_XXXX_YY <jobId>

还可以提前上传依赖的Jar包到HDFS:

./bin/flink run-application -t yarn-application \
	-Dyarn.provided.lib.dirs="hdfs://myhdfs/my-remote-flink-dist-dir" \
	hdfs://myhdfs/jars/my-application.jar

这样减少分发来提速。

简单测试

由于批处理是跑完就自动停止,所以当只启动一个批处理任务时,各种模式区别不太大,简单起见使用session模式。

当前线程

[root@zhiyong2 ~]# jps
14048 NameNode
13729 DFSZKFailoverController
377220 NodeManager
10854 udp-agent-1.0.0.jar
16326 HMaster
13130 HttpFSServerWebServer
17325 RunJar
15790 HRegionServer
379882 ResourceManager
988575 Jps
988190 RunJar
14323 JournalNode
11156 QuorumPeerMain
13492 DataNode
17305 RunJar

启动任务

[root@zhiyong2 ~]# flink run -m yarn-cluster -yjm 1024 -ytm 1024 /srv/udp/2.0.0.0/flink/examples/batch/WordCount.jar
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/usdp-srv/srv/udp/2.0.0.0/flink/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/usdp-srv/srv/udp/2.0.0.0/yarn/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Executing WordCount example with default input data set.
Use --input to specify file input.
Printing result to stdout. Use --output to specify output path.
2022-04-01 12:48:35,994 WARN  org.apache.flink.yarn.configuration.YarnLogConfigUtil        [] - The configuration directory ('/opt/usdp-srv/srv/udp/2.0.0.0/flink/conf') already contains a LOG4J config file.If you want to use logback, then please delete or rename the log configuration file.
2022-04-01 12:48:36,424 INFO  org.apache.hadoop.yarn.client.AHSProxy                       [] - Connecting to Application History server at zhiyong3/192.168.88.102:10201
2022-04-01 12:48:36,432 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - No path for the flink jar passed. Using the location of class org.apache.flink.yarn.YarnClusterDescriptor to locate the jar
2022-04-01 12:48:36,526 INFO  org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider [] - Failing over to rm2
2022-04-01 12:48:36,582 INFO  org.apache.hadoop.conf.Configuration                         [] - resource-types.xml not found
2022-04-01 12:48:36,582 INFO  org.apache.hadoop.yarn.util.resource.ResourceUtils           [] - Unable to find 'resource-types.xml'.
2022-04-01 12:48:36,630 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - Cluster specification: ClusterSpecification{masterMemoryMB=1024, taskManagerMemoryMB=1024, slotsPerTaskManager=1}
2022-04-01 12:48:41,392 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - Submitting application master application_1648782295643_0004
2022-04-01 12:48:41,666 INFO  org.apache.hadoop.yarn.client.api.impl.YarnClientImpl        [] - Submitted application application_1648782295643_0004
2022-04-01 12:48:41,667 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - Waiting for the cluster to be allocated
2022-04-01 12:48:41,670 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - Deploying cluster, current state ACCEPTED
2022-04-01 12:48:50,387 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - YARN application has been deployed successfully.
2022-04-01 12:48:50,388 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - Found Web Interface zhiyong2:40000 of application 'application_1648782295643_0004'.
Job has been submitted with JobID 8ed8908de03e30fface549af0a3c2180
Program execution finished
Job with JobID 8ed8908de03e30fface549af0a3c2180 has finished.
Job Runtime: 14446 ms
Accumulator Results:
- 780a8818b15c7abfa776bae8c4db75b8 (java.util.ArrayList) [170 elements]

当前线程

[root@zhiyong2 ~]# jps
14048 NameNode
13729 DFSZKFailoverController
377220 NodeManager
988845 CliFrontend
990315 YarnJobClusterEntrypoint
10854 udp-agent-1.0.0.jar
16326 HMaster
13130 HttpFSServerWebServer
17325 RunJar
15790 HRegionServer
379882 ResourceManager
14323 JournalNode
11156 QuorumPeerMain
13492 DataNode
990330 Jps
17305 RunJar
989424 RunJar

运行结果:

[root@zhiyong2 ~]# flink run -m yarn-cluster -yjm 1024 -ytm 1024 /srv/udp/2.0.0.0/flink/examples/batch/WordCount.jar
。。。省略中间多余的内容
(wrong,1)
(you,1)

批处理任务结束后线程自动kill。

历史记录

http://zhiyong3:8088/cluster

可以看到:

在这里插入图片描述

成功提交到Yarn。

开启History Server

[root@zhiyong2 ~]# which historyserver.sh
/srv/udp/2.0.0.0/flink/bin/historyserver.sh
[root@zhiyong2 ~]# historyserver.sh start
Starting historyserver daemon on host zhiyong2.
[root@zhiyong2 ~]# netstat -lntp |grep 8082
[root@zhiyong2 ~]# historyserver.sh stop
No historyserver daemon (pid: 853461) is running anymore on zhiyong2.
[root@zhiyong2 ~]# historyserver.sh stop
No historyserver daemon (pid: 688346) is running anymore on zhiyong2.

显然启动失败!

查看脚本:

[root@zhiyong2 ~]# cat /srv/udp/2.0.0.0/flink/bin/historyserver.sh
#!/usr/bin/env bash
################################################################################
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

# Start/stop a Flink HistoryServer
USAGE="Usage: historyserver.sh (start|start-foreground|stop)"

STARTSTOP=$1

bin=`dirname "$0"`
bin=`cd "$bin"; pwd`

. "$bin"/config.sh

if [[ $STARTSTOP == "start" ]] || [[ $STARTSTOP == "start-foreground" ]]; then
    export FLINK_HISTORYSERVER_JMX_OPTS="-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.port=7930 -javaagent:/srv/udp/2.0.0.0/flink/jmx_exporter/jmx_exporter.jar=7931:/srv/udp/2.0.0.0/flink/jmx_exporter/jmx_config_flink_history_server.yml"
    export FLINK_ENV_JAVA_OPTS="${FLINK_ENV_JAVA_OPTS} ${FLINK_ENV_JAVA_OPTS_HS} ${FLINK_HISTORYSERVER_JMX_OPTS}"
        args=("--configDir" "${FLINK_CONF_DIR}")
fi

if [[ $STARTSTOP == "start-foreground" ]]; then
    exec "${FLINK_BIN_DIR}"/flink-console.sh historyserver "${args[@]}"
else
    "${FLINK_BIN_DIR}"/flink-daemon.sh $STARTSTOP historyserver "${args[@]}"
fi

Apache版本的长这样:

[root@zhiyong2 ~]# cd /export/server/
[root@zhiyong2 server]# ll
总用量 0
drwxrwxrwx 10 hadoop hadoop 156 314 23:14 flink
drwxr-xr-x 10    501 games  156 111 07:45 flink-1.14.3
[root@zhiyong2 server]# cd flink-1.14.3/
[root@zhiyong2 flink-1.14.3]# cd bin/
[root@zhiyong2 bin]# ll
总用量 2348
-rw-r--r-- 1 501 games 2290643 111 07:45 bash-java-utils.jar
-rwxr-xr-x 1 501 games   20576 1130 01:53 config.sh
-rwxr-xr-x 1 501 games    1318 914 2020 find-flink-home.sh
-rwxr-xr-x 1 501 games    2381 820 2021 flink
-rwxr-xr-x 1 501 games    4247 1029 04:32 flink-console.sh
-rwxr-xr-x 1 501 games    6584 820 2021 flink-daemon.sh
-rwxr-xr-x 1 501 games    1564 914 2020 historyserver.sh
-rwxr-xr-x 1 501 games    2295 18 2021 jobmanager.sh
-rwxr-xr-x 1 501 games    1650 820 2021 kubernetes-jobmanager.sh
-rwxr-xr-x 1 501 games    1717 820 2021 kubernetes-session.sh
-rwxr-xr-x 1 501 games    1770 820 2021 kubernetes-taskmanager.sh
-rwxr-xr-x 1 501 games    2994 820 2021 pyflink-shell.sh
-rwxr-xr-x 1 501 games    3742 820 2021 sql-client.sh
-rwxr-xr-x 1 501 games    2006 128 2021 standalone-job.sh
-rwxr-xr-x 1 501 games    1837 914 2020 start-cluster.sh
-rwxr-xr-x 1 501 games    1854 914 2020 start-zookeeper-quorum.sh
-rwxr-xr-x 1 501 games    1617 914 2020 stop-cluster.sh
-rwxr-xr-x 1 501 games    1845 914 2020 stop-zookeeper-quorum.sh
-rwxr-xr-x 1 501 games    2960 820 2021 taskmanager.sh
-rwxr-xr-x 1 501 games    1725 820 2021 yarn-session.sh
-rwxr-xr-x 1 501 games    2405 18 2021 zookeeper.sh
[root@zhiyong2 bin]# cat historyserver.sh
#!/usr/bin/env bash
################################################################################
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
# limitations under the License.
################################################################################

# Start/stop a Flink HistoryServer
USAGE="Usage: historyserver.sh (start|start-foreground|stop)"

STARTSTOP=$1

bin=`dirname "$0"`
bin=`cd "$bin"; pwd`

. "$bin"/config.sh

if [[ $STARTSTOP == "start" ]] || [[ $STARTSTOP == "start-foreground" ]]; then
    export FLINK_ENV_JAVA_OPTS="${FLINK_ENV_JAVA_OPTS} ${FLINK_ENV_JAVA_OPTS_HS}"
        args=("--configDir" "${FLINK_CONF_DIR}")
fi

if [[ $STARTSTOP == "start-foreground" ]]; then
    exec "${FLINK_BIN_DIR}"/flink-console.sh historyserver "${args[@]}"
else
    "${FLINK_BIN_DIR}"/flink-daemon.sh $STARTSTOP historyserver "${args[@]}"
fi

显然USDP版的Flink与Apache版的Flink有些不同。

尝试使用Apache版Flink的History Server

[root@zhiyong2 conf]# cp flink-conf.yaml flink-conf.yaml-beifen
[root@zhiyong2 conf]# ll
总用量 64
-rw-r--r-- 1  501 games 11123 1029 04:32 flink-conf.yaml
-rw-r--r-- 1 root root  11123 41 15:35 flink-conf.yaml-beifen
-rw-r--r-- 1  501 games  2917 1029 04:32 log4j-cli.properties
-rw-r--r-- 1  501 games  3041 1029 04:32 log4j-console.properties
-rw-r--r-- 1  501 games  2694 1029 04:32 log4j.properties
-rw-r--r-- 1  501 games  2041 1029 04:32 log4j-session.properties
-rw-r--r-- 1  501 games  2711 1029 04:32 logback-console.xml
-rw-r--r-- 1  501 games  1550 914 2020 logback-session.xml
-rw-r--r-- 1  501 games  2302 1029 04:32 logback.xml
-rw-r--r-- 1  501 games    15 914 2020 masters
-rw-r--r-- 1  501 games    10 914 2020 workers
-rw-r--r-- 1  501 games  1434 914 2020 zoo.cfg
[root@zhiyong2 conf]# cat masters
localhost:8081
[root@zhiyong2 conf]# cp /srv/udp/2.0.0.0/flink/conf/flink-conf.yaml /export/server/flink/conf
cp:是否覆盖"/export/server/flink/conf/flink-conf.yaml"? y
[root@zhiyong2 conf]# cd ..
[root@zhiyong2 flink-1.14.3]# cd bin/
[root@zhiyong2 bin]# ll
总用量 2348
-rw-r--r-- 1 501 games 2290643 111 07:45 bash-java-utils.jar
-rwxr-xr-x 1 501 games   20576 1130 01:53 config.sh
-rwxr-xr-x 1 501 games    1318 914 2020 find-flink-home.sh
-rwxr-xr-x 1 501 games    2381 820 2021 flink
-rwxr-xr-x 1 501 games    4247 1029 04:32 flink-console.sh
-rwxr-xr-x 1 501 games    6584 820 2021 flink-daemon.sh
-rwxr-xr-x 1 501 games    1564 914 2020 historyserver.sh
-rwxr-xr-x 1 501 games    2295 18 2021 jobmanager.sh
-rwxr-xr-x 1 501 games    1650 820 2021 kubernetes-jobmanager.sh
-rwxr-xr-x 1 501 games    1717 820 2021 kubernetes-session.sh
-rwxr-xr-x 1 501 games    1770 820 2021 kubernetes-taskmanager.sh
-rwxr-xr-x 1 501 games    2994 820 2021 pyflink-shell.sh
-rwxr-xr-x 1 501 games    3742 820 2021 sql-client.sh
-rwxr-xr-x 1 501 games    2006 128 2021 standalone-job.sh
-rwxr-xr-x 1 501 games    1837 914 2020 start-cluster.sh
-rwxr-xr-x 1 501 games    1854 914 2020 start-zookeeper-quorum.sh
-rwxr-xr-x 1 501 games    1617 914 2020 stop-cluster.sh
-rwxr-xr-x 1 501 games    1845 914 2020 stop-zookeeper-quorum.sh
-rwxr-xr-x 1 501 games    2960 820 2021 taskmanager.sh
-rwxr-xr-x 1 501 games    1725 820 2021 yarn-session.sh
-rwxr-xr-x 1 501 games    2405 18 2021 zookeeper.sh
[root@zhiyong2 bin]# sh historyserver.sh start
/export/server/flink-1.14.3/bin/config.sh:行32: 未预期的符号 `<' 附近有语法错误
/export/server/flink-1.14.3/bin/config.sh:行32: `    done < <(find "$FLINK_LIB_DIR" ! -type d -name '*.jar' -print0 | sort -z)'

可能是Apache版Flink本身就有Bug!自己玩,使用Stand alone和 K8S都可以,K8S取代Yarn是必然的事。启动不了这个historyserver问题不大。

使用USDP自带的History Server

USDP版本的显然是自行封装了一些Apache版不具备的内容。

ssh到zhiyong5后跨机器拷贝USDP自行封装的包:

[root@zhiyong5 flink]# pwd
/srv/udp/2.0.0.0/flink
[root@zhiyong5 flink]# ll
总用量 28
drwxr-xr-x.  2 hadoop hadoop  4096 41 15:59 bin
drwxr-xr-x.  2 hadoop hadoop   284 31 23:35 conf
drwxr-xr-x.  7 hadoop hadoop    76 109 17:49 examples
drwxr-xr-x.  2 hadoop hadoop    73 31 23:35 jmx_exporter
drwxr-xr-x.  2 hadoop hadoop  4096 1023 16:14 lib
-rwxr-xr-x.  1 hadoop hadoop 11357 723 2021 LICENSE
drwxr-xr-x.  2 hadoop hadoop     6 723 2021 log
drwxr-xr-x.  3 hadoop hadoop  4096 109 17:49 opt
drwxr-xr-x. 10 hadoop hadoop   210 109 17:49 plugins
-rwxr-xr-x.  1 hadoop hadoop  1309 723 2021 README.txt
drwxrwxrwx.  2 hadoop hadoop     6 41 14:46 run
[root@zhiyong5 flink]# scp -r ./jmx_exporter/ root@zhiyong2:$PWD
jmx_exporter.jar                                                                                                            100%  366KB  19.1MB/s   00:00
jmx_config_flink_history_server.yml                                                                                         100%  152   102.3KB/s   00:00
[root@zhiyong5 flink]# scp -r ./jmx_exporter/ root@zhiyong3:$PWD
jmx_exporter.jar                                                                                                            100%  366KB  23.8MB/s   00:00
jmx_config_flink_history_server.yml                                                                                         100%  152    87.6KB/s   00:00
[root@zhiyong5 flink]# scp -r ./jmx_exporter/ root@zhiyong4:$PWD
jmx_exporter.jar                                                                                                            100%  366KB  23.7MB/s   00:00
jmx_config_flink_history_server.yml                                                                                         100%  152    77.3KB/s   00:00

当然USDP魔改的脚本也需要scp:

[root@zhiyong5 bin]# pwd
/srv/udp/2.0.0.0/flink/bin
[root@zhiyong5 bin]# scp ./config.sh root@zhiyong2:$PWD
config.sh                                                                                                                   100%   20KB   3.5MB/s   00:00
[root@zhiyong5 bin]# scp ./config.sh root@zhiyong3:$PWD
Warning: Permanently added 'zhiyong3' (ECDSA) to the list of known hosts.
config.sh                                                                                                                   100%   20KB  10.9MB/s   00:00
[root@zhiyong5 bin]# scp ./config.sh root@zhiyong4:$PWD
Warning: Permanently added 'zhiyong4' (ECDSA) to the list of known hosts.
config.sh                                                                                                                   100%   20KB   8.9MB/s   00:00

修改zhiyong-1集群的flink-conf.yaml:

historyserver.web.address: zhiyong3

点确定后可以自动分发。

之后启动History Server:

[root@zhiyong2 flink]# historyserver.sh start
Starting historyserver daemon on host zhiyong2.
[root@zhiyong2 flink]# netstat -lntp |grep 8082

[root@zhiyong3 ~]# netstat -lntp |grep 8082
tcp6       0      0 192.168.88.102:8082     :::*                    LISTEN      412060/java

打开网站:

http://zhiyong3:8082/#/overview

显示:

在这里插入图片描述

此时虽然可以看到是更换过的Flink1.14.3的Web UI,但是允许提交任务的设置显然并没有生效:

web.submit.enable: true

这个History Server貌似反应也有点迟钝。用来查看批处理的历史记录影响不是很大,但是查看正在运行的流计算任务就很不合适。暂时凑合着先用Stand Alone的web UI。

流计算测试

[root@zhiyong2 ~]# nc -lk 9999
-bash: nc: 未找到命令
[root@zhiyong2 ~]# yum install -y nc

提交到Yarn:

[root@zhiyong2 streaming]# flink run -m yarn-cluster -yjm 1024 -ytm 1024 /srv/udp/2.0.0.0/flink/examples/streaming/SocketWindowWordCount.jar --hostname zhiyong2 --port 9998

都还比较正常。

随便搞个测试的类包:

package com.zhiyong.start;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.source.SourceFunction;

import java.util.ArrayList;
import java.util.Random;

/**
 * @program: bigdataStudy
 * @description: 自动wordCount测试Flink环境是否正常
 * @author: zhiyong
 * @create: 2022-04-01 19:50
 **/
public class WordCountAuto {
    public static void main(String[] args) throws Exception{
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<String> data = env.addSource(new source());
        data.print();

        env.execute("测试");

    }

    //自定义数据源
    private static class source implements SourceFunction<String>{
        boolean needRun = true;

        @Override
        public void run(SourceContext<String> ctx) throws Exception {
            while (needRun){
                ArrayList<String> result = new ArrayList<>();
                for (int i = 0; i < 20; i++) {
                    result.add("zhiyong" + i);
                }
                ctx.collect(result.get(new Random().nextInt(20)));
                Thread.sleep(1000);
            }
        }

        @Override
        public void cancel() {
            needRun=false;
        }
    }
}

此时使用StandAlone模式提交会报错:

[root@zhiyong2 ~]# flink run --class com.zhiyong.start.WordCountAuto /root/jars/flinkStudy-1.0.0.jar
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/usdp-srv/srv/udp/2.0.0.0/flink/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/usdp-srv/srv/udp/2.0.0.0/yarn/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
2022-04-01 20:22:45,449 INFO  org.apache.flink.yarn.cli.FlinkYarnSessionCli                [] - Found Yarn properties file under /tmp/.yarn-properties-root.
2022-04-01 20:22:45,449 INFO  org.apache.flink.yarn.cli.FlinkYarnSessionCli                [] - Found Yarn properties file under /tmp/.yarn-properties-root.
2022-04-01 20:22:46,165 WARN  org.apache.flink.yarn.configuration.YarnLogConfigUtil        [] - The configuration directory ('/opt/usdp-srv/srv/udp/2.0.0.0/flink/conf') already contains a LOG4J config file.If you want to use logback, then please delete or rename the log configuration file.
2022-04-01 20:22:46,655 INFO  org.apache.hadoop.yarn.client.AHSProxy                       [] - Connecting to Application History server at zhiyong3/192.168.88.102:10201
2022-04-01 20:22:46,666 INFO  org.apache.flink.yarn.YarnClusterDescriptor                  [] - No path for the flink jar passed. Using the location of class org.apache.flink.yarn.YarnClusterDescriptor to locate the jar
2022-04-01 20:22:46,734 INFO  org.apache.hadoop.yarn.client.ConfiguredRMFailoverProxyProvider [] - Failing over to rm2
2022-04-01 20:22:46,797 ERROR org.apache.flink.yarn.YarnClusterDescriptor                  [] - The application application_1648782295643_0010 doesn't run anymore. It has previously completed with final status: KILLED

------------------------------------------------------------
 The program finished with the following exception:

org.apache.flink.client.program.ProgramInvocationException: The main method caused an error: Couldn't retrieve Yarn cluster
        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:372)
        at org.apache.flink.client.program.PackagedProgram.invokeInteractiveModeForExecution(PackagedProgram.java:222)
        at org.apache.flink.client.ClientUtils.executeProgram(ClientUtils.java:114)
        at org.apache.flink.client.cli.CliFrontend.executeProgram(CliFrontend.java:812)
        at org.apache.flink.client.cli.CliFrontend.run(CliFrontend.java:246)
        at org.apache.flink.client.cli.CliFrontend.parseAndRun(CliFrontend.java:1054)
        at org.apache.flink.client.cli.CliFrontend.lambda$main$10(CliFrontend.java:1132)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAs(Subject.java:422)
        at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729)
        at org.apache.flink.runtime.security.contexts.HadoopSecurityContext.runSecured(HadoopSecurityContext.java:41)
        at org.apache.flink.client.cli.CliFrontend.main(CliFrontend.java:1132)
Caused by: org.apache.flink.client.deployment.ClusterRetrieveException: Couldn't retrieve Yarn cluster
        at org.apache.flink.yarn.YarnClusterDescriptor.retrieve(YarnClusterDescriptor.java:411)
        at org.apache.flink.yarn.YarnClusterDescriptor.retrieve(YarnClusterDescriptor.java:128)
        at org.apache.flink.client.deployment.executors.AbstractSessionClusterExecutor.execute(AbstractSessionClusterExecutor.java:75)
        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:2042)
        at org.apache.flink.client.program.StreamContextEnvironment.executeAsync(StreamContextEnvironment.java:137)
        at org.apache.flink.client.program.StreamContextEnvironment.execute(StreamContextEnvironment.java:76)
        at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1916)
        at com.zhiyong.start.WordCountAuto.main(WordCountAuto.java:22)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)
        ... 11 more
Caused by: java.lang.RuntimeException: The Yarn application application_1648782295643_0010 doesn't run anymore.
        at org.apache.flink.yarn.YarnClusterDescriptor.retrieve(YarnClusterDescriptor.java:397)
        ... 23 more

这是因为之前使用过Yarn的session模式,有残留文件,需要:

[root@zhiyong2 tmp]# cd /tmp/
[root@zhiyong2 tmp]# cat .yarn-properties-root
#Generated YARN properties file
#Fri Apr 01 18:20:14 CST 2022
dynamicPropertiesString=
applicationID=application_1648782295643_0010
[root@zhiyong2 tmp]# rm -rf .yarn-properties-root

重新Run任务,可以看到:

在这里插入图片描述

也可以手动停止任务:

在这里插入图片描述

但是此时USDP的Flink Web UI还什么都看不到:

在这里插入图片描述

需要过一会儿才能看到执行结果:

在这里插入图片描述

开源组件,一步一个坑。。。不是在填坑,就是在填坑的路上。

从Flink1.15开始,JDK需要JDK11+了,所以JDK1.8止步于Flink1.14了。可能JDK11的ZGC更强?时代总是要进步的。

转载请注明出处:https://lizhiyong.blog.csdn.net/article/details/128474711

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/125033.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

基于ssm框架实现的Java web在线考试系统

一、项目简介 本项目是一套基于ssm框架实现的Java web在线考试系统&#xff0c;主要针对计算机相关专业的正在做毕设的学生与需要项目实战练习的Java学习者。 包含&#xff1a;项目源码、数据库脚本等&#xff0c;该项目附带全部源码可作为毕设使用。 项目都经过严格调试&…

HITCON2022--ctf驱动逆向题

作者&#xff1a;selph HITCON CTF 2022 Writeup-checker 挺有意思的一道题&#xff0c;这里的关键函数是使用的动态生成执行操作&#xff0c;按照特定参数序列进行解密才能正常执行&#xff0c;否则一定会报错异常 checker 一共给了两个文件&#xff1a;checker.exe和chec…

VR数字政务:多功能一体化,政务服务更便民

越来越多的政务单位都是通过网络等线上信息化渠道&#xff0c;进行政务的推进以及落实、查询等功能的实施&#xff0c;在实际的政务应用中&#xff0c;VR技术可以打造集实景导航、窗口查询、在线申报等多功能为一体&#xff0c;实现数据多跑腿、群众少跑腿&#xff0c;有效提高…

Nginx 01篇——Nginx详细安装步骤以及Nginx各种启动方式

Nginx 01篇——Nginx详细安装步骤以及Nginx各种启动方式1. 前言2. 下载安装2.1 下载安装包2.2 安装2.2.1 离线安装2.2.1.1 安装步骤2.2.1.2 安装问题2.2.2 先安装所需依赖2.2.3 直接 yum 安装2.2.4 指定安装目录安装3. nginx 启动4. 启动后访问5. Nginx 启动等简单命令5.1 启动…

SVN,Git与Helix Core,谁的数据管理基础设施更安全?

2022年2月底&#xff0c;全球知名的半导体芯片公司英伟达被爆遭到勒索软件攻击&#xff0c;不久后&#xff0c;英伟达公司官方证实遭到入侵&#xff0c;攻击者已开始在线泄露员工凭据和私密信息。勒索软件组织表示&#xff0c;如果英伟达拒绝支付高达100万美元的赎金&#xff0…

写在2022年的末尾

今年是我人生的第24个年头。 最近了解稚晖君&#xff0c;xinglu师兄&#xff0c;以及很多优秀的同辈人的事迹之后&#xff0c;感觉到自己还差了很远。 读研已经过半&#xff0c;研二已经到了第二个学期&#xff0c;而自己还什么成果都没有。甚至开题的事情到现在都还没有头绪。…

C++简介

C是一种计算机高级程序设计语言&#xff0c;由C语言扩展升级而产生 &#xff0c;最早于1979年由本贾尼斯特劳斯特卢普在AT&T贝尔工作室研发。 C既可以进行C语言的过程化程序设计&#xff0c;又可以进行以抽象数据类型为特点的基于对象的程序设计&#xff0c;还可以进行以…

计算机英文论文怎么做降重? - 易智编译EaseEditing

人工降重一定要找靠谱的机构做。 降重是很耗费精力和时间的学术服务。 而那些没有口碑且不专业的商家&#xff0c;真的会花费那么多心思来仔细琢磨你的论文吗&#xff1f; 那些没有声誉的非专业商家给论文降重会产生很多弊端&#xff1a; &#xff08;1&#xff09;他们为了…

内网穿透你真的了解吗?

前言 内网穿透作为程序员常用的调试手段之一&#xff0c;我们可以通过在个人电脑上运行花生壳或者 frp 等方式&#xff0c;让他人访问我们本地启动的服务&#xff0c;而且这种访问可以不受局域网的限制&#xff0c;当我们使用ngrok,frp等开源框架时&#xff0c;你是否有好奇过…

力扣sql入门篇(一)

力扣sql入门篇(一) 1 大的国家 1.1 题目内容 1.1.1 基本题目信息 1.1.2 示例输入输出 1.2 示例sql语句 SELECT name,population,area FROM World WHERE area>3000000 OR population>250000001.3 运行截图 2 可回收且低碳的产品 2.1 题目内容 2.1.1 基本题目信息 2.…

c++使用icu国际化(i18n)

icu International Components for Unicode&#xff0c;https://github.com/unicode-org/icu.git https://icu.unicode.org/ 帮助文档&#xff1a; https://unicode-org.github.io/icu/userguide/icu/howtouseicu.html i18n&#xff0c;Internationalization (in/i18n) libra…

第五章:开机,重启和用户登录注销-[实操篇]

一&#xff1a;开机&重启命令 1.1基本介绍 shutdown shutdown -h now&#xff1a;表示立即关机 shutdown -h 1 : 表示1分钟后关机 shutdown -r now : 立即重启 halt 就是直接使用&#xff0c;效果等价于关机 reboot 就是直接使用&#xff0c;效果等价于关机 syn &…

uTools V3.3.0 效率工具集

前言 uTools是一款基于electron开发的工具集软件&#xff0c;通过快捷唤醒搜索&#xff0c;直接打开各种功能&#xff0c;非常方便。 uTools uTools是一个极简、插件化、跨平台的现代化桌面软件。通过自由选配丰富的插件&#xff0c;打造你得心应手的工具集合。 通过快捷键…

制作gltf动态夜景模型

kele 前言 要制作一个充满科技感的场景&#xff0c;离不开动画特效。众所周知&#xff0c;Unity软件可制作各种炫酷动画效果&#xff0c;如果将Unity中的动画添加到WebGL网页项目中&#xff0c;那一定会非常美妙吧~接下来小编将介绍如何通过Unity制作纹理动画&#xff0c;并导…

RISC-V IDE MRS使用笔记(七) :常用开发技巧汇总

RISC-V IDE MRS使用笔记(七) &#xff1a;常用开发技巧汇总 Q1: MRS调试时如何查看外设寄存器内容&#xff1f; A1: 在调试配置界面添加相应的.svd文件。 Q2: MRS如何调用数学库? A2: #include ”math.h”头文件,并在工程属性页面增加”m”参数。 Q3: 如何设置MRS调试前默认…

还在对比IT培训机构,行内人告诉你怎么比?

还在对比IT培训机构&#xff0c;行内人告诉你怎么比&#xff1f;因为身处IT培训行业6年多点时间 &#xff0c;从讲师到校区经营的成长履历中。见识过众多机构的运营和发展&#xff0c;当然也包含我所在的正厚软件。平时在知乎上看的多&#xff0c;自然推荐的关于机构对比的话题…

蓝牙无线运动耳机排行榜、口碑最好的运动蓝牙耳机推荐

越来越多的人开始喜欢蓝牙耳机的便携性&#xff0c;尤其对于运动的慢跑族&#xff0c;蓝牙耳机更为方便携带和佩戴&#xff0c;毕竟没有了线束的烦恼&#xff0c;目前蓝牙耳机市场很大&#xff0c;用户人群很多&#xff0c;我体验过的这类产品比较多&#xff0c;如何挑选一款满…

MySQL5.7安装配置教程-Windows(企业常用版)超详细

引言 MySQL 5.7 为公司、企业常用的MySQL版本。 正在学习或正在工作的小伙伴推荐相关教程按照5.7的版本来学习、操作。 1. 下载MySQL 阿里云盘不限速高速下载地址&#xff1a; https://www.aliyundrive.com/s/YTMa5LfSFB2 因为阿里云盘不支持zip压缩包的分享&#xff0c;我用…

【财务】FMS财务管理系统---应付结算

本篇文章中&#xff0c;笔者对应付结算各个部分进行了梳理和分析&#xff0c;与大家分享。 前面相继介绍了财务系统的组成、财务数据流转、应收管理、质保金、预付款、费用管理以及合同管理。 我个人觉得应付结算管理部分的逻辑是整个FMS财务管理系统中较为复杂的一部分&#…

APP测试面试题汇总

一、基础篇 1、请介绍一下&#xff0c;APP测试流程&#xff1f; APP测试流程与web测试流程类似&#xff0c;分为如下七个阶段&#xff1a; 1.根据需求说明书编写测试计划&#xff1b; 2.制定测试方案&#xff0c;主要是测试任务、测试人员和测试时间的分配&#xff1b; 3.…