How to restore a replica after storage failure
This article explains how to recover data when using replicated tables in atomic databases in ClickHouse and disks/storage on one of the replica is lost/currupted.
Copy access configuration from the healthy replica
Copy the contents of the access folder which contains local users from the healthy replica:
Back up the metadata folder from the healthy replica
- Navigate to the ClickHouse data directory:
- Create a backup of the metadata folder (including symbolic links): The metadata directory contains DDLs for databases and tables.
The database directory has symlinks to
/var/lib/clickhouse/store/..which contains all the table DDLs.
Note
This command ensures that both the metadata files, and the symlink architecture are preserved in the backup.
Restore the metadata on the faulty replica
- Copy the generated
backup.tarfile to the faulty replica. - Extract it to the ClickHouse data directory:
Create the force restore flag
To trigger automatic data synchronization from other replicas, create the following flag:
Restart the faulty replica
- Restart the ClickHouse server on the faulty node.
- Check the server logs, you should observe parts being downloaded from the healthy replicas:
· 2 min read