Dinky1.2.3基于Kubernetes Application模式提交Flink作业

前言

Dinky 是一个开箱即用、易扩展,以 Apache Flink 为基础,连接 OLAP 和数据湖等众多框架的一站式实时计算平台,致力于流批一体和湖仓一体的探索与实践。 致力于简化Flink任务开发,提升Flink任务运维能力,降低Flink入门成本,提供一站式的Flink任务开发、运维、监控、报警、调度、数据管理等功能。

今天想给大家说一说,如何通过dinky数据开发平台,将Flink作业采用k8s appliction模式提交到flink集群中。

前置条件

  • 需要安装Dinky1.2.3环境
  • Flink1.20镜像包
  • K8S集群环境

步骤1.构建Flink1.20镜像包

编写Dockerfile文件

FROM flink:1.20.0-scala_2.12-java11# 设置时区(可选)
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone# 设置工作目录
WORKDIR /opt/flink# 添加自定义配置文件(可选)
# dinky提交作业时并未生效,将会被dinky集群中的flink配置替换
COPY conf/config.yaml ./conf/# 添加自定义jar包(可选)
COPY lib/*.jar ./lib/# 兼容dinky替换jar包
RUN rm -rf ./lib/flink-table-planner-loader-*.jar
RUN mv ./opt/flink-table-planner_2.12-*.jar ./lib/# 添加用户自定义代码(可选)
COPY plugins/ ./plugins/# 设置环境变量
ENV FLINK_HOME=/opt/flink
ENV PATH=$FLINK_HOME/bin:$PATH# 暴露必要的端口
# 8081 - Web UI
# 6123 - TaskManager RPC
EXPOSE 8081 6123# 设置容器启动命令(根据需要修改)
CMD ["bash"]

原始目录结构,lib目录包含了所需jar包,plugins包含插件jia包,conf包含flink配置文件,其中lib中的依赖包,包含了mysql,sqlserver,mongodb,kafka,paimon的依赖,请大家根据实际情况添加依赖包。

依赖jar包下载地址:仓库服务

编译构建完后的镜像完整路径(后续注册集群配置需要用上)

192.168.1.101:5000/bigdata/flink120:latest

步骤2.Kubernetes创建serviceacount

创建命名空间和serviceacount(后续注册集群配置需要用上)

# 创建命名空间和serviceacount
# 创建namespace
kubectl create ns bigdata# 创建serviceaccount
kubectl create serviceaccount flink-service-account -n bigdata
# 用户授权
kubectl create clusterrolebinding flink-role-binding-flink --clusterrole=edit --serviceaccount=bigdata:flink-service-account# 查看
kubectl get pods pods,svc,sa -n bigdata

步骤3.Dinky1.2.3注册集群配置

注册k8s appliction集群配置

################################################################################
#  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.
################################################################################# These parameters are required for Java 17 support.
# They can be safely removed when using Java 8/11.
env:java:opts:all: --add-exports=java.base/sun.net.util=ALL-UNNAMED --add-exports=java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED#==============================================================================
# Common
#==============================================================================jobmanager:# The host interface the JobManager will bind to. By default, this is localhost, and will prevent# the JobManager from communicating outside the machine/container it is running on.# On YARN this setting will be ignored if it is set to 'localhost', defaulting to 0.0.0.0.# On Kubernetes this setting will be ignored, defaulting to 0.0.0.0.## To enable this, set the bind-host address to one that has access to an outside facing network# interface, such as 0.0.0.0.bind-host: localhostrpc:# 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# automatically configure the host name based on the hostname of the node where the# JobManager runs.address: localhost# The RPC port where the JobManager is reachable.port: 6123memory:process:# 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.size: 1600mexecution:# 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.failover-strategy: regiontaskmanager:# The host interface the TaskManager will bind to. By default, this is localhost, and will prevent# the TaskManager from communicating outside the machine/container it is running on.# On YARN this setting will be ignored if it is set to 'localhost', defaulting to 0.0.0.0.# On Kubernetes this setting will be ignored, defaulting to 0.0.0.0.## To enable this, set the bind-host address to one that has access to an outside facing network# interface, such as 0.0.0.0.bind-host: localhost# The address of the host on which the TaskManager runs and can be reached by the JobManager and# other TaskManagers. If not specified, the TaskManager will try different strategies to identify# the address.## Note this address needs to be reachable by the JobManager and forward traffic to one of# the interfaces the TaskManager is bound to (see 'taskmanager.bind-host').## Note also that unless all TaskManagers are running on the same machine, this address needs to be# configured separately for each TaskManager.host: localhost# The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.numberOfTaskSlots: 1memory:process:# 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.# 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.size: 1728mparallelism:# The parallelism used for programs that did not specify and other 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: hdfs://mynamenode:12345#==============================================================================
# High Availability
#==============================================================================# high-availability:
#   # The high-availability mode. Possible options are 'NONE' or 'zookeeper'.
#   type: 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, ...)
#   storageDir: hdfs:///flink/ha/
#   zookeeper:
#     # 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)
#     quorum: localhost:2181
#     client:
#       # 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
#       acl: open#==============================================================================
# Fault tolerance and checkpointing
#==============================================================================# The backend that will be used to store operator state checkpoints if
# checkpointing is enabled. Checkpointing is enabled when execution.checkpointing.interval > 0.# # Execution checkpointing related parameters. Please refer to CheckpointConfig and CheckpointingOptions for more details.
# execution:
#   checkpointing:
#     interval: 3min
#     externalized-checkpoint-retention: [DELETE_ON_CANCELLATION, RETAIN_ON_CANCELLATION]
#     max-concurrent-checkpoints: 1
#     min-pause: 0
#     mode: [EXACTLY_ONCE, AT_LEAST_ONCE]
#     timeout: 10min
#     tolerable-failed-checkpoints: 0
#     unaligned: false# state:
#   backend:
#     # Supported backends are 'hashmap', 'rocksdb', or the
#     # <class-name-of-factory>.
#     type: hashmap
#     # Flag to enable/disable incremental checkpoints for backends that
#     # support incremental checkpoints (like the RocksDB state backend).
#     incremental: false
#   checkpoints:
#       # Directory for checkpoints filesystem, when using any of the default bundled
#       # state backends.
#       dir: hdfs://namenode-host:port/flink-checkpoints
#   savepoints:
#       # Default target directory for savepoints, optional.
#       dir: hdfs://namenode-host:port/flink-savepoints#==============================================================================
# Rest & web frontend
#==============================================================================rest:# The address to which the REST client will connect toaddress: localhost# The address that the REST & web server binds to# By default, this is localhost, which prevents the REST & web server from# being able to communicate outside of the machine/container it is running on.## To enable this, set the bind address to one that has access to outside-facing# network interface, such as 0.0.0.0.bind-address: localhost# # 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.# port: 8081# # Port range for the REST and web server to bind to.# bind-port: 8080-8090# web:
#   submit:
#     # Flag to specify whether job submission is enabled from the web-based
#     # runtime monitor. Uncomment to disable.
#     enable: false
#   cancel:
#     # Flag to specify whether job cancellation is enabled from the web-based
#     # runtime monitor. Uncomment to disable.
#     enable: false#==============================================================================
# Advanced
#==============================================================================# io:
#   tmp:
#     # 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, 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.
#     dirs: /tmp# classloader:
#   resolve:
#     # 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.
#     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
#       min: 64mb
#       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
#       keytab: /path/to/kerberos/keytab
#       principal: flink-user
#       # The configuration below defines which JAAS login contexts
#       contexts: Client,KafkaClient#==============================================================================
# ZK Security Configuration
#==============================================================================# zookeeper:
#   sasl:
#     # 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"
#     login-context-name: Client#==============================================================================
# HistoryServer
#==============================================================================# The HistoryServer is started and stopped via bin/historyserver.sh (start|stop)
#
# jobmanager:
#   archive:
#     fs:
#       # Directory to upload completed jobs to. Add this directory to the list of
#       # monitored directories of the HistoryServer as well (see below).
#       dir: hdfs:///completed-jobs/# historyserver:
#   web:
#     # The address under which the web-based HistoryServer listens.
#     address: 0.0.0.0
#     # The port under which the web-based HistoryServer listens.
#     port: 8082
#   archive:
#     fs:
#       # Comma separated list of directories to monitor for completed jobs.
#       dir: hdfs:///completed-jobs/
#       # Interval in milliseconds for refreshing the monitored directories.
#       fs.refresh-interval: 10000# # s3密钥配置
s3.endpoint: http://192.168.1.102:9000
s3.access-key: xxxxxxxx
s3.secret-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  1. 类型:Kubernetes Application
  2. 集群配置名称:k8s-appliction-test(自定义)
  3. 暴露端口类型:NodePort
  4. Kubernetes 命名空间:bigdata (步骤2中创建的命名空间)
  5. K8s 提交账号:flink-service-account (步骤2中创建的serviceaccount)
  6. K8s KubeConfig:从k8s服务器中的将文件~/.kube/config内容拷贝过来
  7. Flink 镜像地址:192.168.1.101:5000/bigdata/flink120:latest (步骤1构建的私有镜像包)
  8. JobManager CPU 配置:1(根据实际需要配置)
  9. TaskManager CPU 配置:1(根据实际需要配置)
  10. Flink 配置文件路径:/usr/local/flink-1.20.0/conf (将flink配置拷贝到dinky服务器中)
  11. JobManager 内存:1G(根据实际需要配置)
  12. TaskManager 内存:1G(根据实际需要配置)
  13. 插槽数:1(根据实际需要配置)
  14. 保存点路径:s3://flink120/flink-savepoints(统一使用s3作为分布式存储,所以上文中的flink配置新增了s3存储密钥配置)
  15. 检查点路径:s3://flink120/flink-checkpoints
  16. Jar 文件路径:s3://flink120/dinky/dinky-app-1.20-1.2.3-jar-with-dependencies.jar

创建作业ods-mysql-to-doris,选择flink集群为k8s-appliction-test

Flink作业运行情况

k8s中自动生成部署Deployments以及pod实例

总结

  1. 构建私有flink镜像包时,将配置文件拷贝到镜像中,但是dinky提交作业时并未生效,将会被dinky集群中的flink配置替换,实际使用的配置为/usr/local/flink-1.20.0/conf
  2. flink作业通过k8s appliction模式提交作业,可以抛弃yarn appliction模式,毕竟hadoop框架太重,通过s3(minio/oss)替换了hdfs分布式存储,通过k8s的资源调度替带了yarn资源调度

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

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

相关文章

【软考高级架构设计师】——2025年上半年软考真题(回忆版)

目录 一、综合知识1.1、计算机基础与操作系统(15道单选)1.2、软件工程与架构(16道单选)1.3、数据与网络(8道单选)1.4、数学与逻辑(4道单选)1.5、其他(27道单选)1.6、英文题(质量属性)(5道单选)二、案例分析2.1、大模型训练系统(必选题)2.2、医院知识图谱(可选…

哈夫曼树Python实现

哈夫曼树构建原则&#xff1a; .统计频率&#xff1a;对待编码字符&#xff08;或数据块&#xff09;的频率进行统计。.初始化森林&#xff1a;将每个字符视为一棵只有根节点的二叉树&#xff0c;权值为频率。.合并树&#xff1a;重复以下操作&#xff0c;直到只剩一棵树&…

Dockerfile的学习与实践

Dockerfile通过一系列的命令和参数&#xff0c;构建自定义镜像。一般步骤如下&#xff1a; 一. 常用命令说明 基础命令具体命令描述例子FROMFROM[基础镜像:版本号]基于指定的基础镜像构建自定义镜像FROM eclipse-temurin:17-jdk-alpineRUNRUN构建容器需要运行的命令&#xff0…

【三大前端语言之一】静态网页语言:HTML详解

你知道你在浏览器中所看到的每一个按钮&#xff0c;每一个框&#xff0c;都是怎么创造出来的吗&#xff1f;它们并非魔法&#xff0c;而是由一种被称为HTML的语言精心构建的骨架。作为前端世界的三大基石之一&#xff08;HTML、CSS、JavaScript&#xff09;&#xff0c;HTML是万…

04、谁发明了深度学习的方法,是怎么发明的?

深度学习的发展是多位研究者长期探索的结果,其核心方法的形成并非由单一人物 “发明”,而是历经数十年理论积累与技术突破的产物。以下从关键人物、核心技术突破及历史背景三个维度,梳理深度学习方法的起源与发展脉络: 一、深度学习的奠基者与关键贡献者 1. Geoffrey Hin…

Jmeter ServerAgent在arm环境启动报错no libsigar-aarch64-linux.so in java.library.path

使用Jmeter压测的时候&#xff0c;用ServerAgent监测arm服务器的性能指标&#xff0c;在启动ServerAgent时&#xff0c;报错了&#xff1a;no libsigar-aarch64-linux.so in java.library.path 解决方案&#xff1a; 下载libsigar-aarch64-linux.so文件&#xff0c;放置在Serv…

AJAX拦截器失效排查指南:当你的beforeSend有效但error/complete沉默时

问题现象 开发者常遇到这样的场景&#xff1a; $.ajaxSetup({beforeSend: () > console.log("✅ 触发"), // 正常执行error: () > console.log("❌ 未触发"), // 静默失效complete: () > console.log("⚡ 未触发") // 同样沉默 })…

【模型微调】负样本选择

1.核心设计理念 非对称检索任务&#xff08;例如&#xff0c;用一个简短的问题去文档库里查找答案&#xff09;的一个核心挑战是查询&#xff08;query&#xff09;和文档&#xff08;passage&#xff09;在文本特征上的巨大差异。以往的研究发现&#xff0c;为查询和文档提供…

下载安装redis

有任何问题&#xff0c;都可以私信博主&#xff0c;共同探讨学习。 正文开始 一、下载安装redis一、启动redis总结 一、下载安装redis redis官方下载地址是github&#xff0c;有条件的同学可以自行搜索下载。针对部分网速不太好的同学&#xff0c;可以通过网盘获取&#xff0c…

flutter 项目配置Gradle下载代理

如图&#xff0c; 在Android Studio中配置代理是不生效的。 需要在flutter sdk的Gradle中去配置代理

世冠科技亮相TMC,以国产MBD工具链赋能汽车电控系统开发新未来

2025年6月12日至13日&#xff0c;第十七届国际汽车动力系统技术年会&#xff08;TMC2025&#xff09;在南通国际会展中心盛大召开。作为全球汽车动力系统领域规模最大、规格最高、内容最前沿的标杆性国际盛会&#xff0c;汇聚了来自全球整车企业、核心零部件供应商、顶尖科研机…

将本地项目与远程 Git 仓库关联的完整步骤

将本地项目与远程 Git 仓库关联的完整步骤 现在的情景是&#xff1a;本地文件项目已经写好了&#xff0c;亦或者远程仓库已经建好了&#xff0c;需要与本地项目关联起来 以下是详细的操作流程&#xff0c;我会用清晰的步骤说明如何将你的本地项目与远程 Git 仓库关联&#xf…

3DS 转换为 STP 全攻略:迪威模型网在线转换详解

在三维模型创作与应用的多元场景中&#xff0c;不同格式的文件承担着独特的角色。3DS&#xff08;3D Studio&#xff09;格式是 Autodesk 3ds Max 早期广泛使用的文件格式&#xff0c;常用于游戏开发、影视特效制作等领域&#xff0c;能够存储模型的几何形状、材质、动画等信息…

Linux下iptables和firewalld详解

Linux下iptables和firewalld详解 Linux下iptables和firewalld简述Iptables四表五链策略与规则链命令参数Firewalld终端管理工具图形管理工具服务的访问控制列表Linux下iptables和firewalld 简述 ​ 保障数据的安全性是继保障数据的可用性之后最为重要的一项工作。防火墙作为公…

Kafka Connect高级开发:自定义扩展与复杂场景应对

引言 在掌握Kafka Connect基础操作与内置连接器应用后&#xff0c;面对企业复杂的业务需求&#xff0c;如对接非标准数据源、实现特定数据处理逻辑&#xff0c;就需要深入到高级开发领域。本篇博客将围绕自定义Connector开发、数据转换编程、错误处理与容错机制展开&#xff0…

吴恩达机器学习笔记:正则化2

1.正则化线性回归 对于线性回归的求解&#xff0c;我们之前推导了两种学习算法&#xff1a;一种基于梯度下降&#xff0c;一种基于正规方程。 正则化线性回归的代价函数为&#xff1a; J ( θ ) 1 2 m [ ∑ i 1 m ( h θ ( x ( i ) ) − y ( i ) ) 2 λ ∑ j 1 n θ j 2 …

Unity中的Resources加载

Unity的Resources加载是Unity引擎中一种在运行时动态加载资源&#xff08;assets&#xff09;的方式&#xff0c;允许开发者将资源放置在特定的Resources文件夹中&#xff0c;并通过代码按名称加载这些资源&#xff0c;而无需在场景中预先引用。这种方式在需要动态加载资源时非…

对Vue2响应式原理的理解-总结

根据这张图进行总结 在组件实例初始化阶段&#xff0c;通过 observe() 方法对 data 对象进行递归遍历。在这个过程中&#xff0c;Vue 使用 Object.defineProperty() 为data 中的每个属性定义 getter 和 setter 来拦截对象属性的“读取“操作和“写入”操作。 Vue 的依赖追踪是…

基于深度学习的智能音频增强系统:技术与实践

前言 在音频处理领域&#xff0c;音频增强技术一直是研究的热点。音频增强的目标是改善音频信号的质量&#xff0c;去除噪声、回声等干扰&#xff0c;提高音频的可听性和可用性。传统的音频增强方法主要依赖于信号处理技术&#xff0c;如滤波器设计、频谱减法等&#xff0c;但这…

从代码学习深度强化学习 - DQN PyTorch版

文章目录 前言DQN 算法核心思想Q-Learning 与函数近似经验回放 (Experience Replay)目标网络 (Target Network)PyTorch 代码实现详解1. 环境与辅助函数2. 经验回放池 (ReplayBuffer)3. Q网络 (Qnet)4. DQN 主类5. 训练循环6. 设置超参数与开始训练训练结果与分析总结前言 欢迎…