代码改变世界

clickhouse备份遇到的问题和处理

2023-08-09 09:18  abce  阅读(473)  评论(0编辑  收藏  举报


错误一
使用以下命令备份表的时候报错:

ck :) backup table abce.tb to disk('backups', 'tb.zip');

BACKUP TABLE abce.tb TO disk('backups', 'tb.zip')

Query id: bc17655c-cd6f-4aca-a13f-644f5b4f713c


0 rows in set. Elapsed: 0.002 sec. 

Received exception from server (version 23.7.3):
Code: 627. DB::Exception: Received from localhost:9000. DB::Exception: Not found backup engine 'disk'. (BACKUP_ENGINE_NOT_FOUND)

ck :) 

查看备份路径

ck :) SELECT name,path FROM system.disks;

SELECT
    name,
    path
FROM system.disks

Query id: bb733f96-5b7d-4a97-b16e-f727316c0342

┌─name────┬─path───────────────────────┐
│ backups │ /clickhouse-server/backup/ │
│ default │ /clickhouse-server/data/   │
└─────────┴────────────────────────────┘

错误原因:

关键字Disk写成了小写的disk。


解决方法:

ck :) backup table abce.tb to Disk('backups', 'tb');

 

 

错误二

ck :) backup table abce.tb to Disk('backups', 'tb');

BACKUP TABLE abce.tb TO Disk('backups', 'tb')

Query id: 8e5d4f35-1a78-4982-a115-f0191306a5d3

Timeout exceeded while receiving data from server. Waited for 300 seconds, timeout is 300 seconds.
Cancelling query.

查看一下超时设置:

ck :) select name,value,changed,type,default from system.settings where name in('send_timeout','receive_timeout');

SELECT
    name,
    value,
    changed,
    type,
    default
FROM system.settings
WHERE name IN ('send_timeout', 'receive_timeout')

Query id: 5aca0d62-33e3-44a6-9e08-3864dc28932a

┌─name────────────┬─value─┬─changed─┬─type────┬─default─┐
│ receive_timeout │ 300   │       0 │ Seconds │ 300     │
│ send_timeout    │ 300   │       0 │ Seconds │ 300     │
└─────────────────┴───────┴─────────┴─────────┴─────────┘

2 rows in set. Elapsed: 0.004 sec. 

在配置文件中修改一下参数:

<receive_timeout>800</receive_timeout>
<send_timeout>800</send_timeout>