---
title: How do I migrate Langfuse from ClickHouse OSS to Cloud or BYOC?
seoTitle: "Migrate ClickHouse from OSS to Cloud or BYOC"
sidebarTitle: Migrate ClickHouse OSS to Cloud or BYOC
description: Keep historical traces, observations, and scores when moving a self-hosted Langfuse deployment from ClickHouse OSS to ClickHouse Cloud or BYOC.
tags: [self-hosting]
---

# How do I migrate Langfuse from ClickHouse OSS to Cloud or BYOC?

Traces, observations, and scores live in ClickHouse. Moving from self-managed ClickHouse (OSS) to [ClickHouse Cloud or BYOC](/self-hosting/deployment/infrastructure/clickhouse#cloudbyoc) is a ClickHouse deployment-model change, not a Langfuse version upgrade. Run the [latest Langfuse OSS release](/self-hosting/upgrade) first so everything works as expected, then keep that version unchanged throughout. Leave Postgres, Redis, and blob storage in place so media and event payloads continue to resolve.

Do not use Langfuse [blob storage exports](/docs/api-and-data-platform/features/export-to-blob-storage) as the restore path. Those exports are for analytics, not for recreating a ClickHouse database.

## Recommended path [#recommended-path]

1. **Run the latest Langfuse OSS release.** Upgrade first if you are not already current, then keep that version unchanged during the ClickHouse move. Provision the target Cloud or BYOC service and confirm it meets the [ClickHouse version requirements](/self-hosting/deployment/infrastructure/clickhouse) for your Langfuse release.
2. **Pause ingestion.** Scale down the Langfuse web and worker containers, or otherwise stop accepting traces, so no new rows are written during the copy.
3. **Copy the Langfuse ClickHouse database** (schema and data) with a ClickHouse-supported method:
   - [`remoteSecure`](https://clickhouse.com/docs/get-started/migrate/oss-to-cloud/clickhouse-to-cloud) — pull or push tables directly. Typical for smaller or single-node sources.
   - [`BACKUP` / `RESTORE`](https://clickhouse.com/docs/get-started/migrate/oss-to-cloud/oss-to-cloud-backup-restore) via object storage. Typical for clustered sources; Cloud restores convert `ReplicatedMergeTree` tables to `SharedMergeTree`.
4. **Point Langfuse at the new service.** Update `CLICKHOUSE_URL`, `CLICKHOUSE_MIGRATION_URL`, credentials, and SSL using the [Cloud/BYOC connection settings](/self-hosting/deployment/infrastructure/clickhouse#cloudbyoc). Grant the [required user permissions](/self-hosting/deployment/infrastructure/clickhouse#user-permissions) on the new service, and keep ClickHouse on [UTC](/self-hosting/deployment/infrastructure/clickhouse#timezones).
5. **Resume ingestion** and confirm historic traces, observations, and scores in the UI.

## Upgrading Langfuse at the same time [#upgrading-langfuse]

Treat the ClickHouse move and a Langfuse major-version upgrade as separate steps.

## Zero-downtime cutovers [#zero-downtime]

A live dual-write cutover is theoretically possible but is not the recommended path and has not been validated for Langfuse. Plan for a pause of ingestion. Contact [support](/support) if you need to discuss a custom approach.

<!-- agent-instructions -->

---

## Agent Instructions

This page is part of the [Langfuse](https://langfuse.com) documentation, published as plain Markdown for AI agents. Every page is available as Markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` header. This page: `https://langfuse.com/faq/all/self-hosting-migrate-clickhouse-oss-to-cloud.md`.

### Querying these docs

If the answer is not on this page, query the documentation instead of guessing:

- **Semantic search** across all Langfuse docs, returning an answer with the relevant pages and excerpts. Ask a specific, self-contained question:

  ```bash
  curl -sG "https://langfuse.com/api/search-docs" --data-urlencode "query=How do I trace a LangGraph agent?"
  ```

- **Index of every page**: <https://langfuse.com/llms.txt>, with per-section indexes [llms-docs.txt](https://langfuse.com/llms-docs.txt), [llms-integrations.txt](https://langfuse.com/llms-integrations.txt), and [llms-self-hosting.txt](https://langfuse.com/llms-self-hosting.txt).

### Before writing Langfuse code

- **Install the [Langfuse Agent Skill](https://langfuse.com/docs/api-and-data-platform/features/agent-skill).** It encodes Langfuse's own best practices for instrumentation, prompt management, and evaluation, and materially improves results.
- **Read [What does a good trace look like?](https://langfuse.com/docs/observability/best-practices.md)** before instrumenting an application.
- **Verify endpoints, parameters, and response fields** against the [API reference](https://api.reference.langfuse.com) instead of inferring them from code examples.
- **Use the [Langfuse CLI](https://langfuse.com/docs/api-and-data-platform/features/cli)** (`npx langfuse-cli api <resource> <action>`) to read or write traces, prompts, datasets, and scores from the terminal.

Found an error in these docs? Please open an issue at <https://github.com/langfuse/langfuse-docs/issues>.
