Drupal high availability

Drupal high availability means running several web nodes, shared file storage, a replicated database and external caches so one failure does not take the site down. This page covers the decisions, build order, checks and handover.

On this page

Why Drupal high availability is harder than adding a second web server

Adding a second web server does not make a Drupal site highly available. A site that has outgrown one server, or cannot tolerate planned or unplanned downtime, needs every piece of state it depends on to stay consistent across all nodes, and a single load balancer in front of two identical web servers only addresses the most visible part of that problem. The state that matters includes the database, public and private files, cache backends, user sessions, and the deployed code and configuration. If any one of these lives on only one machine, losing that machine still takes the site down, and two nodes can serve different content or different code at the same moment.

Work through each shared component before any hardware is ordered. Confirm where the public and private files directory will live and whether every web node can read and write it at the same time, since the answer determines the storage design. Identify which cache backend the site will use and whether sessions and cache entries must survive a node restart. Decide how the code and the active configuration reach each node together, because a Drupal site that is partly upgraded across the pool can fail in ways that a simple health check will not detect. Each of these choices feeds the next one, so the sequence matters.

The database choice also shapes the whole design. Drupal supports Apache and Nginx as web servers and MariaDB, MySQL, PostgreSQL or SQLite as databases, according to the Drupal system requirements. Replication, failover and write routing differ between these engines, and SQLite is a file-based database that is not suited to multiple web nodes writing to one site. Confirm the database engine, its supported replication approach and the team's ability to operate it before the web tier is designed, because a web tier that is highly available on top of a single database instance is still a single point of failure.

Which Drupal and infrastructure components must be made redundant

A Drupal site becomes highly available only when every tier that holds state, or that each node reads from, is shared or replicated. Most failed multi-node Drupal builds break in the same few places: a local file directory, a per-node settings file, or a cache or session store that only one server can see.

Load balancer and health checks

The load balancer is the single entry point and must route only to web nodes that are actually ready to serve Drupal. Health checks should hit a lightweight path that confirms PHP and the database connection work, not just that the web server process is running. Confirm how sticky sessions are handled, since authenticated editors and cache behavior can differ between nodes. Also confirm how TLS termination and client IP forwarding are configured, because Drupal's trusted host and proxy settings depend on them.

Web tier running Apache or Nginx with PHP

Web nodes should be stateless: identical images or builds, the same PHP version, and the same Drupal codebase deployed from one artifact. Drupal runs on Apache, Nginx and other web servers, so the choice should follow your team's operating skills. The per-node drift that causes trouble usually sits in settings.php and in local PHP configuration. Check that every node loads the same settings and that PHP extensions and OPcache settings match.

System requirements

Shared public and private file storage

Uploaded media and generated image styles live in the files directory, and a local directory on one node is invisible to the others. Public and private files need separate handling, because private files are served through Drupal and must keep their access checks. Decide whether shared storage is a network file system, an object store module, or another mount, and confirm how generated derivatives are rebuilt after failover. Mismatched permissions on the files directory are a common source of broken images on only some nodes.

Database replication or clustering

The database holds all content, configuration, users and most cache-adjacent state, so a single writer is the critical dependency. Drupal supports MariaDB, MySQL, PostgreSQL and SQLite, and the replication or clustering approach must be confirmed against the version you choose. Decide how Drupal connects to a writer versus replicas, because read-only replicas will not accept writes made during sessions, cron or form submissions. Test failover with real content edits, not only with a connection check.

System requirements

Cache layer and reverse cache

Redis or Memcache as a cache backend lets all web nodes share render and data caches, while a local file cache leaves each node with its own copy and stale results after a change. Varnish or a CDN in front handles anonymous page traffic, but its purge rules must match Drupal's cache tags, or editors will see outdated pages. Confirm which cache bins are shared, how cache invalidation reaches the reverse cache, and what happens if the cache service is unavailable. Cache loss should slow the site, not break it.

Sessions and deployment artifacts

PHP sessions must be stored where every node can read them, or users are logged out when the load balancer moves them. The deployment artifact, including the Composer-built code, the configuration sync directory and the environment settings file, must be identical across nodes at each release. Plan for zero-downtime deployments by draining nodes, running database updates once, and clearing caches in a fixed order. Confirm your process for running drush deploy and for rolling back a release that changed configuration.

How the tiers of an HA Drupal stack connect

The walk starts at client traffic arriving at the public edge, where a CDN or Varnish layer can serve cacheable pages before anything reaches the origin. Requests that pass through go to a load balancer, which uses health checks to decide which Drupal web nodes receive traffic. The web nodes share one file store and a replicated database, and they read and write cache entries in an external Redis service. The deployment pipeline pushes code and runs configuration import into the environment, and the dashed boundary marks where the public edge stops and the private data tier begins. Check that every node reaches the same file store, database primary and Redis instance, and that the health checks fail fast when a node is unhealthy.

Traffic path, shared state and deployment hand-offs across the tiers of an HA Drupal stack.

Decisions to settle before choosing the topology

This table compares the main architecture decisions for a highly available Drupal site, with the operational cost of each option. Read each row as a question to answer before drawing the topology, since the choices for files, database, cache and sessions constrain each other. The main takeaway is that the simplest option that meets your recovery and consistency targets is usually the easiest to operate.

DecisionOption and when it fitsTrade-offOperational cost
Web node modelActive-active: several web nodes all serving traffic. Fits sites with steady load and a need for no-downtime node loss.Every node must share files, sessions and cache state, and deployments must handle mixed code versions.Ongoing: configuration drift checks, coordinated releases and per-node monitoring.
Web node modelActive-passive: a standby node takes over on failure. Fits smaller sites with modest recovery targets.Simpler state handling, but failover is not instant and the standby can drift if not kept current.Ongoing: regular failover tests and standby patching.
Shared file storageNetwork file system mounted on all nodes. Fits sites that need POSIX-style file access and already run this service.Strong consistency for uploads, but performance and locking depend on the network and file system chosen.Recurring: storage administration, backup of the file share and capacity growth.
Shared file storageObject storage with a contributed Drupal file module. Fits sites that can accept a storage adapter and public or signed URL behavior.Scales well, but module compatibility, upload paths and private file handling must be tested before adoption.One-time: adapter setup and testing. Recurring: module upkeep and storage billing.
Shared file storageSync tool between nodes. Fits only small, low-churn sites where brief inconsistency is acceptable.Files written on one node may not appear on another for a time, and deletes can conflict.Recurring: sync failure investigation and reconciliation after outages.
Database high availabilityRead replicas with manual or scripted promotion. Fits read-heavy sites that can tolerate replication lag.Drupal writes go to the primary, so replicas help only read paths, and promotion needs a tested runbook.Recurring: lag monitoring, replica maintenance and failover drills.
Database high availabilityClustered database with automatic failover. Fits sites with strict recovery targets and in-house database skills.Stronger failover, but cluster configuration, quorum behavior and application connection handling add complexity.Recurring: cluster licensing or support where applicable, upgrades and split-brain testing.
Cache backendDatabase cache backend. Fits low-traffic sites with a small footprint.Simple to run, but cache load lands on the database that is already the critical component.Low additional cost, but more database capacity may be needed as traffic grows.
Cache backendRedis or Memcache. Fits sites that need shared cache across nodes and lower database load.A shared cache service becomes another dependency, so its own failover and eviction behavior matter.Recurring: cache service hosting, memory sizing and monitoring.
Reverse cache or CDNVarnish or a CDN in front of the nodes. Fits sites with many anonymous visitors and cacheable pages.Improves capacity but requires careful cache rules for logged-in users, forms and cookies.Recurring: rule maintenance and invalidation design, since content edits must purge affected URLs.
Session storageShared session store, such as Redis or database-backed sessions. Fits any multi-node Drupal site with logged-in users.Without shared sessions, users are logged out or routed unpredictably when a node changes.Recurring: session store capacity and a plan for session loss during failover.
Session storageSticky sessions at the load balancer. Fits short-term setups with limited node counts.Node failure still drops active sessions, and uneven load can build up on individual nodes.Low setup cost, but weaker resilience and harder capacity planning.

How to build the stack in sequence

The sequence turns a single-node Drupal site into a stack where any web node can serve any request, the database and cache survive a node loss, and code and configuration move to production without a maintenance window. Each step closes with a check so the next layer is only added to a proven base.

  1. Build a single-node baseline on supported versions

    Install Drupal on one server using a Drupal version that is still supported and a PHP version it requires, with Composer managing the codebase. Confirm the PHP version against the Drupal.org PHP requirements page before the install, because a Drupal 11 baseline needs PHP 8.3 or later. Install the site, import configuration, and run the site's own test suite. The check: the site installs from a clean database, the status report shows no errors, and the codebase builds from the lock file on a second machine.

  2. Move secrets and private paths into environment config

    Remove database credentials, the hash salt, and file paths from settings.php and load them from environment variables or a secrets store on each node. Move the private file path outside the web root and make sure settings.php itself is read-only in production. Your platform team owns the secrets store, and DeployOpen typically pairs this step with the hardening review. The check: two nodes built from the same artifact start with different environment values and no value is hard-coded in the repository.

  3. Move public and private files to shared storage

    Mount a shared file system, or an object storage backend through a file system module, at the public and private file paths so every web node reads and writes the same files. Confirm the mount performs acceptably for the image and document volume you expect, and confirm the chosen option with your storage vendor. Test an upload on node A, then request its file URL from node B and the load balancer address. The check: every generated file URL resolves from every node, and a file uploaded through one node is visible on all others.

  4. Replicate the database and test failover

    Implement the database design your team has chosen, such as a primary with one or more replicas and a defined promotion process, using the database engine your Drupal version supports (MariaDB, MySQL, or PostgreSQL). Decide which reads, if any, go to replicas, because Drupal writes cache and session data during requests. Run a planned failover in a non-production environment and record the time to recover and any errors. The check: a documented failover runs end to end, the site stays up with the promoted primary, and the runbook has been executed by someone other than its author.

  5. Add an external cache and confirm bins are shared

    Configure Redis or Memcache as the cache backend in settings.php for all cache bins that must be shared across nodes, and leave local-only bins where they make sense. Confirm the cache service is reachable from every web node and set its memory limits and eviction policy with the platform team. Clear caches on one node and verify the change is visible on another. The check: a cache write on node A is read on node B, and cache clearing from one node takes effect cluster-wide.

  6. Place the load balancer with Drupal-aware health checks

    Put the load balancer in front of the web nodes and point its health check at an endpoint that confirms Drupal can bootstrap and reach the database and cache, not just that the web server answers. Set session affinity only if your authentication design requires it. Remove a node from the pool during a test and watch traffic redistribute. The check: a node with a broken database connection is taken out of rotation automatically, and users see no errors when a single node is stopped.

  7. Add edge caching with invalidation on content change

    Place Varnish or a CDN in front of the load balancer for anonymous and cacheable pages, and configure Drupal's cache tags so that content edits purge the affected URLs. Define which pages must never be cached, such as authenticated and editorial views. Confirm the edge provider's purge API and its rate limits with the vendor before you rely on them. The check: publish an edit, and the changed page reflects it on the public URL within the purge behavior you documented, while logged-in pages are never served from the edge.

  8. Deploy with configuration import and no maintenance mode

    Set up a pipeline that builds one artifact, deploys it to nodes in batches, runs database updates and configuration import once, and then shifts traffic to the new code. Keep the previous artifact available for rollback, and test that database updates are backward compatible for one release. Run a deploy on the staging stack with the load balancer active. The check: a release deploys and imports configuration with no maintenance page, and a rollback to the previous artifact completes in a rehearsal.

What drives effort and cost in an HA build

This table lists the factors that most change the effort of a Drupal high availability build, what pushes each one up, and how to keep it manageable. Effort figures come from the written scope agreed for your project, not from this page, so use the rows to ask the right questions when you compare quotes.

DriverWhat raises effortHow to keep it down
Number of environmentsSeparate development, staging and production stacks, each with its own load balancer, caches and database replicas, multiply configuration and testing workKeep environments identical in topology, and scale down non-production nodes while keeping the same services and configuration
Content and file volume on shared storageLarge public and private file directories must be moved to shared or object storage, and existing file paths in content and modules may need rewritingAudit file counts and sizes early, separate public and private files, and decide on a storage backend before the first migration run
Database size and replication lag toleranceStrict tolerance for stale reads means tighter replication, more read routing logic and more failover testingAgree the acceptable lag per content type in writing, and route only safe read traffic to replicas
Contributed modules needing multi-node checksModules that cache locally, use file locks, or assume a single web server each need review or replacementInventory contributed modules and their maintainers early, and prefer modules with documented shared-cache behavior
Custom modules writing to local disk or holding stateCode that writes temporary files, sessions or queues to the local filesystem, or stores state in PHP memory, must be refactoredRoute state to the database, Redis or shared storage, and add a review step for new custom code against a multi-node checklist
Integrations calling Drupal from several nodesWebhooks, cron-style imports and API consumers may fire once per node, causing duplicate work or race conditionsRun scheduled jobs from one designated node or a queue worker, and make webhook handlers idempotent
Compliance for data residency and loggingResidency rules may limit where replicas, backups and cache data can live, and centralized logs for every node add setup and retention workDocument data flows and locations before design, and ask the assessor which logs and retention periods they expect
Team skills with the chosen stackTeams new to the chosen web server, database, Redis or Varnish, or to Drupal deployment tooling need more training, and more troubleshooting time during buildConfirm current skills in the written scope, and budget for pairing and runbook reviews where gaps exist

How the HA design changes by deployment model

A single node runs the web server, PHP, the database and the cache on one host. It has no redundancy, so a hardware fault, failed disk or bad update takes the site down until the host is restored. This model suits development, staging and low-criticality sites, and it is the baseline against which the other designs are measured. Because everything shares one machine, file storage is simply local disk, the database is a local instance, and deployments are in-place changes that briefly interrupt service.

  • File storage: the public and private file directories sit on local disk, so backups must capture them with the database.
  • Database failover: none. Recovery depends on restoring the latest backup onto a replacement host, and the restore time is the outage time.
  • Cache placement: usually the in-process or file-based cache on the same host, which is simple but does not survive a host replacement.
  • DNS and load balancing: a single A record pointing at one address, with no health checks.
  • Deployment: in-place updates during a maintenance window, with Configuration Management export and import run against the one site.

Confirm with your infrastructure team whether backup restores have been tested against a replacement host and how long that restore actually takes.

How to test that the site survives a node or database failure

The test plan should prove that the design keeps serving editors and visitors when one part fails, and that it fails in a predictable way when it cannot. Start by writing down the expected result for each test before running it. A test counts as failed if a logged-in editor is dropped to the login page, a file uploaded through one web node returns a 404 from another, a content edit appears on one node but not the others after the cache invalidation window you designed, or the load balancer keeps sending requests to a node that is down. Record the timestamp, the node or database instance affected, the health check results, the HTTP status codes seen by a test client, and the application log lines for each run. Those records are the evidence a CISO or auditor will ask for, and they are what your team will compare against on the next rehearsal.

Run the node-removal test first. Take one web node out of the pool, then send a steady stream of anonymous and authenticated requests through the load balancer and confirm the removed node receives no traffic once its health check fails. Repeat with a session that was started on the removed node to confirm that session storage is truly shared (for example, in the database or a shared cache) and that the user stays signed in. Upload a file through each node and read it back through every other node to prove the shared file storage is mounted consistently. Then edit a page from each node and check that the change is visible everywhere within the cache behavior your reverse proxy and Redis or Varnish configuration define. For the database test, measure how long the application takes to reconnect after a primary failover, and note what editors see during that window, such as error pages on save, lost form input or a read-only state. Confirm the expected behavior with your database vendor and your own replication settings, because the failover timing depends on your platform, not on Drupal itself.

Finally, run a configuration sync and code deployment while synthetic traffic is present, as the deployment design intends, and watch for mixed-version responses, failed drush deploy steps or sessions broken by the code swap. Rehearse all of these in a non-production environment that matches production topology before any cutover, and keep a documented rollback path tested alongside the forward path. Agree the pass criteria with your operations and security leads in writing before the first run, so a failed test leads to a fix and a retest rather than a debate about what counted.

Access control and secrets in a multi-node Drupal stack

Once Drupal runs on several web nodes, every node becomes a place where credentials, files and admin paths can leak. The cards below cover the controls that keep a shared stack locked down, and the update process that keeps every node patched at the same time.

Keep secrets out of shared code

Database credentials, the hash salt and cache backend passwords should come from environment variables or a secret store, not from a settings.php file copied across nodes. Each node then reads its own injected values at runtime. Confirm that no secret appears in the Git repository, in build artifacts or in exported configuration, and that rotating a password requires changing one store rather than editing every node.

System requirements

Restrict write access to shared files

Public and private file directories usually sit on shared storage that several web nodes mount. Limit write access to the web process user and the deployment user, and keep the code directory read-only at runtime where your setup allows it. A compromised node with write access to shared storage can plant code that every other node will serve, so review mount options and ownership on each node.

Limit which hosts reach the database and cache

The database primary, the replica and the Redis or Memcache backend should accept connections only from the web node subnet and the deployment runner. Use security groups or firewall rules, and confirm that no database or cache port is reachable from the public edge. Ask your platform team to document which source addresses are allowed for each service and review that list when nodes are added.

Protect the private files path at the edge

The private files directory must never be served by the load balancer, the web server or Varnish. Confirm that the web server configuration denies direct requests to it and that the cache layer does not store responses for it. Test this from outside the network with a direct request to a known private file path, because a rule that works on one node may be missing on another.

Control trusted hosts and admin access

Set trusted_host_patterns in settings.php to the public hostnames only, so requests with forged Host headers are rejected on every node. Keep the admin interface and login paths behind the load balancer rules your security team has approved, such as an IP allow list or SSO gateway. Confirm that health checks and the load balancer use an internal path that does not expose administration.

Apply security releases to every node together

Drupal Security Team advisories arrive in Wednesday security release windows, and a patch applied to one node but not the others leaves the stack inconsistent. Build the update into a single deployment pipeline that rolls the same code, Composer lock file and database updates to all nodes. Subscribe to the advisory feed, record the patch date for each advisory, and confirm after each window that every node reports the same release.

Security Team process

What to monitor, back up, upgrade and document after go-live

The run work after go-live decides whether the high availability design keeps its promise. Monitoring should cover each web node's health, load balancer health checks, replication lag on the database replicas, cache hit rates on Redis or Varnish, and capacity on the shared file storage. Set alerts on lag and storage growth before they become outages, and confirm with your hosting team which metrics the platform exposes natively and which need an agent or exporter. Review cache hit rates after each release, because a deployment that changes cacheable output can quietly drop the hit rate and shift load onto the database.

Backups need three separate streams: the database, the shared files directory and the exported configuration in the sync directory. The database dump must be consistent with the file snapshot taken at the same time, so agree the order and timing with your DBA. Restore tests matter more than backup logs. Schedule a restore into an isolated environment at a fixed interval that your team sets, time it, and confirm that the site boots, that media loads and that the configuration matches the version in source control. Record the results, because auditors and incident responders will ask for them.

Upgrades should roll one web node at a time out of the load balancer, so the remaining nodes keep serving traffic. Drupal core bugfix releases arrive on the first Wednesday of each month and security releases on the third Wednesday, so plan a standing window that follows those dates and keep contributed modules in step through Composer. A major move, such as from Drupal 10 to Drupal 11, changes PHP requirements and deprecated APIs and needs its own plan, test cycle and cutover. Write a runbook that covers failover to the standby database, cache flush scope and order, and rollback to the previous code release and database state, then rehearse it. Ask your partner whether the runbook and restore results will be delivered as documentation at handover.

Questions teams ask before building Drupal high availability

How much effort does a Drupal high availability build take?

The effort depends on the written scope, not on a fixed figure. The main drivers are the number of web nodes, whether file storage is shared or moved to object storage, how the database is replicated and failed over, which external caches sit in front of Drupal (such as Redis or Varnish), how many environments need the same topology, and how much of the deployment pipeline must be built. Each of these adds design, configuration, testing and documentation work. Ask for a quote that lists each component separately, with the environments and failover tests included, so you can compare scope rather than totals.

Can our own team build Drupal high availability without a partner?

Yes, if the team has the skills and time. A build of this kind usually needs people who can administer Linux web servers, load balancers, a database cluster, shared storage and cache services, and who can work with Drupal's Composer-based project layout, Configuration Management and Drush. Someone also has to own failover testing and the upgrade path. Before deciding, list which of these skills already exist in-house, who would be on call for the topology, and whether the team can absorb the work alongside its normal duties. A partner is useful when those gaps are large or the timeline is short.

What does the client need to provide for the build?

Expect to provide four inputs. First, access to the cloud accounts, data centers or private network where the platform will run, with the permissions needed to create load balancers, instances, storage and database resources. Second, decisions on the database engine, replication model and shared storage approach, since these shape the design. Third, a named owner for the DNS, TLS certificates and identity settings. Fourth, a test window in which failover, restore and deployment rollback can be exercised without affecting users. Confirm each of these in the written scope before work starts.

Does Drupal have a license cost for a high availability setup?

No. Drupal core and contributed files hosted on Drupal.org that are derivative works of Drupal are licensed under GPL-2.0-or-later, according to the Drupal.org licensing page, and there is no paid edition of Drupal itself. The cost of a high availability setup therefore sits in infrastructure, such as servers, load balancers, database and storage services, cache services, and the people who build and run them. Check the licenses of any commercial database, load balancer, monitoring or cache product you select, since those are separate from Drupal.

Which PHP version should a high availability Drupal site target?

Target the PHP version required by the Drupal version you plan to run. According to the Drupal.org PHP requirements page, Drupal 10 requires PHP 8.1 or later and Drupal 11 requires PHP 8.3 or later. Drupal 12 requires PHP 8.5 or later, and no supported Drupal version runs on PHP 7. Because Drupal 10 reaches end of life on December 9, 2026, according to the core release schedule, a new build that will run for several years is usually better planned on Drupal 11. Confirm the PHP version your hosting images and load balancer health checks support before fixing the design.

Can DeployOpen run the upgrades and support retainer after the build?

Yes. DeployOpen offers ongoing support, upgrades and continuous testing as retainers, and most engagements are fixed-scope with scope, deliverables and timelines agreed in writing. A retainer for a high availability site would typically cover applying monthly bugfix and security releases, testing failover and restores, planning major version upgrades, and checking contributed module compatibility. Ask for the retainer scope in writing, including what is excluded, how urgent security releases are handled, and who on your side approves changes to production.

How DeployOpen scopes, builds and hands over Drupal HA

DeployOpen plans and builds self-hosted Drupal high availability inside your own cloud accounts, data centers or air-gapped networks. Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we scope

  • Map current traffic, session handling, file uploads and cache behavior to decide which parts of the stack need redundancy
  • Confirm the Drupal core version, PHP version and database engine, since these determine the replication and session options available
  • Agree in writing which environments, load balancer and storage services, and failover targets are included in the fixed scope

How we build

  • Deploy multiple web nodes behind your load balancer with shared file storage and sessions externalized from local disk
  • Configure database replication, external cache backends such as Redis or Varnish, and cache invalidation tied to Drupal cache tags
  • Set up configuration sync and a deployment pipeline so changes reach every web node in a controlled, repeatable order

How we hand over

  • Test failover of each web node, database node and cache layer, and record the results with the steps used to reproduce them
  • Document the architecture, runbooks, configuration keys and recovery steps in the form your operations team will use
  • Walk your platform and security teams through the deployed setup and the open items agreed for later phases

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, scoped separately from the build
  • Retainers can cover monthly bugfix and Wednesday security release windows and checks that high availability settings still work after updates
  • Ask any provider to confirm in writing who patches the load balancer, database and cache layers, and who owns on-call response

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.