Apache Seatunnel常用运维命令

📅 发布时间:2026/9/3 6:42:48
Apache Seatunnel常用运维命令 Apache Seatunnel常用运维命令--为每个作业单独配置日志文件(重启其中一个job后生效) $SEATUNNEL_HOME/config/log4j2.properties rootLogger.appenderRef.file.ref fileAppender appender.file.layout.pattern [%X{ST-JID}] %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%-30.30c{1.}] [%t] - %m%n 修改为 rootLogger.appenderRef.file.ref routingAppender appender.file.layout.pattern %d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%-30.30c{1.}] [%t] - %m%n --SeaTunnel 支持定时删除旧日志文件以避免磁盘空间不足 可以在 $SEATUNNEL_HOME/config/seatunnel.yaml 配置文件中添加以下配置 默认配置项如下(时间按分钟计算比如1440为1440分钟) history-job-expire-minutes: 设置历史作业和日志的保留时间单位分钟。系统将在指定的时间后自动清除过期的作业信息和日志文件。 scheduled-deletion-enable: 启用定时清理功能默认为 true。系统将在作业达到 history-job-expire-minutes 设置的过期时间后自动删除相关日志文件。关闭该功能后日志将永久保留在磁盘上需要用户自行管理否则可能影响磁盘占用。建议根据需求合理配置。 --正常停止 /data/apache-seatunnel-2.3.12/bin/seatunnel.sh -s JOB_ID --查看集群名称 /data/apache-seatunnel-2.3.12/bin/seatunnel-cluster.sh -m --cluster seatunnel # /data/apache-seatunnel-2.3.12/bin/seatunnel-cluster.sh -m --cluster seatunnel start master_and_worker node Member ID Address Role Version b987bf06-e3c1-4e92-9522-c1d685264412 [localhost]:5801 ACTIVE MASTER 5.1.0 --cluster方式启动任务 nohup /data/apache-seatunnel-2.3.12/bin/seatunnel.sh \ --config /data/apache-seatunnel-2.3.12/config/demo_2tables_mysql.conf \ -m cluster \ -cn seatunnel \ /data/apache-seatunnel-2.3.12/logs/demo_2tables_mysql_cluster.out 21 --启动的时候指定名称 nohup /data/apache-seatunnel-2.3.12/bin/seatunnel.sh \ --config /data/apache-seatunnel-2.3.12/config/demo_2tables_mysql.conf \ -m cluster \ -cn seatunnel \ -n MySQL_CDC_2Tables \ /data/apache-seatunnel-2.3.12/logs/MySQL_CDC_2Tables.out 21 echo $! /data/apache-seatunnel-2.3.12/logs/MySQL_CDC_2Tables.pid tail -100f /data/apache-seatunnel-2.3.12/logs/MySQL_CDC_2Tables.out --查看checkpoint ls -lah \ /tmp/seatunnel/checkpoint_snapshot/1146660564110409729/ --获取JOB /data/apache-seatunnel-2.3.12/bin/seatunnel.sh \ -l \ -cn seatunnel --查询指定JOB /data/apache-seatunnel-2.3.12/bin/seatunnel.sh \ -j 1146724631827185665 \ -cn seatunnel --can 取消JOB这种方式停止任务不会保存checkpoing下次启动的时候相当于重新启动一个新的任务 /data/apache-seatunnel-2.3.12/bin/seatunnel.sh \ -can 1146724631827185665 \ -cn seatunnel --查看checkpoint配置的保存路径 grep -nEi checkpoint|state|storage|repository|backup \ /data/apache-seatunnel-2.3.12/config/seatunnel.yaml sed -n 1,80p /data/apache-seatunnel-2.3.12/config/seatunnel.yaml --如果任务因为故障需要从 Checkpoint 恢复应该使用如下命令 /data/apache-seatunnel-2.3.12/bin/seatunnel.sh \ -r \ -j JOB_ID \ -cn seatunnel --创建一个保存 savepoint /data/apache-seatunnel-2.3.12/bin/seatunnel.sh \ -s 1146757990657818625 \ -cn seatunnel --查看JOB状态 /data/apache-seatunnel-2.3.12/bin/seatunnel.sh -l -cn seatunnel --此时查看任务状态(SAVEPOINT_DONE)对于canceld的任务无法根据checkpoing启动 2026-08-31 19:00:44,217 INFO [.c.i.s.ClientStatisticsService] [main] - Client statistics is enabled with period 5 seconds. Job ID Job Name Job Status Submit Time Start Time Finished Time ------------------- ------------- -------------- ----------------------- ----------------------- ----------------------- 1146757990657818625 SeaTunnel_Job SAVEPOINT_DONE 2026-08-31 18:58:47.125 2026-08-31 18:58:47.222 2026-08-31 19:00:33.152 1146724631827185665 SeaTunnel_Job CANCELED 2026-08-31 16:34:19.68 2026-08-31 16:34:20.312 2026-08-31 16:46:17.122 --检查 Savepoint 是否生成 # find /tmp/seatunnel/checkpoint_snapshot -maxdepth 5 -type d | sort /tmp/seatunnel/checkpoint_snapshot /tmp/seatunnel/checkpoint_snapshot/1146475622235635713 /tmp/seatunnel/checkpoint_snapshot/1146612755894108161 /tmp/seatunnel/checkpoint_snapshot/1146613849521127425 /tmp/seatunnel/checkpoint_snapshot/1146649653467414529 /tmp/seatunnel/checkpoint_snapshot/1146656341016707073 /tmp/seatunnel/checkpoint_snapshot/1146660564110409729 /tmp/seatunnel/checkpoint_snapshot/1146757990657818625 --然后从 Savepoint 恢复 --方案 ASavepoint 恢复 /data/apache-seatunnel-2.3.12/bin/seatunnel.sh \ -c /data/apache-seatunnel-2.3.12/config/demo_2tables_mysql.conf \ -r 1146757990657818625 \ -cn seatunnel \ -n MySQL_CDC_2Tables \ /data/apache-seatunnel-2.3.12/logs/demo_2tables_mysql_cluster.out 21 echo $! /data/apache-seatunnel-2.3.12/logs/MySQL_CDC_2Tables.pid tail -100f /data/apache-seatunnel-2.3.12/logs/demo_2tables_mysql_cluster.out --看最新 Checkpoint 时间 find /tmp/seatunnel/checkpoint_snapshot/1146757990657818625 \ -type f \ -name *.ser \ -printf %TY-%Tm-%Td %TH:%TM:%TS %p\n \ | sort --找一下 Savepoint/恢复相关日志 grep -RniE \ checkpoint|savepoint|restore|snapshot|binlog|startup.mode \ /data/apache-seatunnel-2.3.12/logs/ \ | tail -100