clickhouse如何刪除大表

clickhouse 在單表或單分區(qū)超過50GB時(shí),將無法直接刪除
1. 案例
模擬刪除單表或單分區(qū)超過50GB時(shí),刪除報(bào)錯(cuò)的情況
1.1 一個(gè)表中超過50GB的分區(qū)
-- 刪除分區(qū)的腳本如下ALTER TABLE testdb.test DROP PARTITION (20220606,'12');
Code: 359. DB::Exception: Received from localhost:9000. DB::Exception: Table or Partition in testdb.test was not dropped.Reason:1. Size (56.20 GB) is greater than max_[table/partition]_size_to_drop (50.00 GB)2. File '/data/clickhouse/flags/force_drop_table' intended to force DROP doesn't existHow to fix this:1. Either increase (or set to zero) max_[table/partition]_size_to_drop in server config2. Either create forcing file /data/clickhouse/flags/force_drop_table and make sure that ClickHouse has write permission for it.Example:sudo touch '/data/clickhouse/flags/force_drop_table' && sudo chmod 666 '/data/clickhouse/flags/force_drop_table'.
1.3 解決方法
報(bào)錯(cuò)信息中已給出解決方法:
1) 增大單表或單分區(qū)的可刪除的大小
2) 通過執(zhí)行腳本,強(qiáng)制刪除
1.4 我們選擇強(qiáng)制刪除來解決
執(zhí)行如下腳本
sudo touch '/data/clickhouse/flags/force_drop_table' && sudo chmod 666 '/data/clickhouse/flags/force_drop_table'
2. mysql8.0新增用戶及加密規(guī)則修改的那些事
3. 比hive快10倍的大數(shù)據(jù)查詢利器-- presto
4. 監(jiān)控利器出鞘:Prometheus+Grafana監(jiān)控MySQL、Redis數(shù)據(jù)庫
5. PostgreSQL主從復(fù)制--物理復(fù)制
6. MySQL傳統(tǒng)點(diǎn)位復(fù)制在線轉(zhuǎn)為GTID模式復(fù)制



評論
圖片
表情
