资讯动态

Apache DolphinScheduler 远程日志存储(Remote Logging)配置指南

发布时间:2026/9/23 21:31:36 来源:尧图企业网站定制
任务调度大数据后端前端【免费下载链接】dolphinschedulerApache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code项目地址https://gitcode.com/gh_mirrors/do/dolphinscheduler点击查看免费下载Apache DolphinScheduler 支持将任务日志异步上传到远端对象存储OSS、S3、GCS、ABS并在本地日志缺失时自动从远端下载。本文以docs/docs/zh/guide/remote-logging.md为骨架结合仓库源码与配置文件模板系统讲解远程日志存储的开启方式、四个核心参数、四种对象存储的完整配置项以及背后的异步上传与按需下载实现原理帮助你在集群、伪集群或单机部署下快速落地任务日志的集中化持久存储。远程日志存储的核心工作流程默认情况下DolphinScheduler 的任务日志保存在执行节点Worker的本地文件系统中。开启远程日志存储后日志的生命周期变为两个阶段任务结束后异步上传当某个任务执行完成Worker 会触发RemoteLogUtils.sendRemoteLog(logPath)将对应的任务日志文件异步发送到remote.logging.target指定的远端存储查看/下载时按需拉取用户在 Web 界面查看或下载任务日志时如果本地文件系统没有该日志文件DolphinScheduler 会调用RemoteLogUtils.getRemoteLog(logPath)从远端存储下载对应日志到本地下载前会自动创建本地父目录见 RemoteLogUtils.java。从源码结构看远端存储的读写能力被抽象为统一的RemoteLogHandler接口并由工厂类RemoteLogHandlerFactory根据remote.logging.target动态选择实现dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/log/remote 目录下分别提供了OssRemoteLogHandler.java阿里云 OSSS3RemoteLogHandler.javaAmazon S3GcsRemoteLogHandler.javaGoogle Cloud StorageAbsRemoteLogHandler.javaAzure Blob Storage开启远程日志存储根据部署模式需要配置不同的common.properties文件集群 / 伪集群模式配置api-server/conf/common.properties、master-server/conf/common.properties、worker-server/conf/common.properties三个文件Worker 负责上传日志API Server 负责读取日志Master 与日志读写无关但部署包中同样下发该文件建议保持一致单机standalone模式只需配置standalone-server/conf/common.properties。当前源码仓库中的配置模板位于 dolphinscheduler-common/src/main/resources/common.properties所有remote.logging.*键的定义可在 Constants.java 中查到其中第 650–656 行即四个核心开关参数# 是否开启远程日志存储 remote.logging.enabletrue # 任务日志写入的远端存储目前支持OSS, S3, GCS, ABS remote.logging.targetOSS # 任务日志在远端存储上的目录 remote.logging.base.dirlogs # 设置向远端存储异步发送日志的线程池大小 remote.logging.thread.pool.size10四个参数的说明与取值要点参数默认值作用remote.logging.enablefalse总开关设为true后日志才会写入远端存储remote.logging.targetOSS远端存储类型仅支持OSS、S3、GCS、ABS四种取值remote.logging.base.dirlogs日志在远端存储上的根目录上传时日志文件会被映射到该目录下remote.logging.thread.pool.size10异步发送日志的线程池大小需根据任务并发量适当调整注意remote.logging.enable默认关闭模板中为false开启后请在 common.properties 中按需调整上述参数。异步线程池的源码实现remote.logging.thread.pool.size直接决定异步上传线程池的规格。在 RemoteLogHandleThreadPool.java 中该值同时被用作核心线程数与最大线程数线程名前缀为remote-logging-executor.setCorePoolSize(PropertyUtils.getInt(Constants.REMOTE_LOGGING_THREAD_POOL_SIZE, 10)); executor.setMaxPoolSize(PropertyUtils.getInt(Constants.REMOTE_LOGGING_THREAD_POOL_SIZE, 10)); executor.setThreadNamePrefix(remote-logging-);上传动作由 RemoteLogService.java 通过Async(remoteLogHandleExecutor)注解异步执行并在日志中记录目标存储类型因此不会阻塞任务线程。上传触发的调用链任务执行完成后Worker 侧调用入口位于 WorkerTaskExecutor.java 的RemoteLogUtils.sendRemoteLog(taskExecutionContext.getLogPath())。sendRemoteLog内部先判断开关是否开启再转交RemoteLogService异步发送日志在远端存储上的对象路径由RemoteLogUtils.getObjectNameFromLogPath计算其逻辑是用remote.logging.base.dir作为远端前缀拼上本地日志根目录之后的相对路径见 RemoteLogUtils.java。将任务日志写入阿里云对象存储OSS选择remote.logging.targetOSS时需要在common.properties中补充以下四项配置# oss access key id, required if you set remote.logging.targetOSS remote.logging.oss.access.key.idaccess.key.id # oss access key secret, required if you set remote.logging.targetOSS remote.logging.oss.access.key.secretaccess.key.secret # oss bucket name, required if you set remote.logging.targetOSS remote.logging.oss.bucket.namebucket.name # oss endpoint, required if you set remote.logging.targetOSS remote.logging.oss.endpointendpointremote.logging.oss.access.key.id/remote.logging.oss.access.key.secret阿里云账号的 AccessKey 对需具备对目标 Bucket 的读写权限remote.logging.oss.bucket.name存放任务日志的 OSS Bucket 名称remote.logging.oss.endpointOSS 服务的访问端点形如https://oss-cn-hangzhou.aliyuncs.com参考模板 common.properties 中的资源存储同类型配置注释。对应的上传与下载逻辑由OssRemoteLogHandler实现仓库中可通过dolphinscheduler-common模块的测试资源与配置模板交叉验证字段名。将任务日志写入 Amazon S3选择remote.logging.targetS3时配置如下# s3 access key id, required if you set remote.logging.targetS3 remote.logging.s3.access.key.idaccess.key.id # s3 access key secret, required if you set remote.logging.targetS3 remote.logging.s3.access.key.secretaccess.key.secret # s3 bucket name, required if you set remote.logging.targetS3 remote.logging.s3.bucket.namebucket.name # s3 endpoint, required if you set remote.logging.targetS3 remote.logging.s3.endpointendpoint # s3 region, required if you set remote.logging.targetS3 remote.logging.s3.regionregion与 OSS 相比S3 多了一个必填的remote.logging.s3.regionBucket 所在区域。endpoint字段使该配置同样适用于兼容 S3 协议的其他对象存储如 MinIO 等自建服务S3RemoteLogHandler内部基于该 endpoint 构造客户端。将任务日志写入 Google Cloud StorageGCS选择remote.logging.targetGCS时配置如下# the location of the google cloud credential, required if you set remote.logging.targetGCS remote.logging.google.cloud.storage.credential/path/to/credential # gcs bucket name, required if you set remote.logging.targetGCS remote.logging.google.cloud.storage.bucket.nameyour-bucketGCS 使用服务账号凭证文件进行认证remote.logging.google.cloud.storage.credential指向本地的 Google Cloud 服务账号 JSON 凭证文件路径需要保证运行 DolphinScheduler 的机器对该路径可读remote.logging.google.cloud.storage.bucket.name存放日志的 GCS Bucket 名称。将任务日志写入 Azure Blob StorageABS选择remote.logging.targetABS时配置如下# abs account name, required if you set resource.storage.typeABS remote.logging.abs.account.nameyour-account-name # abs account key, required if you set resource.storage.typeABS remote.logging.abs.account.keyyour-account-key # abs container name, required if you set resource.storage.typeABS remote.logging.abs.container.nameyour-container-nameremote.logging.abs.account.nameAzure 存储账号名称remote.logging.abs.account.key存储账号的访问密钥remote.logging.abs.container.name存储容器Container名称日志会写入该容器下。注意事项由于 Azure Blob Storage 不支持空目录单独存在因此资源目录下会出现空文件no name。但这并不影响 DolphinScheduler 资源中心上的文件展示可以放心使用。结语远程日志存储让 DolphinScheduler 的任务日志不再局限于各 Worker 节点的本地磁盘从而支持日志的集中归档、审计与跨节点检索。启用时只需在common.properties中打开remote.logging.enable、指定remote.logging.target并按对应云厂商补齐认证与 Bucket 配置即可若需加深理解可继续阅读 RemoteLogService.java、RemoteLogUtils.java 以及配置模板 common.properties。赞分享任务调度大数据后端前端【免费下载链接】dolphinschedulerApache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code项目地址https://gitcode.com/gh_mirrors/do/dolphinscheduler点击查看免费下载相关推荐Apache DolphinScheduler 远程日志Remote Logging配置与实现原理详解Apache DolphinScheduler 远程日志Remote Logging配置与实现原理详解 本指南围绕 Apache DolphinSchedu任务调度大数据后端前端Apache DolphinScheduler 远程日志Remote Logging完整配置指南支持 OSS、S3、GCS、ABSApache DolphinScheduler 远程日志Remote Logging完整配置指南支持 OSS、S3、GCS、ABS Apache Dolp任务调度数据编排工作流自动化后端大数据Apache DolphinScheduler 远程日志存储配置指南OSS / S3 / GCS / ABS 全接入Apache DolphinScheduler 远程日志存储配置指南OSS / S3 / GCS / ABS 全接入 Apache DolphinSchedu任务调度数据编排工作流自动化后端大数据创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

读完文章,也想定制专属网站?

尧图设计师 24 小时内与您沟通定制方案

免费获取报价