Skip to content

docs: add ClickHouse backup and restore guide#761

Open
zlcnju wants to merge 4 commits into
mainfrom
docs/clickhouse-backup-restore
Open

docs: add ClickHouse backup and restore guide#761
zlcnju wants to merge 4 commits into
mainfrom
docs/clickhouse-backup-restore

Conversation

@zlcnju
Copy link
Copy Markdown
Collaborator

@zlcnju zlcnju commented May 14, 2026

Summary

  • Add a ClickHouse backup and restore solution using clickhouse-backup as a sidecar.
  • Document the validated shared /var/lib/clickhouse data volume requirement to avoid metadata-only backups.
  • Include manual backup, CronJob, restore Job, validation, and troubleshooting steps.

Test plan

  • Validated clickhouse-backup create_remote uploads metadata and MergeTree data part archives to S3-compatible storage.
  • Validated system.backup_actions can trigger create_remote <backup-name>.
  • Validated clickhouse-backup restore_remote <backup-name> restores data into a separate ClickHouseInstallation.
  • Confirmed restored events_local and events tables both return 1000 rows.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive end-to-end guide for backing up and restoring ClickHouse on Alauda Container Platform 4.3.x using the clickhouse-backup sidecar and S3-compatible storage. Includes setup steps, configuration for sidecar integration, manual and automated backup/restore workflows, verification checks, troubleshooting common failure modes, and a validation checklist.

Review Change Stack

Document the validated clickhouse-backup sidecar workflow so operators can back up and restore ClickHouse data with S3-compatible storage.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Warning

Rate limit exceeded

@zlcnju has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 52 minutes and 23 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b61efdb9-8412-4e2a-8683-ab50d60eb520

📥 Commits

Reviewing files that changed from the base of the PR and between 5fe6d02 and 1583256.

📒 Files selected for processing (1)
  • docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md

Walkthrough

Adds a detailed, end-to-end guide for backing up and restoring ClickHouse on ACP 4.3.x using a clickhouse-backup sidecar with S3-compatible storage, including manifests, manual and automated backup/restore workflows, verification commands, troubleshooting, and validation notes.

Changes

ClickHouse Backup and Restore Guide

Layer / File(s) Summary
Intro and prerequisites
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
Document header, sidecar overview, required S3 variables, and namespace/Secret creation steps.
Source ClickHouse deployment with sidecar
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
clickhouse-source.yaml pod template running clickhouse + clickhouse-backup, shared /var/lib/clickhouse volume, and pod readiness checks; backup integration table validation.
Create test tables and validate integration
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
Create MergeTree and Distributed test tables, insert/verify rows, and check active data parts and system.backup_* tables.
Manual backup and S3 verification
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
Manual create_remote workflow, backup listing, and S3 object expectations (metadata and shadow/...tar archives).
Automated backups via Job/CronJob
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
Kubernetes Job and CronJob examples invoking system.backup_actions, polling for completion, and failing on non-success.
Restore into separate installation
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
Create a restore ClickHouseInstallation, restore_remote steps, optional restore Job via system.backup_actions, and job verification.
Verify restored tables and data
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
Commands to check restored events_local and events existence and row counts.
Troubleshooting and diagnostics
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
Diagnostic commands and explanations for common failure modes (pod template, volume mounts, missing integration tables, distributed-schema-only behavior, S3 config mismatches).
Validation results and related notes
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md
Validation checklist for ACP 4.3 with altinity/clickhouse-backup:2.6.3 and related operational notes about MergeTree scope and multi-shard handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hop through docs with backup cheer,
Mount the volumes, keep data near,
Trigger create, then verify,
Restore it back — no need to sigh,
Safe in S3, our bytes appear.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: add ClickHouse backup and restore guide' directly and clearly summarizes the main change: adding documentation for ClickHouse backup and restore functionality. It is concise, specific, and accurately reflects the primary purpose of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/clickhouse-backup-restore

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md (2)

108-109: 💤 Low value

Consider documenting when ALLOW_EMPTY_BACKUPS should be enabled.

Setting ALLOW_EMPTY_BACKUPS: "true" allows backups to succeed even when no data is present. This can be useful for initial setup or testing, but may mask configuration issues in production where data is expected. Consider adding a note about when this setting should be enabled versus disabled.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md`
around lines 108 - 109, Add a brief explanatory note next to the
ALLOW_EMPTY_BACKUPS environment variable describing when to enable it: state
that ALLOW_EMPTY_BACKUPS="true" permits backups to succeed with no data (useful
for initial setup, CI/testing, or templates), but that it can mask issues in
production where data is expected and therefore should generally be false in
production; update the documentation section that contains the
ALLOW_EMPTY_BACKUPS YAML snippet and include this guidance and a recommendation
to default to "false" for production environments.

460-460: 💤 Low value

Clarify the file reference for the restore Job manifest.

Line 460 references clickhouse-restore-job.yaml, but the YAML manifest in lines 416-455 was shown inline without a filename. For consistency with Step 5 (which shows clickhouse-backup-job.yaml on line 273), consider adding "Create clickhouse-restore-job.yaml." before the YAML block in Step 8.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md`
at line 460, Add an explicit filename heading before the inline restore Job
manifest in Step 8 so it matches the later kubectl apply command: insert a short
line like "Create `clickhouse-restore-job.yaml`." immediately before the YAML
block that defines the restore Job (the manifest referenced by kubectl apply -f
clickhouse-restore-job.yaml), mirroring the style used for
`clickhouse-backup-job.yaml` in Step 5 to keep the documentation consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md`:
- Around line 132-133: Add a security note next to the S3_DISABLE_SSL
environment variable entry (S3_DISABLE_SSL) explaining that setting it to "true"
disables SSL and causes backups to be transmitted unencrypted, that this is
acceptable only for local testing or trusted isolated networks, and that in
production or across untrusted/external networks it should be set to "false" (or
omitted) and proper TLS configured; keep the note concise and position it
immediately after the S3_DISABLE_SSL value example so readers see the warning
inline with the configuration.
- Line 437: The YAML shows a placeholder value: `value: <backup-name>` which
must be replaced before applying; update the doc to instruct users to substitute
`<backup-name>` with the real backup name (e.g., from Step 4/5), and provide a
short example workflow such as saving the manifest as
`clickhouse-restore-job.yaml` and replacing the placeholder either manually,
with `sed` (e.g., `sed -i 's/<backup-name>/$BACKUP_NAME/'
clickhouse-restore-job.yaml`), or by demonstrating environment variable
substitution (set `BACKUP_NAME` and use `${BACKUP_NAME}` for the
`RESTORE_BACKUP` env entry) so users can apply the manifest safely.
- Around line 126-129: Replace the plain-text env vars S3_ACCESS_KEY and
S3_SECRET_KEY with references to a Kubernetes Secret: create a Secret (e.g.,
clickhouse-s3-creds) containing the access and secret keys and update the
Deployment/Pod manifest to use valueFrom.secretKeyRef for S3_ACCESS_KEY and
S3_SECRET_KEY so credentials are pulled from the Secret rather than hardcoded in
the manifest.

---

Nitpick comments:
In
`@docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md`:
- Around line 108-109: Add a brief explanatory note next to the
ALLOW_EMPTY_BACKUPS environment variable describing when to enable it: state
that ALLOW_EMPTY_BACKUPS="true" permits backups to succeed with no data (useful
for initial setup, CI/testing, or templates), but that it can mask issues in
production where data is expected and therefore should generally be false in
production; update the documentation section that contains the
ALLOW_EMPTY_BACKUPS YAML snippet and include this guidance and a recommendation
to default to "false" for production environments.
- Line 460: Add an explicit filename heading before the inline restore Job
manifest in Step 8 so it matches the later kubectl apply command: insert a short
line like "Create `clickhouse-restore-job.yaml`." immediately before the YAML
block that defines the restore Job (the manifest referenced by kubectl apply -f
clickhouse-restore-job.yaml), mirroring the style used for
`clickhouse-backup-job.yaml` in Step 5 to keep the documentation consistent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 737f22f4-b743-4542-a9f6-38515caff187

📥 Commits

Reviewing files that changed from the base of the PR and between 3c5a36b and 62981d4.

📒 Files selected for processing (1)
  • docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md

Comment thread docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md Outdated
Comment thread docs/en/solutions/How_to_Backup_and_Restore_ClickHouse_with_clickhouse_backup.md Outdated
Align the article with the knowledge base How To template by replacing solution-specific sections with Purpose, Resolution, Troubleshooting, and Related Information.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Use placeholders for resource names and namespaces, move S3 credentials into a Secret reference, and clarify backup and restore configuration notes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Use environment-variable templates for the ClickHouse backup manifests so users can render them directly while preserving runtime variables inside Job scripts.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant