Apache Airflow backup and disaster recovery

Plan Airflow backup and disaster recovery around the metadata database, DAG source, secrets and logs, with a restore order and a tested runbook for infrastructure you control.

On this page

Apache Airflow backup and disaster recovery starts with knowing what state Airflow holds

If a cluster or region is lost, the recovery question is which pieces of Airflow state you can rebuild, which you must restore from backup, and in what order. Airflow is an Apache Software Foundation project released under the *Apache License 2.0* (Apache-2.0), and the project sells no managed recovery service. In a self-hosted deployment, your team owns every backup, every restore test and every decision about how much history you can afford to lose. Nobody else will reconstruct your pipelines for you.

Four categories of state matter. The metadata database holds DAG run history, task instances, variables, connections and pool definitions, so it is the one you cannot regenerate from code. The DAG repository holds the pipeline code and should already live in version control, but you must confirm which commit each environment runs. Secrets sit in an external secrets backend, in environment variables or in the metastore, depending on configuration, so you need to know where each credential lives before you can restore it. Logs are usually stored in a remote location and are often needed for audit, so decide whether they are part of the recovery scope at all. Confirm where each category lives today in your environment, because the answer changes the backup method for each one.

Build this inventory before any upgrade, not only after an outage. The Airflow 3 upgrade guide asks you to back up the metadata database first and to trim old data with airflow db clean before migrations, since schema migrations can be slow on large databases. Teams that skip the inventory often discover during an upgrade that a connection or secret was only ever stored in the metastore. Treat the inventory as a document you review at each release and each time the deployment topology changes.

What to back up in an Airflow deployment

A recovery plan for Airflow has to cover four components that fail independently and must be restored in a consistent state. The metadata database holds run history and connections, the DAG repository holds the code that defines pipelines, the secrets backend holds credentials, and logs hold the evidence of what ran. Map where each one lives in your environment before you decide how to back it up.

Metadata database

The metadata database stores DAG run state, task instances, variables, connections and the record of what has already executed. It is the component the upgrade guide tells teams to back up first, and losing it means the scheduler no longer knows which runs finished, which invites duplicate or missed executions. Confirm which engine hosts it (PostgreSQL or MySQL, not SQLite for production), who owns backup scheduling, and whether the database is reached through a managed service or your own cluster. Test that a restored copy starts cleanly against the same Airflow version.

DAG repository and delivery

DAG files define every pipeline, so the repository is the source of truth for code and the first thing to rebuild. Check whether DAGs are baked into the image, synced from Git by a sidecar, or copied to a persistent volume, because each method has a different recovery path. Git-sync with a single source repository is simpler to rebuild than an externally populated volume that exists only in one cluster. Confirm the repository is mirrored outside the failed region and that the exact commit or image tag running in production is recorded.

Secrets backend

Connections and variables that point to an external secrets store keep their values outside Airflow, so the metadata database alone cannot reproduce a working deployment. Airflow checks the alternative secrets backend first, then environment variables, then the metastore, and that order is fixed. Environment-held secrets live in your deployment manifests or secret manager and need the same backup discipline as the database. Confirm who can restore the external store, how it is replicated across regions, and whether workers use a different backend through the workers secrets setting.

Task and scheduler logs

Task logs are the record auditors and on-call engineers use to explain what a pipeline did, and they often sit on local volumes that vanish with a cluster. Decide whether logs go to remote object storage, a shared volume or a log aggregator, and whether that store is replicated to the recovery site. Logs are less critical to restart pipelines than the database, but losing them removes evidence needed for incident reviews and some compliance audits. Confirm retention periods with your compliance owner and check that log paths are included in the restore runbook.

Deployment configuration

Helm values, environment variables, Kubernetes manifests and the Airflow configuration file define how the scheduler, API server, DAG processor and workers start. Without them, a restored database cannot be reconnected to the right executor, secret key or database URL. Keep these in version control next to the DAG repository and record the Airflow and provider versions in use. Confirm that the secret key shared across API server replicas is stored securely, since a new key breaks sessions and can invalidate existing tokens.

Taking a consistent metadata database backup

The Airflow 3 upgrade guidance tells you to back up the metadata database first, and to shut Airflow down if a hot backup cannot be kept consistent. The metadata database holds DAG run state, task instances, connections, variables and the audit trail, so a copy taken while schedulers, workers and the API server are writing can capture a state that never existed. Decide before the first backup which approach you will use, and write it into the runbook so the on-call engineer does not improvise it during an incident.

A hot backup keeps Airflow running but needs a database that can produce a point-in-time-consistent copy while writes continue. A planned stop window is simpler and easier to verify: you drain the schedulers, stop the workers and API server, take the backup and restart. The cost is downtime for every scheduled run in that window, so schedule it where missed runs can be caught up. PostgreSQL and MySQL are the supported production backends in the prerequisites and deployment guidance, and they provide the native backup, replication and point-in-time recovery options that make hot backups practical. SQLite is for testing only and should not be the source of a production backup plan.

Run airflow db clean before the backup when history has grown large. It removes old rows according to your retention settings, which shrinks what you back up and speeds up the schema migrations the upgrade guide warns can be slow on large databases. Confirm the retention window with your audit and compliance owners first, because cleaned rows cannot be restored from the backup you take afterward. Ask your database team which backup tool, retention schedule and point-in-time recovery window your platform supports, and test a restore into a separate instance before you rely on the procedure.

How DAG delivery changes what you restore

When DAG files are baked into the container image, the image is the deployment artifact for both code and runtime. Recovery means producing or pulling a known-good image for the release that was running, then deploying it against the restored metadata database. No separate DAG store needs to be restored, but the image registry, build pipeline and image tags become critical recovery dependencies. Changes to DAGs require a new build, so the image history doubles as the change record.

  • Registry availability: Confirm that the image registry holds copies in the recovery region, or that images can be rebuilt from source.
  • Pinned tags: Deploy immutable tags or digests, not a mutable tag such as latest, so recovery returns the exact DAG code that ran before the outage.
  • Build inputs: Keep the Dockerfile, base image reference, requirements files and the DAG source commit that produced each image.
  • Rebuild path: Test whether a rebuild from source works without access to the failed region's registry.
  • Hotfix discipline: Any emergency DAG edit made directly on a running pod is lost on recovery, so route fixes through the build pipeline.

Before relying on this model, check that the image tag recorded in your deployment matches a retrievable artifact in a second location.

Restore order after losing a cluster or region

This sequence rebuilds Airflow in a fixed order so that the metadata database, secrets, DAG source and Airflow components come back at the same versions as the backup point. Each step ends with a check that tells the team whether the next step is safe to start.

  1. Provision the target infrastructure at matching versions

    The platform or infrastructure team builds the replacement environment in the recovery location: the network, compute, Kubernetes or virtual machine hosts, object storage for logs, and the metadata database service. Record the Airflow version, Python version and Helm chart version from the backup inventory, and install exactly those versions, since the restored database must match the code that reads it. Done means every host or pod runs the recorded versions and the target database engine and major version match the backup's engine, as the prerequisites page lists supported PostgreSQL and MySQL versions for Airflow 3.3.2.

  2. Restore the metadata database from a consistent backup

    The database administrator restores the most recent backup taken while Airflow was stopped or from a snapshot the team has verified as consistent, then replays any available transaction logs only if the team has tested that procedure. Keep all Airflow components stopped during this step so no scheduler writes to a half-restored schema. Done means the restore completes without errors, and a query against the Alembic version table in the Airflow database returns the revision that matches the deployed Airflow release. If it does not match, stop and confirm the revision with the Airflow upgrade documentation before continuing.

  3. Restore secrets backends and environment secrets

    The security or platform team restores the external secrets backend, such as a vault or cloud secrets store, and recreates the environment variables and Kubernetes secrets that Airflow reads at startup. Remember that Airflow checks the alternative secrets backend first, then environment variables, then the metastore, and that this order is not configurable. Also restore any separate worker secrets backend configured under the workers section. Done means a test lookup of one connection and one variable from each source returns the expected value in the recovery environment, and no secret values appear in logs.

  4. Bring the DAG source back to the backup commit

    The data engineering team points the DAG delivery mechanism at the Git repository and commit recorded at the backup point, or restores the DAG bundle, persistent volume or image tag used by the previous environment. The Helm chart can bake DAGs into the image, use a git-sync sidecar, or read from an externally populated persistent volume claim, so confirm which method the old cluster used. Done means the working copy or volume holds the exact commit or image digest recorded in the backup inventory, and the repository is the single source the team expects.

  5. Deploy API server, scheduler, DAG processor and workers

    The platform team starts the components at the recorded versions, beginning with the DAG processor and API server, then the scheduler, then the workers or executor pods. In Airflow 3, the API server and DAG processor run as separate components, so start each one with its own configuration and confirm each reads the same metadata database and secrets. Keep scheduling paused on any DAG that could run immediately against systems that were not restored yet. Done means every component reports healthy, the scheduler heartbeat is current, and the logs show no migration or configuration errors.

  6. Confirm DAG files and parsing match the expected set

    The data engineering team checks that the DAG processor has parsed the expected DAG files and that the list of DAG IDs in the UI or REST API matches the inventory captured before the outage. Investigate any import errors before unpausing anything, because a missing dependency or secret can make a DAG disappear without a clear message. Done means the DAG count and IDs match the inventory, the import error list is empty or each error is understood and accepted, and no DAG has been unpaused yet.

  7. Verify runs and reconcile before resuming schedules

    Before enabling schedules, the operations team compares the last successful run and any in-flight runs in the restored database with what the source systems and downstream consumers received before the failure. Mark runs that partly completed for review, and decide per DAG whether to let the scheduler catch up, skip missed intervals, or trigger a manual backfill, since uncontrolled catch-up can duplicate writes into targets. Done means the team has a signed-off list of DAGs to resume, the reconciliation notes are stored with the recovery record, and the first scheduled runs complete with the expected logs and task states.

Avoiding duplicate runs after recovery

The main risk after a recovery is that the restored metadata database describes work that already happened, and a scheduler that wakes up against it decides that work is still pending. Tasks that finished after the backup point may be scheduled again, and intervals that were recorded as running may be skipped or re-queued. The first control is to keep the recovered environment paused until someone has checked its state: pause the DAGs, keep the scheduler and workers stopped, and only start them once the checks below pass. Airflow supports running several schedulers against one database using row-level locks, which is why a stale scheduler left over from the failed site must never be pointed at the restored database. Confirm that every scheduler, DAG processor and API server in the recovered environment uses the restored connection string, and that nothing in the old region still reaches it.

Before unpausing, review the task instances that were queued or running at the backup point and compare them with what the external systems actually did. Look at the dag_run and task_instance state in the restored database, then check the target systems (warehouses, APIs, file drops, message topics) for the same work. Where a task already wrote output, decide whether to mark it successful, clear it for a rerun, or leave it alone. Treat this as a practice to validate in your own environment rather than a guarantee: the exact states depend on your executor, retry settings and how far the backup lagged behind the failure. Record each decision so the audit trail shows why a run was rerun or skipped.

The most durable protection is idempotent task design, which Airflow cannot provide on its own. Tasks that write with upserts keyed on a business identifier, overwrite a partition for a given logical date, or check for existing output before writing will tolerate a replay without corrupting data. Confirm with each pipeline owner which tasks are safe to rerun and which need a manual step, and document that list alongside the recovery runbook. Include a catch-up review for schedules that could backfill a large window once the scheduler resumes, and confirm how your DAG catchup and max_active_runs settings limit that burst. Validate these controls in a rehearsal, as described in the testing section, before you rely on them in a real failover.

Security and operational considerations for backups

Backups for Airflow carry more than pipeline definitions. The database holds connection details and run history, the secrets store holds credentials, and the restore itself must leave a record. These four cards cover the risks that most often get overlooked when the backup plan is first written.

Protect database backup copies

A metadata database backup holds connection records, variables, run history and audit-relevant metadata, so a copy is as sensitive as the live database. Treat backup files as production data: encrypt them at rest, restrict who can read or restore them, and keep them out of general-purpose storage buckets. Ask your security team to confirm the encryption method, where keys are held, and who may rotate them. Also check whether connection data is stored in a form that remains protected inside a dump.

Back up secrets separately

Airflow resolves secrets from an alternative secrets backend first, then environment variables, then the metastore. Credentials therefore often live outside the database, in a vault or cloud secrets manager, and a database restore will not bring them back. Keep the secrets store on its own backup and recovery path, with its own access policy and restore test. Record which backend each component uses, including workers configured through the workers secrets backend setting, so the recovery runbook names every source.

Make every restore auditable

A disaster recovery restore changes production state, so it needs the same evidence as any other change. Record who approved the restore, which backup snapshot was used, the time it was taken, the target environment and the commands run. Capture the state of DAG code and database schema version before and after. Store this record with your change tickets so auditors can trace a recovered environment back to a known, approved source.

Match retention to audit needs

Retention for backups is a compliance decision, not only a storage decision. Older backups may keep run history and metadata that your audit or regulatory obligations require, while retaining them indefinitely increases the amount of sensitive data exposed. Agree retention periods with compliance and legal owners before setting cleanup jobs. Remember that airflow db clean removes data from the live database but does not delete backup copies, so backup retention and cleanup policies must be set together.

Questions teams ask before planning Airflow disaster recovery

How much effort does an Airflow disaster recovery plan take, and what drives it?

The effort depends mostly on how many components hold state and how much of the environment is rebuilt from code. A plan covers the metadata database, the DAG repository, secrets, logs and the deployment definitions that recreate the cluster. Teams with a single Git repository for DAGs, a managed or well-understood database backup process and secrets held in a backend they already back up usually have less to design. Drivers that add work include multiple schedulers, external secrets backends, Celery or Kubernetes executors, log storage on local volumes, and recovery targets set by the business. Ask any partner for a written scope listing each component, the recovery steps and the test plan, since that scope is what a quote follows from.

Can our own team plan and run Airflow disaster recovery without outside help?

Yes, many teams do this in-house if they already operate PostgreSQL or MySQL backups, Kubernetes and a secrets store. The hard parts are less about tooling and more about agreeing on what must be restored, in what order, and how to prove it works. Airflow's own upgrade guidance tells operators to back up the metadata database first and to shut Airflow down when a hot backup cannot be made consistent, which shows that database procedures need the same care as the rest of the plan. An outside team can take on design, runbooks and restore testing under a fixed scope, while your staff keep ownership of the systems. Decide early which part your team will own after handover.

What does the recovery work need from our database, storage and Kubernetes teams?

The work touches three groups. Your database team must confirm how the metadata database is backed up, how point-in-time recovery works if it is offered, and how a restore is validated. Your storage team owns where DAG files, logs and any persistent volumes live, and how those are replicated to another location. Your Kubernetes or platform team owns the cluster definitions, images, Helm values and the secrets integration needed to rebuild Airflow in a new place. Agree on access, change windows and who approves a restore before the first test. Airflow supports PostgreSQL 14 to 18 and MySQL 8.0, 8.4 and Innovation releases for version 3.3.2, so confirm which of those your database team runs.

How often should we test Airflow restores, and what should a test cover?

Set the test frequency from your own recovery objectives and change rate, then write it into the plan so it is not optional. A useful test restores the metadata database into an isolated environment, redeploys Airflow from the DAG repository and secrets source, starts the scheduler and API server, and checks that DAGs parse and that task state is consistent. It should also confirm that schedules do not fire duplicate runs for intervals that already completed. Record elapsed time, every manual step and any gap found, then fix the runbook. Repeat the test after major platform changes such as an Airflow upgrade or a change in executor or database version.

Is recovering DAG code or the metadata database the harder problem?

The metadata database is usually the harder recovery because it holds run history, task state, connections references and scheduler state that cannot be rebuilt from code. DAG code is normally recovered from a Git repository that already has its own history, so the main risk is a mismatch between the code and the database at the restore point. Airflow's Helm chart documentation generally recommends git-sync with local volumes and states that DAGs must come from a single Git repository, which simplifies recovery. Secrets are a separate concern: Airflow checks an alternative secrets backend first, then environment variables, then the metastore, so the secrets source must be available before the scheduler starts.

How should we handle backups before upgrading to Airflow 3?

Treat a pre-upgrade backup as a required step, not an optional safety net. The Airflow 3 upgrade guide tells teams to back up the metadata database first, to stop Airflow if a hot backup is not possible so the copy stays consistent, and to trim old data with airflow db clean, because schema migrations can be slow on large databases. The guide also requires being on Airflow 2.7 or later before upgrading and recommends checking DAG code with Ruff AIR301 and AIR302 rules. Test a restore of that backup on a copy of the environment before the upgrade starts, and keep the previous container images and Helm values so a rollback is possible. Confirm the window with the teams that run the database and the scheduler.

Will our Airflow disaster recovery engagement be fixed-scope, and how do we get a quote?

DeployOpen does not publish a price list. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and a quote follows from that written scope. To request one, list your Airflow version, executor, database engine, DAG delivery method, secrets backend, log storage, the systems that must be recovered and the restore objectives your business has set. Ask for the components in scope, what is handed over, what your staff must provide, and whether restore testing and ongoing retainer support are priced separately. Ongoing support, upgrades and continuous testing are available as retainers.

Testing the recovery plan before you need it

A backup that has never been restored is an assumption, not a recovery plan. Run a restore drill at least once before the platform goes into production, then repeat it on a schedule. Restore the metadata database backup into an isolated environment that cannot reach production task workers, message brokers or source systems. Redeploy the same Airflow version you backed up, using the same Helm chart or image tag and the same configuration files. Matching the version matters because the metadata schema and the Airflow 3 components must agree with the restored data. Start with the database restore and the schema check, then bring up the API server, scheduler and DAG processor as separate components, since Airflow 3 requires the DAG processor to run on its own.

Once the stack is up, confirm three things in order. First, confirm that DAGs import cleanly from the restored DAG source, whether that is the image, the git-sync repository or the externally populated volume. An import error at this stage usually means the DAG source revision does not match the database state, so record which revision each environment used. Second, confirm that secrets resolve in the documented order: the alternative secrets backend first, then environment variables, then the metastore. This order is not configurable, so test a connection that depends on each layer and confirm which one answers. Also check any separate worker backend configured under [workers] secrets_backend. Third, confirm that the scheduler does not fire duplicate runs. Compare the restored dag_run records against the schedule and the logical dates of the last completed runs before enabling any DAG, and keep the drill environment's schedulers paused so it cannot write to production systems.

Record each step as evidence: the backup identifier, the Airflow version, the DAG source revision, the time of each check and the person who signed off. Store these records with your change and recovery documentation so auditors and internal reviewers can see that the plan works. Repeat the drill after every Airflow upgrade, every Helm chart change, every secrets backend change and every significant airflow db clean run, because each of these can alter what a restore needs. Ask your partner or internal team to state in writing how long the drill took and which steps were manual, and treat any step that needed undocumented knowledge as a gap to close before the next drill.

How DeployOpen works on this

DeployOpen plans and delivers Airflow recovery work inside your own infrastructure, starting from an inventory of what your deployment actually stores and where. The work covers consistent database backups, restore order, duplicate-run controls and recovery tests, documented so your team can run the plan without us.

How we scope

  • Inventory the metadata database, DAG delivery path, secrets backends, log storage and Helm values in your environment.
  • Agree in writing which components are in scope, which recovery targets apply and who owns each runbook step.
  • Confirm your Airflow version and upgrade status first, since recovery steps differ between Airflow 2 and Airflow 3.

How we build

  • Configure database backups with a consistent method, including a planned stop window where hot backups cannot guarantee consistency.
  • Document the restore sequence for the database, secrets, DAG source and logs, with checks at each stage.
  • Set up controls that prevent duplicate task runs after recovery and test them against a restored copy.

How we hand over

  • Deliver runbooks, configuration records and restore test results written for your platform and operations team.
  • Walk your engineers through a full restore exercise so they can repeat it without DeployOpen present.
  • Record the open decisions, such as retention periods and acceptable recovery windows, for your owners to confirm.

How we support

  • Offer ongoing support, upgrades and recurring recovery testing as a retainer after the fixed-scope engagement ends.
  • Review the plan when Airflow versions, executors, secrets backends or infrastructure change.
  • Schedule restore tests on a cadence your team agrees, and update runbooks with each test's findings.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.