設定Table維護配置

更新時間:
Copy as MD

為指定表設定自動維護配置,支援Iceberg表的自動合并(Compaction)和快照管理(Snapshot Management)。

注意事項

  • --type參數支援以下兩種維護類型:

    • icebergCompaction:Iceberg表資料檔案合并,用於自動合并小檔案以提升查詢效能。

    • icebergSnapshotManagement:Iceberg錶快照管理,用於自動清理到期快照以釋放儲存空間。

  • --value參數為JSON格式的配置值,不同維護類型對應不同的配置結構。可以直接傳入JSON字串,也可以使用file://首碼從本地檔案讀取配置內容。

  • 每種維護類型需要單獨調用命令設定。如需同時配置合并和快照管理,需分別執行兩次命令。

命令格式

ossutil tables-api put-table-maintenance-configuration --table-bucket-arn value --namespace value --name value --type value --value value [flags]

參數

類型

說明

--name

string

表名稱。必選參數。

--namespace

string

表所屬的命名空間名稱。必選參數。

--table-bucket-arn

string

Table BucketARN,格式為acs:osstables:{region}:{uid}:bucket/{bucket-name}。必選參數。

--type

string

維護配置類型。取值為icebergCompaction(Iceberg表資料合併)或icebergSnapshotManagement(Iceberg錶快照管理)。必選參數。

--value

string

維護配置值,JSON格式字串。支援直接傳入JSON字串或通過file://首碼指定本地檔案路徑。必選參數。

說明

使用樣本

  • 設定Iceberg表的資料合併(Compaction)維護配置,啟用自動合并並設定目標檔案大小為512 MB。通過命令列直接傳入JSON字串。

    ossutil tables-api put-table-maintenance-configuration --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --type icebergCompaction --value '{"status":"enabled","settings":{"targetFileSizeMB":512}}'
  • 設定Iceberg表的快照管理(Snapshot Management)維護配置,啟用自動快照清理,保留最近5個快照且最長保留7天。

    ossutil tables-api put-table-maintenance-configuration --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --type icebergSnapshotManagement --value '{"status":"enabled","settings":{"minSnapshotsToKeep":5,"maxSnapshotAgeHours":168}}'
  • 通過本地檔案傳入配置JSON,使用file://首碼指定設定檔路徑。

    ossutil tables-api put-table-maintenance-configuration --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --type icebergCompaction --value file://compaction-config.json
  • 禁用Iceberg表的資料合併維護配置。

    ossutil tables-api put-table-maintenance-configuration --table-bucket-arn acs:osstables:cn-hangzhou:1234567890:bucket/my-table-bucket --namespace my_namespace --name my_table --type icebergCompaction --value '{"status":"disabled"}'