設定Table維護配置
為指定表設定自動維護配置,支援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 Bucket的ARN,格式為 |
--type | string | 維護配置類型。取值為 |
--value | string | 維護配置值,JSON格式字串。支援直接傳入JSON字串或通過 |
put-table-maintenance-configuration命令對應API介面PutTableMaintenanceConfiguration。關於API中的具體參數含義,請參見PutTableMaintenanceConfiguration。
關於支援的全域命令列選項,請參見ossutil全域選項。
使用樣本
設定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"}'