Configuring a checkpoint data store for Teracloud® Streams domains and instances
Use this procedure to configure a checkpoint data store for Teracloud® Streams domains and instances.
Checkpointing is the process of persisting operator state at run time to allow recovery from a failure. Operators use the Checkpointing API to serialize and store its state data to the checkpoint data store that you configure. If a failure occurs, operators will reset to a checkpointed state.
By default, no checkpoint data store is configured for domains and instances. You can use the data store that is included with Teracloud® Streams or another supported data store, such as Redis and IBM Cloud Object Storage.
You can also specify a Redis password to ensure a secure configuration.
About this task
For each domain or instance, you choose the type and location of the data store that the Checkpointing API writes to. Any changes to the configuration do not take effect until the domain or instance is stopped and restarted. The domain property setting is automatically inherited by all the instances in that domain unless the instance property is set.
- Any instance that runs applications that use checkpointing or consistent region features is required to specify a checkpoint data store by setting the instance.checkpointRepository and instance.checkpointRepositoryConfiguration properties. Typically, operators in a consistent region require checkpointing.
- A checkpoint data store is also required for applications that have operators with the
config checkpoint
clause.
- domain.checkpointRepository
- If the
instance.checkpointRepository property is
not configured for an instance, this domain property specifies the
default repository that Teracloud®
Streams uses to store application checkpoint data for the instance.
This property can have the following values:
- notSpecified
- Default value. Indicates that no checkpoint data store is provided for the domain.
- fileSystem
- Indicates that the checkpoint data for the domain and its instances is stored in a file system directory.
- redis
- Indicates that the checkpoint data for the domain and its instances is stored in a Redis checkpoint data store.
- ibmCloudObjectStorage
- Indicates that the checkpoint data for the domain and its instances is stored in a IBM Cloud Object Storage checkpoint data store.
Before you run applications that call the Checkpointing API, you must configure your domain or instance to specify either fileSystem, redis or ibmCloudObjectStorage.Note: If the domain.checkpointRepository and instance.checkpointRepository properties are both set to notSpecified, the instances in the domain do not allow submitting a job that requires checkpointing. - domain.checkpointRepositoryConfiguration
- If configuration information is not specified for an
instance, this domain property specifies the default configuration
information for the repository that Teracloud®
Streams uses to store application checkpoint data for the instance. If
the domain.checkpointRepository property is set
to the default value of notSpecified, the
domain.checkpointRepositoryConfiguration
property is ignored.
This property contains a string with the following configuration information:
- For fileSystem, the string contains the absolute path to an existing directory, which is the root checkpointing directory.
- For redis, the string contains a list of redis server host names and port numbers.
- For ibmCloudObjectStorage, the string contains a JSON payload with Cloud Object Storage (COS) service credentials that include endpoint, bucket name, and configuration entry name that contains keys.
- instance.checkpointRepository
- This instance property specifies the repository that
Teracloud®
Streams uses to store application checkpoint information.
This property can have the following values:
- notSpecified
- Default value. Indicates that no checkpoint data store is provided for the instance.
- fileSystem
- Indicates that the checkpoint data for the instance is stored in a file system directory.
- redis
- Indicates that the checkpoint data for the instance is stored in a Redis checkpoint data store.
- ibmCloudObjectStorage
- Indicates that the checkpoint data for the instance is stored in a IBM Cloud Object Storage checkpoint data store.
Before you run applications that call the Checkpointing API, you must configure your domain or instance to specify either fileSystem, redis or ibmCloudObjectStorage.Notes:- If you do not set the instance.checkpointRepository property, the value of the domain.checkpointRepository property is used for the instance.
- If the instance.checkpointRepository and domain.checkpointRepository properties are both set to notSpecified, the instance does not allow submitting a job that requires checkpointing.
- instance.checkpointRepositoryConfiguration
- This instance property specifies the configuration
information for the repository that Teracloud®
Streams uses to store application checkpoint data for the instance. If
the instance.checkpointRepository property is
set to the default value of notSpecified, the
instance.checkpointRepositoryConfiguration
property is ignored.
This property contains a string with the following configuration information:
- For fileSystem, the string contains the absolute path to an existing directory, which is the root checkpointing directory.
- For redis, the string contains a list of redis server host names and port numbers.
- For ibmCloudObjectStorage, the string contains a JSON payload with Cloud Object Storage (COS) service credentials that include endpoint, bucket name, and configuration entry name that contains keys.
streamtool man domainproperties
and streamtool man
properties
commands.Procedure
- fileSystem
This value specifies that Teracloud® Streams saves checkpoint data in a file system directory.
For fileSystem, the domain.checkpointRepositoryConfiguration or instance.checkpointRepositoryConfiguration properties specify an absolute path to an existing directory, which is the root checkpointing directory. If the instance needs to run jobs with restartable and relocatable operators, then place the checkpointing directory in a shared file system.
The value of checkpointRepositoryConfiguration is in a JSON format.
instance.checkpointRepositoryConfiguration = " { \"Dir\" : path } "
path
is the absolute path to an existing directory.The following example sets the checkpoint store in the user's home directory.
instance.checkpointRepositoryConfiguration=" { \"Dir\" : \"/home/user/ckpt\" } "
You can set domain and instance properties by using the
streamtool setdomainproperty
andstreamtool setproperty
commands. Use thestreamtool getdomainproperty
andstreamtool getproperty
commands to display property values. - redis
This value specifies that Teracloud® Streams uses a Redis checkpoint data store.
Redis is an open source key-value data store. To use this store for checkpointing, you need to set up your Redis servers and provide their location to Teracloud® Streams with host names and ports in the checkpointRepositoryConfiguration string. Multiple Redis servers can be configured and checkpoint data is distributed among the servers through sharding and replication.
The value of checkpointRepositoryConfiguration is in a JSON format.
For redis, operators' checkpoint data are stored on one or multiple Redis servers through sharding and replication. The Redis servers are organized as K shards and N replica groups (K x N servers in total). Checkpoint data is distributed among the K shards, and each checkpoint data is replicated on N Redis servers. The number of shards (K) determines the capacity of the backend store. The number of replicas (N) determines the reliability of backend store. Provisioning 2n+1 replica groups can tolerate n server failures. The following example contains the JSON format for specifying the information of Redis servers.{ "replicas" : N, "shards" : K, "replicaGroups" : [replicaGroup1, replicaGroup2, ..., replicaGroupN] }
The value of "shards
" (K) specifies number of shards and it must be a positive integer value. The value of "replicas
" (N) specifies number of replica groups and it must be an odd integer value (for example, 3). The "replicaGroups
" is an array of N JSON objects. Each JSON object in thereplicaGroups
array corresponds to a replica group and is specified as shown in the following example:{ "servers" : [HostAndPortOfServer1, HostAndPortOfServer2, ..., HostAndPortOfServerK], "description" : StringOfOptionalDescription }
The value of "
servers
" is a JSON array that contains K "host:port
" for the K Redis servers in the replica group.host
can be host name or IP address andport
is the port number that is used by the Redis server. The "description
" is optional.As an example, the setup for 24 Redis servers with 8 shards and 3 replicas has the following configuration value.instance.checkpointRepositoryConfiguration=" { \"replicas\" : 3, \"shards\" : 8, \"replicaGroups\" : [ { \"servers\" : [\"host0:port0\", \"host1:port1\", \"host2:port2\", \"host3:port3\", \"host4:port4\", \"host5:port5\",\"host6:port6\", \"host7:port7\"], \"description\" : \"rack1\" }, { \"servers\" : [\"host8:port8\", \"host9:port9\", \"host10:port10\", \"host11:port11\", \"host12:port12\",\"host13:port13\", \"host14:port14\", \"host15:port15\"], \"description\" : \"rack2\" }, { \"servers\" : [\"host16:port16\", \"host17:port17\", \"host18:port18\", \"host19:port19\", \"host20:port20\",\"host21:port21\", \"host22:port22\", \"host23:port23\"], \"description\" : \"rack3\" } ] }"
- redis for a secure platform configuration
You can configure Teracloud® Streams to use Redis servers which have authentication enabled as a checkpoint data store. You can specify a Redis password as part of the domain or instance checkpointRepositoryConfiguration property, store this password, and pass it to SPL runtime in a secure way:
- Use the
streamtool setproperty
command to set the checkpointRepository string to Redis:streamtool setproperty -d $STREAMS_DOMAIN_ID -i $STREAMS_INSTANCE_ID checkpointRepository=redis
- Use the
streamtool setrestrictedconfig
command to store Redis passwords. If there are six Redis servers, for example, and every two of them share the same password, you can choose which property name you want to use to store the passwords, such as:streamtool setrestrictedconfig -d $STREAMS_DOMAIN_ID -i $STREAMS_INSTANCE_ID redisPassword1=passwdOne streamtool setrestrictedconfig -d $STREAMS_DOMAIN_ID -i $STREAMS_INSTANCE_ID redisPassword2=passwdTwo streamtool setrestrictedconfig -d $STREAMS_DOMAIN_ID -i $STREAMS_INSTANCE_ID redisPassword3=passwdThree
- Use the
streamtool setproperty
command to specify the normal checkpointRepositoryConfiguration property with the host, port, and password of the Redis servers:streamtool setproperty -d $STREAMS_DOMAIN_ID -i $STREAMS_INSTANCE_ID checkpointRepositoryConfiguration =" { \"shards\":2, \"replicas\":3,\ \"replicaGroups\":[\ {\"servers\":[\"host1:6379:redisPassword1\",\"host2:6379:redisPassword1\", \"host3:6379:redisPassword2\"]},\ {\"servers\":[\"host4:6379:redisPassword2\",\"host5:6379:redisPassword3\", \"host6:6379:redisPassword3\"]} \ ] \ } "
- Use the
- redis for a secure platform configuration
- ibmCloudObjectStorage
This value specifies that Teracloud® Streams uses an IBM Cloud Object Storage checkpoint data store.
Cloud Object Storage is a highly scalable cloud storage service, designed for high durability, resiliency and security. To use this data store for checkpointing, you must set up your Cloud Object Storage service in IBM Cloud
After you create the service, you must provide service credentials to Teracloud® Streams. These service credentials include endpoint, bucket name, and configuration entry name that contains service keys, as part of the string for checkpointRepositoryConfiguration in JSON format. You can find the service credentials on the Cloud Object Storage service dashboard in IBM Cloud.
For ibmCloudObjectStorage, operators' checkpoint data are stored on one or multiple Cloud Object Storage service buckets. Each operator puts objects with keys named in the form of domainID-instanceID-jobID-operatorGlobalIndex under a single bucket in the configured endpoint. The following example contains the JSON format for specifying the information of the Cloud Object Storage endpoint, bucket, and configuration entry containing the service keys:{ "endpoint" : url, "bucket" : name, "auth" : name }
The value of "
endpoint
" is a string that specifies the URL of a private or public Cloud Object Storage S3 endpoint. The value of "bucket
" is a string that specifies the name of the container to store checkpoint objects. The bucket parameter is optional. If not specified,streams-checkpoint
is used as bucket name. If the bucket does not exist, a new bucket namedstreams-checkpoint
is created. The value of "auth
" is a string that specifies the configuration entry name that contains all key-related information. Objects in Cloud Object Storage are encrypted at rest. This technology individually encrypts each object using per-object generated keys.The following example contains sample values for the JSON format you need to specify to use ibmCloudObjectStorage as the checkpoint data store.{ "endpoint" : "s3-api.us-geo.objectstorage.service.networklayer.com", "bucket" : "streams-checkpoint", "auth" : "apiKey" }