Checkpoint Storage
Introduction
Checkpoint is a fault-tolerant recovery mechanism. This mechanism ensures that when the program is running, it can recover itself even if it suddenly encounters an exception.
Checkpoint Storage
Checkpoint Storage is a storage mechanism for storing checkpoint data.
SeaTunnel Engine supports the following checkpoint storage types:
- HDFS (OSS,S3,HDFS,LocalFile)
- LocalFile (native), (it’s deprecated: use Hdfs(LocalFile) instead.
We used the microkernel design pattern to separate the checkpoint storage module from the engine. This allows users to implement their own checkpoint storage modules.
checkpoint-storage-api is the checkpoint storage module API, which defines the interface of the checkpoint storage module.
if you want to implement your own checkpoint storage module, you need to implement the CheckpointStorage and provide the corresponding CheckpointStorageFactory implementation.
Checkpoint Storage Configuration
The configuration of the seatunnel-server module is in the seatunnel.yaml file.
seatunnel:engine:checkpoint:storage:type: hdfs #plugin name of checkpoint storage, we support hdfs(S3, local, hdfs), localfile (native local file) is the default, but this plugin is de# plugin configurationplugin-config:namespace: #checkpoint storage parent path, the default value is /seatunnel/checkpoint/K1: V1 # plugin other configurationK2: V2 # plugin other configuration
Notice: namespace must end with “/“.
OSS
Aliyun oss base on hdfs-file, so you can refer hadoop oss docs to config oss.
Except when interacting with oss buckets, the oss client needs the credentials needed to interact with buckets. The client supports multiple authentication mechanisms and can be configured as to which mechanisms to use, and their order of use. Custom implementations of org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider may also be used. if you used AliyunCredentialsProvider (can be obtained from the Aliyun Access Key Management), these consist of an access key, a secret key. you can config like this:
seatunnel:engine:checkpoint:interval: 6000timeout: 7000storage:type: hdfsmax-retained: 3plugin-config:storage.type: ossoss.bucket: your-bucketfs.oss.accessKeyId: your-access-keyfs.oss.accessKeySecret: your-secret-keyfs.oss.endpoint: endpoint addressfs.oss.credentials.provider: org.apache.hadoop.fs.aliyun.oss.AliyunCredentialsProvider
For additional reading on the Hadoop Credential Provider API see: Credential Provider API.
Aliyun oss Credential Provider implements see: Auth Credential Providers
S3
S3 base on hdfs-file, so you can refer hadoop s3 docs to config s3.
Except when interacting with public S3 buckets, the S3A client needs the credentials needed to interact with buckets. The client supports multiple authentication mechanisms and can be configured as to which mechanisms to use, and their order of use. Custom implementations of com.amazonaws.auth.AWSCredentialsProvider may also be used. if you used SimpleAWSCredentialsProvider (can be obtained from the Amazon Security Token Service), these consist of an access key, a secret key. you can config like this:
seatunnel:engine:checkpoint:interval: 6000timeout: 7000storage:type: hdfsmax-retained: 3plugin-config:storage.type: s3s3.bucket: your-bucketfs.s3a.access.key: your-access-keyfs.s3a.secret.key: your-secret-keyfs.s3a.aws.credentials.provider: org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider
if you used InstanceProfileCredentialsProvider, this supports use of instance profile credentials if running in an EC2 VM, you could check iam-roles-for-amazon-ec2.
you can config like this:
seatunnel:engine:checkpoint:interval: 6000timeout: 7000storage:type: hdfsmax-retained: 3plugin-config:storage.type: s3s3.bucket: your-bucketfs.s3a.endpoint: your-endpointfs.s3a.aws.credentials.provider: org.apache.hadoop.fs.s3a.InstanceProfileCredentialsProvider
If you want to use Minio that supports the S3 protocol as checkpoint storage, you should configure it this way:
seatunnel:engine:checkpoint:interval: 10000timeout: 60000storage:type: hdfsmax-retained: 3plugin-config:storage.type: s3fs.s3a.access.key: xxxxxxxxx # Access Key of MinIOfs.s3a.secret.key: xxxxxxxxxxxxxxxxxxxxx # Secret Key of MinIOfs.s3a.endpoint: http://127.0.0.1:9000 # Minio HTTP service access addresss3.bucket: s3a://test # test is the bucket name which storage the checkpoint filefs.s3a.aws.credentials.provider: org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider# important: The user of this key needs to have write permission for the bucket, otherwise an exception of 403 will be returned
For additional reading on the Hadoop Credential Provider API see: Credential Provider API.
HDFS
if you used HDFS, you can config like this:
seatunnel:engine:checkpoint:storage:type: hdfsmax-retained: 3plugin-config:storage.type: hdfsfs.defaultFS: hdfs://localhost:9000// if you used kerberos, you can config like this:kerberosPrincipal: your-kerberos-principalkerberosKeytabFilePath: your-kerberos-keytab// if you need hdfs-site config, you can config like this:hdfs_site_path: /path/to/your/hdfs_site_path
if HDFS is in HA mode , you can config like this:
seatunnel:engine:checkpoint:storage:type: hdfsmax-retained: 3plugin-config:storage.type: hdfsfs.defaultFS: hdfs://usdp-bingseatunnel.hadoop.dfs.nameservices: usdp-bingseatunnel.hadoop.dfs.ha.namenodes.usdp-bing: nn1,nn2seatunnel.hadoop.dfs.namenode.rpc-address.usdp-bing.nn1: usdp-bing-nn1:8020seatunnel.hadoop.dfs.namenode.rpc-address.usdp-bing.nn2: usdp-bing-nn2:8020seatunnel.hadoop.dfs.client.failover.proxy.provider.usdp-bing: org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider
if HDFS has some other configs in hdfs-site.xml or core-site.xml , just set HDFS config by using seatunnel.hadoop. prefix.
LocalFile
seatunnel:engine:checkpoint:interval: 6000timeout: 7000storage:type: hdfsmax-retained: 3plugin-config:storage.type: hdfsfs.defaultFS: file:/// # Ensure that the directory has written permission
Enable cache
When storage:type is hdfs, cache is disabled by default. If you want to enable it, set disable.cache: false
seatunnel:engine:checkpoint:interval: 6000timeout: 7000storage:type: hdfsmax-retained: 3plugin-config:storage.type: hdfsdisable.cache: falsefs.defaultFS: hdfs:///
or
seatunnel:engine:checkpoint:interval: 6000timeout: 7000storage:type: hdfsmax-retained: 3plugin-config:storage.type: hdfsdisable.cache: falsefs.defaultFS: file:///
