- Consistent state across all replicas
- Statelessness of compute nodes (enables stateless Server nodes)
- Atomic
CREATE TABLE ... AS SELECT - Support for
UNDROP RENAME/moveTABLEbetween databases- Fast, reliable replica bootstrapping (decreases wake, start and provisioning times)
Migration requirements
Before the migration can begin, verify the following prerequisites:1. At least 2 Server replicas
The Operator performs a rolling upgrade to migrate databases to the new Shared database engine. Set theserver.replicas helm value to 2 or greater.
2. All databases use the Replicated engine
All databases (exceptsystem) must use the Replicated database engine. Verify with:
3. All tables use non-replicated table engines
No tables (except insystem) should use replicated or legacy table engines. Verify with:
4. No detached tables exist
5. Metadata persistent volumes are still enabled
featureFlags.disableMetadataPersistentVolumes must be false. The migration reads the existing Replicated databases from the metadata volumes of the Server pods, so those volumes have to still be in place — setting this flag to true makes the Servers stateless and removes them.
From chart version 1.1.245 onwards this flag defaults to true, so instances migrating from Database Replicated must set it explicitly:
false for the whole migration, and also while rolling back. Moving to stateless Servers is a separate change: apply it as its own Helm upgrade once the migration is verified complete.
Once all requirements are met the migration can be started. If any requirements are unmet, reach out to ClickHouse support for assistance.
Remove ON CLUSTER from DDL queries
Shared Catalog keeps all metadata in Keeper and every replica reads the same catalog, so a DDL statement already applies to the whole instance and the clause has nothing left to do. Some statements are rejected outright while it is present:
- Before (Replicated)
Other statements still run with the clause in place, so a spot check proves little. We advise you to remove
ON CLUSTER everywhere rather than only where you have seen it fail.ON CLUSTER over the last seven days, and shows which users and clients sent them:
example column before acting on a row: statements that only mention ON CLUSTER in a comment or a string literal show up too. Results are also bound by how long the log is kept, so treat this as a starting point rather than an inventory. Clients that run DDL occasionally, such as schema migrations, backup tooling and ad hoc admin scripts, still need a manual review.
Performing the migration
1. Enable Shared Catalog configuration
SetfeatureFlags.enableSharedCatalog to true in your Helm values. This enables the configuration, but doesn’t trigger the migration of databases. Deploying a ClickHouse Cluster with this flag set to true but not migrating existing replicated databases will cause the ClickHouse Cluster to fail to start.
2. Add the migration markers
SetfeatureFlags.migrateToSharedCatalog to true in your Helm values. This:
- Adds the
shared_database_catalog.migration_from_database_replicatedsetting to ClickHouse, telling it to expect existingReplicateddatabases while running in Shared Catalog mode - Adds the
clickhouse.com/start-shared-catalog-migration: "true"annotation to the ClickHouseCluster Kubernetes resource, notifying the Operator to migrate this cluster
Shared.
3. Wait for the status to be Ready
4. Remove the migration markers
Once the status is Ready, setfeatureFlags.migrateToSharedCatalog to false in your Helm values. As all databases have been migrated to type Shared instead of Replicated, the migration settings are no longer relevant.
5. Verify all databases are migrated
Confirm all non-system databases use the Shared engine:Enable stateless Servers and reclaim metadata PVCs
Once the migration is complete, you can make the Server nodes stateless by settingfeatureFlags.disableMetadataPersistentVolumes
to true in your Helm values. Server pods will start without persistent
metadata volumes and rely on the Shared Catalog and DatabaseDisk for metadata.
1. Apply the flag
Set the flag in your Helm values and upgrade the release:StatefulSets still carry
volumeClaimTemplates. The Operator logs an immutable-field warning and does
not rewrite them.
2. Recreate each Server StatefulSet, one replica at a time
Each Server replica runs in its ownStatefulSet (one Pod per StatefulSet).
For each replica, delete the StatefulSet with
--cascade=orphan
so the running Pod keeps serving traffic while the Operator recreates the
StatefulSet without volumeClaimTemplates. Once the new StatefulSet
exists, its rolling update replaces the Pod so it starts without the
metadata PVC.
List the Server StatefulSets for the cluster:
StatefulSet, delete it while keeping the Pod running:
StatefulSet and for its Pod to become
Ready before moving to the next replica:
StatefulSet has no volumeClaimTemplates:
3. Delete the orphaned PVCs
Once every Server Pod isReady without a PVC, delete the leftover
PersistentVolumeClaims:
Rollback
If any issues are encountered with the Shared Catalog, you can roll back to the previous state:1. Remove the migration markers
SetfeatureFlags.migrateToSharedCatalog to false in your Helm values.
2. Remove the Shared Catalog settings
SetfeatureFlags.enableSharedCatalog to false in your Helm values. This will trigger the Operator to revert the changes.
3. Remove the Catalog in Keeper
Port-forward a connection to Keeper and start a keeper-client session (usingclickhouse keeper-client).
Once the session is started, execute the following commands: