欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > Clickhouse备份恢复_clickhouse-client方式backup命令之备份目录的设置

Clickhouse备份恢复_clickhouse-client方式backup命令之备份目录的设置

2024/11/30 4:45:40 来源:https://blog.csdn.net/lusklusklusk/article/details/139829588  浏览:    关键词:Clickhouse备份恢复_clickhouse-client方式backup命令之备份目录的设置

https://clickhouse.com/docs/en/operations/backup#command-summary

想要backup database dbname to Disk(‘diskname’,‘backupfilename.zip’)成功的话,需要符合3点
1、diskname需要在/etc/clickhouse-server/config.d/backup_disk.xml在<storage_configuration></storage_configuration>中存在
2、diskname需要在/etc/clickhouse-server/config.d/backup_disk.xml在<allowed_disk></allowed_disk>中存在
3、diskname需要在select name,path,type from system.disks结果集中存在

案例1、备份目录配置及备份状况

[root@CHDBDEV ~]# cat /etc/clickhouse-server/config.d/backup_disk.xml
<clickhouse><storage_configuration><disks><backups><type>local</type><path>/backups/123/</path></backups></disks></storage_configuration><backups><allowed_disk>baks</allowed_disk><allowed_path>/backups/345/</allowed_path></backups>
</clickhouse>CHDBDEV :) select name,path,type,is_read_only,is_write_once,is_remote,is_broken from system.disks;┌─name────┬─path─────────────────────┬─type──┬─is_read_only─┬─is_write_once─┬─is_remote─┬─is_broken─┐
1. │ backups │ /backups/123/Local00002.default/chdata/clickhouse/data/Local0000 │└─────────┴──────────────────────────┴───────┴──────────────┴───────────────┴───────────┴───────────┘CHDBDEV :) backup database lukestest1 to Disk('backups','lukestest1_2024.zip');
Received exception from server (version 24.4.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Disk ''backups'' is not allowed for backups, see the 'backups.allowed_disk' configuration parameter. (BAD_ARGUMENTS)CHDBDEV :) backup database lukestest1 to Disk('default','lukestest1_2024.zip');
Received exception from server (version 24.4.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Disk ''default'' is not allowed for backups, see the 'backups.allowed_disk' configuration parameter. (BAD_ARGUMENTS)

案例2、备份目录配置及备份状况

[root@CHDBDEV ~]# cat /etc/clickhouse-server/config.d/backup_disk.xml
<clickhouse><storage_configuration><disks><backups><type>local</type><path>/backups/123/</path></backups></disks></storage_configuration><backups><allowed_disk>backups</allowed_disk><allowed_path>/backups/123/</allowed_path></backups>
</clickhouse>CHDBDEV :) select name,path,type,is_read_only,is_write_once,is_remote,is_broken from system.disks;┌─name────┬─path─────────────────────┬─type──┬─is_read_only─┬─is_write_once─┬─is_remote─┬─is_broken─┐
1. │ backups │ /backups/123/Local00002.default/chdata/clickhouse/data/Local0000 │└─────────┴──────────────────────────┴───────┴──────────────┴───────────────┴───────────┴───────────┘CHDBDEV :) backup database lukestest1 to Disk('backups','lukestest1_2024.zip');┌─id───────────────────────────────────┬─status─────────┐
1.803d8178-49fe-4f82-bf82-b70881496f0e │ BACKUP_CREATED │└──────────────────────────────────────┴────────────────┘CHDBDEV :) backup database lukestest1 to Disk('default','lukestest1_2024.zip');
Received exception from server (version 24.4.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Disk ''default'' is not allowed for backups, see the 'backups.allowed_disk' configuration parameter. (BAD_ARGUMENTS)

案例3、备份目录配置及备份状况

[root@CHDBDEV ~]# cat /etc/clickhouse-server/config.d/backup_disk.xml
<clickhouse><storage_configuration><disks><backups><type>local</type><path>/backups/123/</path></backups></disks></storage_configuration><backups><allowed_disk>backups</allowed_disk><allowed_path>/backups/123/</allowed_path></backups><backups><allowed_disk>default</allowed_disk><allowed_path>/chdata/clickhouse/data/</allowed_path></backups>
</clickhouse>CHDBDEV :) select name,path,type,is_read_only,is_write_once,is_remote,is_broken from system.disks;┌─name────┬─path─────────────────────┬─type──┬─is_read_only─┬─is_write_once─┬─is_remote─┬─is_broken─┐
1. │ backups │ /backups/123/Local00002.default/chdata/clickhouse/data/Local0000 │└─────────┴──────────────────────────┴───────┴──────────────┴───────────────┴───────────┴───────────┘CHDBDEV :) backup database lukestest1 to Disk('backups','lukestest1_2024_02.zip');┌─id───────────────────────────────────┬─status─────────┐
1.739aa691-5e94-4853-8f39-3bb422a749d6 │ BACKUP_CREATED │└──────────────────────────────────────┴────────────────┘CHDBDEV :) backup database lukestest1 to Disk('default','lukestest1_2024.zip');
Received exception from server (version 24.4.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Disk ''default'' is not allowed for backups, see the 'backups.allowed_disk' configuration parameter. (BAD_ARGUMENTS)

案例4、备份目录配置及备份状况

[root@CHDBDEV ~]# cat /etc/clickhouse-server/config.d/backup_disk.xml
<clickhouse><storage_configuration><disks><backups><type>local</type><path>/backups/123/</path></backups></disks><disks><default><type>local</type><path>/chdata/clickhouse/data/</path></default></disks></storage_configuration><backups><allowed_disk>backups</allowed_disk><allowed_path>/backups/123/</allowed_path></backups><backups><allowed_disk>default</allowed_disk><allowed_path>/chdata/clickhouse/data/</allowed_path></backups>
</clickhouse>
CHDBDEV :) select name,path,type,is_read_only,is_write_once,is_remote,is_broken from system.disks;┌─name────┬─path─────────────────────┬─type──┬─is_read_only─┬─is_write_once─┬─is_remote─┬─is_broken─┐
1. │ backups │ /backups/123/Local00002.default/chdata/clickhouse/data/Local0000 │└─────────┴──────────────────────────┴───────┴──────────────┴───────────────┴───────────┴───────────┘CHDBDEV :) backup database lukestest1 to Disk('backups','lukestest1_2024_03.zip');┌─id───────────────────────────────────┬─status─────────┐
1. │ e5c9fe04-c24b-4760-b98e-dd5c366088a9 │ BACKUP_CREATED │└──────────────────────────────────────┴────────────────┘CHDBDEV :) backup database lukestest1 to Disk('default','lukestest1_2024.zip');
Received exception from server (version 24.4.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Disk ''default'' is not allowed for backups, see the 'backups.allowed_disk' configuration parameter. (BAD_ARGUMENTS)

案例5、备份目录配置及备份状况

[root@CHDBDEV ~]# cat /etc/clickhouse-server/config.d/backup_disk.xml
<clickhouse><storage_configuration><disks><backups><type>local</type><path>/backups/123/</path></backups></disks><disks><default2><type>local</type><path>/backups/345/</path></default2></disks></storage_configuration><backups><allowed_disk>backups</allowed_disk><allowed_path>/backups/123/</allowed_path></backups><backups><allowed_disk>default2</allowed_disk><allowed_path>/backups/345/</allowed_path></backups>
</clickhouse>CHDBDEV :) select name,path,type,is_read_only,is_write_once,is_remote,is_broken from system.disks;┌─name────┬─path─────────────────────┬─type──┬─is_read_only─┬─is_write_once─┬─is_remote─┬─is_broken─┐
1. │ backups │ /backups/123/Local00002.default/chdata/clickhouse/data/Local0000 │└─────────┴──────────────────────────┴───────┴──────────────┴───────────────┴───────────┴───────────┘CHDBDEV :) backup database lukestest1 to Disk('backups','lukestest1_2024_04.zip');┌─id───────────────────────────────────┬─status─────────┐
1.72d58abc-c82d-4705-952f-c0e493662fd1 │ BACKUP_CREATED │└──────────────────────────────────────┴────────────────┘CHDBDEV :) backup database lukestest1 to Disk('default2','lukestest1_2024.zip');
Received exception from server (version 24.4.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Disk ''default2'' is not allowed for backups, see the 'backups.allowed_disk' configuration parameter. (BAD_ARGUMENTS)

案例6、备份目录配置及备份状况

[root@CHDBDEV ~]# cat /etc/clickhouse-server/config.d/backup_disk.xml
<clickhouse><storage_configuration><disks><backups><type>local</type><path>/backups/123/</path></backups></disks></storage_configuration><backups><allowed_disk>backups</allowed_disk><allowed_path>/backups/123/</allowed_path></backups><storage_configuration><disks><default2><type>local</type><path>/backups/345/</path></default2></disks></storage_configuration><backups><allowed_disk>default2</allowed_disk><allowed_path>/backups/345/</allowed_path></backups>
</clickhouse>CHDBDEV :) select name,path,type,is_read_only,is_write_once,is_remote,is_broken from system.disks;┌─name────┬─path─────────────────────┬─type──┬─is_read_only─┬─is_write_once─┬─is_remote─┬─is_broken─┐
1. │ backups │ /backups/123/Local00002.default/chdata/clickhouse/data/Local0000 │└─────────┴──────────────────────────┴───────┴──────────────┴───────────────┴───────────┴───────────┘CHDBDEV :) backup database lukestest1 to Disk('default2','lukestest1_2024.zip');
Received exception from server (version 24.4.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Disk ''default2'' is not allowed for backups, see the 'backups.allowed_disk' configuration parameter. (BAD_ARGUMENTS)CHDBDEV :) backup database lukestest1 to Disk('backups','lukestest1_2024_05.zip');┌─id───────────────────────────────────┬─status─────────┐
1. │ b76f47d4-b6c9-4ff4-bff9-dcced56aa0b5 │ BACKUP_CREATED │└──────────────────────────────────────┴────────────────┘

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com