Migrating Keycloak multi-cluster v1 to v2

Retiring the external Infinispan cluster of a Keycloak multi-cluster v1 deployment, with the documented path to v2, the backups to take first and a failover test plan.

On this page

Why a Keycloak multi-cluster v1 to v2 migration starts with a plan, not a switch

If your team runs the deprecated multi-site v1 design, with a separate Infinispan cluster in each site, the move means retiring that Infinispan layer and running Keycloak on the stateless feature instead. How much work that takes depends on your topology, your database setup and how well your current deployment is tested, so the first deliverable is an inventory and a plan, not a cutover window.

Keycloak 26.8 upgrade notes recommend moving away from the deprecated multi-site feature, and the upgrading guide points to the stateless feature as the successor. The stateless feature is supported but disabled by default, so you must enable it explicitly with --features=stateless as part of your configuration. Read the Keycloak upgrading guide against your exact target version before you change anything, because the notes list every behavior change you will meet at the same time as the topology change.

Start by listing what the v1 setup depends on: the per-site Infinispan clusters, the cross-site connection between them, the synchronously replicated database, the load balancer and health probes, and every site-specific setting in your deployment code. Confirm with your own Keycloak and Infinispan configuration which of these your team owns and which were set by an earlier platform team. This list decides which tests you need and who signs off each step. This section gives no price or duration because the supplied facts do not include either, so ask any partner for a written scope that follows from this inventory.

What maps from v1 to v2 and what needs new design

This table compares each v1 building block, such as the per-site Infinispan cluster, cross-site replication and session handling, with its v2 counterpart or the change it requires. Rows marked as carrying over keep their data and configuration, while rows marked for redesign need new settings or a new operating model. Confirm each mapping against the Keycloak multi-cluster v2 guide and the 26.8 upgrade notes before you plan the cutover.

Componentv1 designv2 counterpart or changeStatus
Realms, clients and usersStored in the shared external databaseStored in the same database, no re-import expected from the v1 guideCarries over, confirm in v2 guide
DatabaseSynchronously replicated database shared by both sitesStill required as a synchronously replicated databaseCarries over, verify replication mode
Per-site Infinispan clusterSeparate external Infinispan cluster in each siteRemoved, no external Infinispan cluster in v2Retired
Cross-site replicationInfinispan cross-site backups between site clustersReplaced by the stateless design, cross-site state handled through the databaseNeeds redesign
Site-level cachesDistributed caches tuned per siteLocal caches only, cache settings no longer map one to oneNeeds redesign
Session handlingSessions replicated through the Infinispan clustersSession state moves to the stateless model, so failover behavior changesNeeds redesign, test failover
Global load balancer and health probesRoutes users to the active site using site healthProbes and failover order must match the v2 health endpoints and site behaviorNeeds review
Feature flagmulti-site:v1 enabled and deprecatedEnable stateless:v1 explicitly with --features=statelessNeeds change

Which backups to take before touching the cluster

This sequence captures every part of the v1 deployment that a restore would need, and proves that a restore works on a separate environment before any change reaches production.

  1. Inventory the current v1 deployment

    The platform team lists every component of the multi-site v1 setup: the Keycloak version and distribution, the startup options and features enabled, the separate Infinispan cluster per site and its configuration, the load balancer and DNS entries, and the database endpoints for each site. Record the exact Keycloak version currently running, since the 26.8 upgrade notes apply to the target version and the migration path depends on what is already deployed. The output is a written inventory signed off by the owner of each component, stored alongside the change record.

  2. Back up the database

    The database team takes a full backup of the Keycloak database using the mechanism the database product documents for its production setup, and confirms that the backup can be read back. Keycloak keeps realms, users, clients and most runtime state in the database, so this backup is the primary recovery source. Confirm the backup scope covers every schema Keycloak uses, and record the backup identifier, timestamp and location. The step is done when a restore of the backup has been verified in a separate environment, not only when the backup job reports success.

  3. Export the configuration as code and realm data

    The team exports realm configuration, clients and identity provider settings using the export tooling that matches the running version, and stores the output in version control or a protected repository. A realm export is useful for review and partial rebuilds, but it is not a full backup: it does not replace the database, and it can omit secrets, sessions and some runtime state. Treat it as a complement to the database backup. The output is a versioned export per realm with a record of which Keycloak version produced it.

  4. Capture custom providers, themes and the container images

    The engineers collect every custom SPI provider JAR, theme directory, and custom configuration file, along with the exact container image tags or distribution archives used by each node. These artifacts must be retrievable to rebuild the same runtime on the target version, because a restore onto a different build can fail or behave differently. Store checksums with the artifacts. The check is that a clean build from the stored artifacts starts a node that matches the running one for configuration and theme output.

  5. Record the current Keycloak and Infinispan settings

    The team saves the effective startup configuration, environment variables, secrets references (not secret values), and the Infinispan configuration for each site, including cache definitions, cluster discovery settings and the cross-site replication setup. These settings define how the v1 sites exchange state, so the team needs them to explain and verify what the external Infinispan clusters contributed. The output is a settings record per node and per site, reviewed by someone who did not write it.

  6. Restore the backup into a separate test environment

    The team restores the database backup and the configuration artifacts into an isolated environment that mirrors the production topology as closely as practical. They start Keycloak from the restored data, confirm that realms, clients, users and identity providers load, and log in with test accounts. A restore that has not been run and checked in a separate environment is not a tested backup. The step is complete when the restored environment passes the login and admin checks and the results are recorded.

  7. Approve the cutover only after the restore test

    The change owner reviews the inventory, backup identifiers, export records, artifact checksums and restore test results together, and records whether recovery met the organization's own recovery point and recovery time objectives. Those objectives must come from the business owner of the identity service, since no figures are set by this guidance. The cutover proceeds only with a signed approval that names the backup set and the tested restore. The output is that approval, linked to the change ticket.

How the v1 sites move to v2 in phases

The flow starts with each site running multi-site v1, with its own external Infinispan cluster and a shared synchronously replicated database. Before any change, the team takes backups and rehearses a restore, then enables the stateless feature with --features=stateless on a staging copy. One site is migrated and checked against the shared database and load balancer routing before the next site follows. The final phase is cutover, followed by removal of the external Infinispan clusters. At each hand-off, confirm that failover still works, since the sites depend on one database.

Phased path from multi-site v1 to stateless v2 with checkpoints at each site.

The migration sequence with a parallel run and cutover

The sequence moves a v1 multi-site Keycloak onto the stateless v2 design in stages, so each change has a rollback point and the team holds evidence that the new design fails over before the old Infinispan clusters are retired.

  1. Inventory sites, features and custom providers

    The platform team lists every Keycloak site, node count, database, external Infinispan cluster, realm, client, identity provider and federation link, along with each custom SPI provider, theme and startup flag that relies on the multi-site feature. Inventory the feature flags in use, including the explicit enabling of multi-site:v1. The step is done when every site and custom component has an owner and a documented version, and when the team can state which items must change before the move. Keep this inventory as the baseline for every later check.

  2. Back up the database and configuration first

    Before any change, the operator takes and verifies a database backup, exports configuration, and archives custom providers, themes and deployment manifests for every site. The backup is only useful once a restore has been tested on a separate environment, so the team records the restore result alongside the backup identifier. The step is complete when the backup set is stored outside the clusters being changed and a restore to a scratch environment has succeeded. This is the first rollback point, and it should be kept until the decommissioning step is signed off.

  3. Rehearse the migration on a production data copy

    The team restores a recent copy of production data into a non-production environment that mirrors the v1 topology, then runs the documented v1 to v2 migration path against it. They record every configuration change, startup warning, schema or cache behavior that differs from expectations, and the time each step takes in that environment. Any deviation from the runbook becomes a documented change before the pilot starts. The rehearsal is done when a full run completes cleanly twice from the same starting data, and the team can repeat the steps without ad hoc fixes.

  4. Pilot the move on one site

    The team migrates a single site that carries limited, well-understood traffic, with the external Infinispan cluster for that site kept running but out of the request path. The operator watches login success rates, token issuance, session behavior, error logs and database load against the baseline from the inventory. Rollback means returning that site to the v1 configuration, which remains intact until the pilot is accepted. The pilot is done when the site has run through its normal traffic pattern with no unexplained errors, and the rollback steps have been executed once in a test window.

  5. Run both designs in parallel

    The remaining sites keep the v1 design while the migrated site serves its share, and both designs stay reachable so traffic can move back if needed. The team compares authentication results, session state after node restarts, and failover behavior between the two designs using the same test scripts. Operators confirm that the global load balancer health probes and clock settings behave the same on every site. The parallel run closes when the metrics for both designs have been reviewed against the baseline and the team has a written list of unresolved differences with owners.

  6. Cut over traffic to the new design

    The team moves traffic site by site, starting with the site that has the cleanest pilot results, and confirms after each change that the target site handles its load within the limits seen during the parallel run. Each cutover is recorded with the timestamp, the configuration version and the person who approved it. The last rollback point for each site is the v1 configuration kept in place until the cutover is accepted. The step is complete when all traffic is served by the v2 design and no site depends on the old Infinispan clusters for request handling.

  7. Test failover after the move

    Before retiring anything, the team runs planned failover tests: stopping nodes, isolating a site, and forcing a database switchover in a controlled window, while recording login and token results. The test results are compared with the failover expectations documented for the stateless design and with the recovery objectives the organization has set. Any gap found here is fixed and retested before the old clusters are touched. The step is done when each failover scenario has a dated result, a pass or documented exception, and a named approver.

  8. Decommission Infinispan and document the result

    Once failover tests pass and the rollback window is closed by the change owner, the team shuts down the external Infinispan clusters, removes their configuration and retires the multi-site:v1 flag from every node. The final documentation covers the new topology, the backup and restore records, the cutover log, the failover test results and the open items list. Keep the decommissioning evidence and the pre-migration backups under the organization's retention policy, so auditors and future operators can trace each change. The sequence is complete when the documentation is reviewed and the old clusters no longer appear in monitoring or inventory.

How to test failover after the move to v2

Run the failover tests against the target v2 environment after cutover, not against the old v1 setup, and record every result with the date, the Keycloak version, the topology and the observed behavior. The first test is a single node loss inside one cluster: stop one Keycloak pod or node while a login and token refresh load runs, then confirm that the load balancer stops routing to it, that existing sessions continue where the design says they should, and that the surviving nodes take the traffic without errors that the business cannot accept. Repeat the test under the load you expect at peak, because a test at idle proves little about a live identity service.

The second test removes an entire site or cluster, which is the case the v1 to v2 move changes most. Because v2 no longer depends on a separate Infinispan cluster per site, confirm that the remaining cluster serves logins without that peer, and that the global load balancer health probes mark the failed site unhealthy within the window your design targets. The database is the critical dependency: both supported designs require a synchronously replicated database, so test the switchover your platform performs, such as a promotion of a standby or a managed failover, and verify that Keycloak reconnects and that no committed writes are lost. Confirm the exact switchover behavior, and the recovery objectives it implies, with your database vendor and your own runbook rather than assumptions.

Include the load balancer and session behavior in the same test pass. Check the health check endpoints on the management interface, confirm that failed nodes are removed and returned to rotation correctly, and verify that users who were mid-flow during a failure either recover cleanly or sign in again as your policy expects. Confirm the session and token lifetime settings you rely on, and make sure the clock on every node and site is synchronized, since token validation and session expiry depend on it. Set pass criteria in writing before the test, and agree who signs off the results. Keep the recorded evidence with your change records, because it is the proof your operations and compliance teams will ask for after the move.

How long a v1 to v2 migration takes and what it costs

How much does a Keycloak multi-cluster v1 to v2 migration cost?

No published price or fee applies to this migration, and DeployOpen does not publish a price list, so the cost comes from a written scope. The main cost components are the people who plan the topology change, rebuild the deployment, run the database and cache work, and test failover. Cost rises with the number of clusters, the number of custom providers or themes that must be retested, the database platform and the number of environments that need the change. Ask for a quote that separates one-time migration work from any recurring support or retainer you choose.

How long does a v1 to v2 Keycloak migration take?

No duration is fixed by the supplied sources, so the timeline depends on your topology and change calendar. The work runs in stages: documenting the current sites, taking backups, moving the deployment to the stateless feature, validating each site and testing failover. Each stage depends on the one before it, and production work usually waits for approved change windows. Ask for a timeline in the written scope that names the environments, the test cycles and the window dates you need to hit.

What drives the effort of retiring the external Infinispan cluster?

Effort is driven mainly by how many sites run v1 and how much they differ from each other. Key factors include the number of Keycloak clusters, the size of the external Infinispan deployment, custom SPI providers and themes, the database platform and its replication setup, and the monitoring and load balancer rules tied to each site. Teams with consistent builds and good documentation spend less time than teams that must reconstruct the design first. Confirm these factors in your own environment before you request a quote.

What must our team provide before a migration starts?

You must provide current topology documentation, access to every cluster, database and load balancer involved, and named owners who can approve changes. Your team should also supply the Keycloak version and configuration files in use, a list of custom providers, and the expected login and token traffic. Plan staff time for testing, because someone who knows your applications must confirm sign-in, token issuance and logout after each step. Missing inputs are the most common reason a migration schedule slips.

What approvals and change windows does a production migration need?

Production changes need written approval from the teams that own identity, the databases and the network, and they usually need a scheduled maintenance window. Your change process will likely require a rollback plan, a tested backup and a named decision-maker for go or no-go. Confirm your approval path and blackout dates early, because a single identity service that many applications depend on often needs more review than a typical application change.

Can our internal team perform the v1 to v2 migration without a partner?

Yes, an internal team can do this if it has experience operating Keycloak clusters, the database and the load balancer, and if it can run a full failover test. The official migration path is documented by the Keycloak project, so the work is mostly careful execution and verification rather than new design. Assess whether your team has spare capacity for planning, a test environment that matches production and people available during the change window. Many teams choose a partner for the parts they have not run before, such as failover testing.

What should we check to decide between our own team and a partner?

Compare your team's experience with clustered Keycloak, your database replication design and your test capacity against the scope you need. Ask whether you have a staging environment that mirrors production, whether backups have been restored successfully before, and who will run the failover tests after the move. A partner is worth requesting a quote from when these gaps are visible. Ask any provider for a written scope that lists deliverables, environments, testing and what you are responsible for.

What does a written scope for this migration need to include?

A written scope should list the clusters and environments in scope, the backups to take, the steps for moving to the stateless feature, the validation tests and the failover test plan. It should also name deliverables such as updated runbooks, the test results and the handover, plus the client responsibilities listed above. Ask for assumptions about database platform, custom providers and change windows, and ask what happens if a step fails. Use that scope to compare quotes on equal terms.

What drives the cost and duration of the move

This table lists the factors that change the effort of moving a v1 multi-site Keycloak off its external Infinispan clusters. Read each row for the direction of impact and the question to put to a partner before accepting a quote. The main takeaway is that site count, custom code and the database replication setup usually matter more than the feature switch itself.

DriverEffect on cost and durationWhat to ask for in a quote
Number of sites and clustersMore sites and clusters mean more nodes to reconfigure, more cutover steps and more failover tests. Effort rises with each site added.Itemized work per site, the cluster count in scope, and whether each site is cut over separately.
Custom SPI providers and themesCustom providers must be rebuilt or retested against the target release. Each custom component adds compatibility checks and regression testing.An inventory of providers and themes, the test plan for each, and who owns fixes if a provider breaks.
Database platform and replicationThe database must be synchronously replicated for both supported designs. Moving to a new replication setup or a platform with less tooling adds work and risk.Confirmation of the database engine and version, the replication mode in use, and whether backups and restore tests are included.
Deployment method (Operator or manual)Operator-managed deployments need custom resource changes and manual approval settings. Manual deployments need hand-written configuration and more verification steps.Which deployment method is assumed, the configuration changes listed, and how the Operator update approval mode is handled.
Test coverage and environmentsA staging environment that mirrors production shortens the work. Missing staging, or no load or failover test history, extends the schedule.Whether a staging environment is included or must be provided, the failover test scope, and the test evidence delivered.
Change window and availability constraintsTight maintenance windows or a requirement for zero interruption add rehearsal, rollback planning and off-hours work, which raises effort.The approved change windows, the rollback plan and rehearsal count, and any out-of-hours rates or staffing assumed.
Recurring work after the moveMonitoring, patching and failover drills continue after cutover. These are recurring costs that depend on support scope.Whether ongoing support is quoted separately, the drill frequency assumed, and what is covered by a retainer.

What usually goes wrong in a multi-cluster migration

Retiring the external Infinispan cluster changes how sessions, caches and failover behave, and each risk below is easier to prevent before the cutover than to diagnose during an outage. The checks cover backups, replication assumptions, parallel running and the configuration that never made it into documentation.

Skipping the restore test

A backup that has never been restored is an assumption, not a recovery plan. Before the move, restore the database and configuration into a separate environment and confirm that a Keycloak node starts against it and that a test login succeeds. Record how long the restore took, because that figure is the one you will need during an incident. Keep realm exports out of the definition of a backup, since they do not carry everything a running node needs.

Missing cache and session behavior changes

Moving from multi-site v1 to the stateless feature changes where cached state and sessions live. Users may be signed out at cutover, and some cache-dependent behavior may differ from what your team observed under v1. Review the 26.8 upgrade notes and test session expiry, logout and token refresh in a staging environment that mirrors your two-site topology.

Keycloak upgrading guide

Assuming synchronous database replication

Both supported high availability designs depend on a synchronously replicated database, and a v1 deployment may have been built on an assumption that was never verified. Ask the database owner to show the replication mode, the commit behavior across sites and the failover procedure in writing. If the database replicates asynchronously, the migration plan must change before any node is moved.

Removing Infinispan before the parallel run

Decommissioning the external Infinispan cluster is the step that cannot be undone quickly. Run the v2 deployment alongside v1 long enough to see real login, token and failover traffic succeed, and keep the Infinispan cluster available until that evidence exists. Define the exit criteria in the runbook before the parallel run starts, so the cutover decision rests on agreed measures rather than on the calendar.

Clock drift between sites

Token validation, session timestamps and replication ordering all depend on consistent time across sites. A drifting clock can cause tokens to be rejected early or accepted late, and the symptom often looks like an intermittent login failure. Confirm that every node at both sites synchronizes to trusted time sources and monitor offset as part of the post-migration checks.

Undocumented custom configuration

Startup options, custom providers, themes and load balancer settings added over time are often missing from the deployment repository. Inventory every configuration key, environment variable, mounted file and deployed provider on both sites before the move, and compare the result with what the running nodes report. Anything that cannot be explained should be resolved before the migration, not after it.

What your team must provide for the migration

The migration starts with a complete configuration inventory of the current v1 deployment. Your team should provide the Keycloak version running on each site, the startup options and feature flags in use (including --features=multi-site), the cache-remote-* or Infinispan settings that connect each site to its external Infinispan cluster, the database connection details, and the load balancer and DNS routing that sends users to each site. Confirm the exact Keycloak version per site before work is scoped, because the upgrade path depends on it. Also list every custom provider, theme and deployment manifest, since these must be carried into the v2 configuration.

Access and ownership are the next requirements. The migration needs read access to the shared database and rights to take and restore backups, so that a verified copy exists before any change. Name one accountable owner for each site, plus a contact for the database, the network and the external Infinispan cluster, who can make decisions during the work. Provide at least one non-production environment that mirrors the v1 topology closely enough to rehearse the change and the failover tests. Confirm with your platform team whether that environment can use the same database engine and site layout as production.

Finally, your organization must approve the cutover windows in writing, including who can declare a rollback and the conditions that trigger one. Ask your change advisory board to agree on the maintenance periods, the sign-in traffic expected in each window and the communication plan for users and dependent applications. Plan for a documented failover test on the migrated sites before the windows close. The exact steps for the change and the rollback path should be confirmed against the Keycloak upgrading guide for your target release, not assumed from older documentation.

How DeployOpen scopes and delivers a Keycloak v1 to v2 migration

DeployOpen treats the move from multi-cluster v1 to v2 as a planned change to a running identity service, not a configuration tweak. We scope the work in writing, build and rehearse it in a non-production copy of your environment, and hand over the runbooks and failover evidence your operations and security teams need.

How we scope

  • Inventory every site, Infinispan cluster, database, load balancer and feature flag currently in use by the v1 deployment.
  • Confirm the Keycloak version in use and the upgrade path to the release that supports the stateless feature.
  • Agree in writing which backups, rehearsals, failover tests and change windows the fixed-scope engagement includes.

How we build

  • Take and verify backups of the database and configuration before any node or feature flag changes.
  • Rehearse the switch from the deprecated multi-site feature to stateless in a staging copy that matches production topology.
  • Run failover tests across sites after the move, recording login, token refresh and database failover results.

How we hand over

  • Deliver the migration runbook, rollback steps and the exact configuration changes made in your environment.
  • Document the post-migration failover test scripts, expected results and the evidence each test produces.
  • Walk your platform, security and compliance teams through the changes so they can review them independently.

How we support

  • Offer ongoing support, upgrades and continuous testing for the migrated deployment as a retainer.
  • Retest failover after Keycloak upgrades or database changes, so the documented recovery steps stay accurate.
  • Keep runbooks current with your environment and agree update ownership between your team and DeployOpen.

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.