环境:
Os:Centos 7
clickhouse-backup:2.6.5
clickhouse:24.8.11.5
1.--data只恢复数据 不重建表,多分片的集群上备份的文件恢复到单机需要该选项
clickhouse-backup restore mybak_p1_102 -table db_test.tb_test --config=/etc/clickhouse-backup/config.yml ##第一个不加--data 否则不会创建表
clickhouse-backup restore mybak_p2_105 -table db_test.tb_test --data --config=/etc/clickhouse-backup/config.yml
clickhouse-backup restore mybak_p3_106 -table db_test.tb_test --data --config=/etc/clickhouse-backup/config.yml
2.更换表名(--restore-database-mapping两边一致):
clickhouse-backup restore mybak_p1_102 --config=/etc/clickhouse-backup/config.yml --data --restore-table-mapping=tb_test:tb_test01 --restore-database-mapping=db_test:db_test
clickhouse-backup restore mybak_p2_105 --config=/etc/clickhouse-backup/config.yml --data --restore-table-mapping=tb_test:tb_test01 --restore-database-mapping=db_test:db_test
clickhouse-backup restore mybak_p3_106 --config=/etc/clickhouse-backup/config.yml --data --restore-table-mapping=tb_test:tb_test01 --restore-database-mapping=db_test:db_test
3.更换库名和表名
clickhouse-backup restore mybak_p1_102 --config=/etc/clickhouse-backup/config.yml --data --restore-table-mapping=tb_test:tb_test01 --restore-database-mapping=db_test:db_test01
clickhouse-backup restore mybak_p2_105 --config=/etc/clickhouse-backup/config.yml --data --restore-table-mapping=tb_test:tb_test01 --restore-database-mapping=db_test:db_test01
clickhouse-backup restore mybak_p3_106 --config=/etc/clickhouse-backup/config.yml --data --restore-table-mapping=tb_test:tb_test01 --restore-database-mapping=db_test:db_test01