Disaster Recovery for Confluent Manager for Apache Flink
This section describes how to protect the Apache Flink® workloads that Confluent Manager for Apache Flink (CMF) manages against the loss of a Kubernetes cluster, and how to recover them.
Disaster recovery with CMF has two parts:
Back up CMF metadata. The CMF database holds every environment, compute pool, application, statement, and savepoint, and nothing can be recovered without it.
Recover workloads. When the Kubernetes cluster that runs your Flink workloads is lost and the CMF database survives, you start CMF against a replacement cluster, and CMF recreates the Kubernetes resources of your applications, compute pools, and statements from its database.
Important
Starting with CMF 2.5.0, CMF can recover Flink SQL statements, and the session clusters of shared compute pools, after the loss of their Kubernetes cluster. It can recover a statement only if it stored a copy of the statement’s compiled plan before the disaster, which requires artifact management. Artifact management is off by default. See Prepare for Disaster Recovery in Confluent Manager for Apache Flink.
This section contains the following topics:
Prepare for Disaster Recovery in Confluent Manager for Apache Flink: Describes what to do before a disaster: back up the CMF metadata, store the compiled plans of statements durably, keep checkpoints and savepoints on durable storage, and take savepoints.
Back Up and Restore SQLite Metadata of Confluent Manager for Apache Flink with Volume Snapshots: Describes how to back up and restore the default SQLite database of CMF with Kubernetes volume snapshots.
Recover Workloads onto a Replacement Cluster with Confluent Manager for Apache Flink: Describes how to recover workloads onto a replacement cluster after the loss of a spoke cluster or of the cluster that runs CMF, and how to verify the result.
How Confluent Manager for Apache Flink Recovers Flink SQL Statements: Describes how to check your Flink SQL statements after recovery, how CMF recovers each statement and chooses the state that a recreated statement starts from, and how to resume or recreate a statement that recovery stopped.
Troubleshoot Disaster Recovery in Confluent Manager for Apache Flink: Lists the problems that keep workloads from being recovered, how CMF reports them, and what to do.
Your responsibilities
CMF recovers workloads from what survives the disaster. The following are your responsibilities:
The CMF database. Back it up so that a copy survives the loss of the cluster that runs CMF, and restore it before you recover workloads if it was lost.
Checkpoint, savepoint, and artifact storage. CMF stores the locations of savepoints, not their data. Keep checkpoints, savepoints, and artifacts on durable storage outside the Kubernetes cluster, such as Amazon S3, Google Cloud Storage, Azure Blob Storage, or HDFS, and make sure that a replacement cluster can reach it.
Starting CMF. CMF runs as a single instance and recovers workloads only when it starts. It does not fail over by itself: you start it against the surviving database.
What CMF recovers
Each time CMF starts, it runs startup recovery, also called metadata sync. Startup recovery reads the CMF database and recreates the Kubernetes resources of the workloads that CMF manages, or reapplies or keeps them if they still exist. It handles the resources in the order of the following table, so that the objects that each step needs exist before the step runs.
Resource |
Kubernetes objects that CMF recreates |
Notes |
|---|---|---|
Applications |
The |
Left out when |
Environments |
The |
The key encrypts the compiled plans of statements on compute pools that have no key of their own. |
Shared compute pools |
For each running pool, the key |
Only pools created with CMF 2.5.0 or later have their own key. |
Dedicated compute pools |
n/a |
The pool has no Kubernetes objects of its own. Each statement on it runs in its own
|
Statements |
The plan |
Only statements that are meant to be running, that is, that you have not stopped or
deleted, and that have not completed or failed. CMF rebuilds a missing plan
|
Savepoints |
n/a |
CMF does not recreate |
Note
Startup recovery generates a new spec for the session cluster of each shared compute pool from
the pool and the current computePoolDefaults of its environment. If the cluster runs with
another spec, for example because the defaults have changed, and statements on the pool are
meant to be running, recovery does not apply the new spec. Applying it would make the Flink
Kubernetes Operator redeploy the cluster without taking savepoints. Recovery leaves the cluster
and its statements unchanged and logs a warning. To update the compute pool to match the
defaults, stop the statements, update the pool, and resume them. For details, see
Troubleshoot Disaster Recovery in Confluent Manager for Apache Flink.
Catalogs, secrets, secret mappings, detached savepoints, artifacts, and Kubernetes cluster registrations need no recovery: CMF keeps them in its database. The files of artifacts stay in artifact storage.
While startup recovery runs
Startup recovery runs in the background after CMF starts serving requests. Until it finishes, CMF rejects the following requests with HTTP 503:
Requests that create, change, or delete environments, compute pools, applications, statements, and the savepoints of applications and statements. Requests that detach a savepoint are accepted.
Requests for the results of interactive
SELECTstatements.
Other requests, such as reads, are unaffected. To follow its progress, see Verify the recovery.
Startup recovery does not wait for a session cluster to be ready: the Flink Kubernetes Operator starts the session jobs of a session cluster when it is up.
Recovery settings
Helm value |
Default |
Effect of |
|---|---|---|
|
|
Turns startup recovery off. This is an advanced setting for administrators who decide not
to use startup recovery. While it is |
|
|
Startup recovery recovers everything except applications, and logs how many it left out. |
With the default, a recovered application restores the savepoint that its spec names, which can be old, or starts without state. That suits stateless applications.
To start stateful applications from savepoints that you choose during a failover:
Set
cmf.recovery.applications.enabledtofalsebefore you start CMF.After startup recovery has finished, start each stateful application from a savepoint, as described in Start a job from a savepoint.
Set the value back to
true. CMF restarts, and startup recovery recovers the applications that you did not start, as with the default.
The value applies to every start of CMF. While it is false, startup recovery does not recreate
the applications of a lost cluster, and a restart does not reapply their specs.