ECS:如何刪除其中包含許多物件的 S3 儲存桶

Summary: S3 儲存桶具有許多物件,但應將其刪除。本文介紹如何從存儲桶中刪除所有對象,最後刪除存儲桶。

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

警示:此過程將清空目標存儲桶中的所有物件。資料無法復原,請謹慎使用。


以下操作的限制:
  • 無法刪除 ECS 保留下的物件。
  • 無法刪除物件鎖定保留下的物件。
  • 啟用檔案系統的容器需要 3.8.1 版或更新版本。 

建議選項:版本 3.8 或更新版本:
在 ECS 軟體 3.8 版中,Dell 推出了 簡化的貯體刪除功能。現在,您可以使用 REST API 刪除物件和容器,或使用以下方式刪除 空的容器 S3 字串: x-emc-headers。Dell Technologies 建議升級至 3.8。以及使用簡化的儲存器刪除生命週期刪除。

使用 ECS UI 使用「簡化的容器刪除」(需要 3.8.1.0 或更新版本)
版本 3.8.1.x 及更新版本允許刪除具有適當權限之 ECS UI 中內容的容器。瀏覽至容器,然後從下拉式功能表中選取 刪除。選取 刪除包含選定容器的完整內容並確認。 

使用 ECS UI 使用「簡化的容器刪除」(需要 3.8.1.0 或更新版本)

使用 REST API 使用簡化的儲存器刪除。
請參閱最新的 REST API 指南以供參考。

使用 REST API 使用「簡化的容器刪除」。

從 ECS 使用 curl 傳送 rest API 呼叫的範例:

命令:

# curl -k -H "$token" -X POST https://<hostname-or-ip>:4443/object/bucket/<bucketname>/deactivate?namespace=<namespace>\&emptyBucket=true

範例:

curl -v -k -H "$token" -X POST https://10.60.x.xx:4443/object/bucket/ExampleBucketRest/deactivate?namespace=b_mathias_ns\&emptyBucket=true

要監視:

要監控儲存桶刪除

命令:

# curl -k -H "$token" -X GET https://<hostname-or-ip>:4443/object/bucket/<bucketname>/empty-bucket-status?namespace=<namespace> |xmllint --format -

範例:

Started:
mathias@client:/usr/share/s3curl$ curl -k -H "$token" -X GET https://10.60.x.xx:4443/object/bucket/ExampleBucketRest/empty-bucket-status?namespace=b_mathias_ns |xmllint --format -
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<empty_bucket_status>
  <status>PENDING</status>
  <created>1707411798889</created>
  <last_updated>1707411798889</last_updated>
  <entries_deleted>0</entries_deleted>
  <failed_to_delete_due_to_retention>0</failed_to_delete_due_to_retention>
  <failed_to_delete_due_to_permission>0</failed_to_delete_due_to_permission>
  <failed_to_delete_due_to_dangling xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
  <failed_to_delete_due_to_other>0</failed_to_delete_due_to_other>
  <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</empty_bucket_status>

Running:
mathias@client:/usr/share/s3curl$ curl -k -H "$token" -X GET https://10.60.x.xx:4443/object/bucket/ExampleBucketRest/empty-bucket-status?namespace=b_mathias_ns |xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   629  100   629    0     0   2431      0 --:--:-- --:--:-- --:--:--  2437
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<empty_bucket_status>
  <status>IN_PROGRESS</status>
  <created>1707411798889</created>
  <last_updated>1707411828897</last_updated>
  <entries_deleted>1337</entries_deleted>
  <failed_to_delete_due_to_retention>0</failed_to_delete_due_to_retention>
  <failed_to_delete_due_to_permission>0</failed_to_delete_due_to_permission>
  <failed_to_delete_due_to_dangling xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
  <failed_to_delete_due_to_other>0</failed_to_delete_due_to_other>
  <message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</empty_bucket_status>

Completed:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<error>
  <code>1004</code>
  <description>Request parameter cannot be found</description>
  <details>Unable to find entity with the given id ExampleBucketRest</details>
  <retryable>false</retryable>
</error>

上述錯誤是預期中的錯誤,因為已找不到容器。

使用 S3 使用簡化的儲存桶刪除:

  1. 如需詳細資訊,請參閱最新的資料存取指南。
  2. 請參閱 v3.8 資料存取指南

使用 S3 的「簡化儲存器刪除」 

使用此選項處理儲存桶的最快方法是 s3curl
 

警告:s3curl 已安裝在 ECS 節點上,但不應用於此作業。可使用 x-emc headers 目前尚未完全正常運行。
 
s3curl 可在 GitHub 上用於本地安裝。此版本用於包括 x-emc-headers https://github.com/EMCECS/s3curl/blob/master/s3curl.pl 此超連結會帶您前往 Dell Technologies 以外的網站。

的修改版本 s3curl.pl 已規劃在未來版本中新增至 ECS 代碼,且此 KB 已更新。

s3curl 的設定,請繼續執行下列步驟。請記住,數據無法恢復!
  1. 開始簡化的儲存桶刪除 s3curl
命令:
./s3curl --id=<alias> --DELETE -- http://<hostname-or-ip>:9020/<bucketname> -H "x-emc-empty-bucket:true"

範例:

mathias@client:/usr/share/s3curl$ ./s3curl.pl --id=b_mathias_iam --DELETE -- http://10.60.x.xx:9020/ExampleBucket -H "x-emc-empty-bucket:true"

監控容器刪除:

./s3curl.pl --id=<alias> http://<hostname-or-ip>:9020/<bucketname>?empty-bucket-status |xmllint --format -

範例:

mathias@client:/usr/share/s3curl$ ./s3curl.pl --id=b_mathias_iam -- http://10.60.x.xx:9020/ExampleBucket?empty-bucket-status |xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   474  100   474    0     0   3128      0 --:--:-- --:--:-- --:--:--  3139
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EmptyBucketStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Status>PENDING</Status>
  <Created>2024-02-08T16:21:53.849Z</Created>
  <LastUpdated>2024-02-08T16:21:53.849Z</LastUpdated>
  <EntriesDeleted>0</EntriesDeleted>
  <FailedToDeleteDueToRetention>0</FailedToDeleteDueToRetention>
  <FailedToDeleteDueToPermission>0</FailedToDeleteDueToPermission>
  <FailedToDeleteDueToOther>0</FailedToDeleteDueToOther>

Running:
mathias@client:/usr/share/s3curl$ ./s3curl.pl --id=b_mathias_iam -- http://10.60.x.xx:9020/ExampleBucket?empty-bucket-status |xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   478  100   478    0     0   3883      0 --:--:-- --:--:-- --:--:--  3886
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EmptyBucketStatus xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Status>IN_PROGRESS</Status>
  <Created>2024-02-08T16:21:53.849Z</Created>
  <LastUpdated>2024-02-08T16:22:23.899Z</LastUpdated>
  <EntriesDeleted>1304</EntriesDeleted>
  <FailedToDeleteDueToRetention>0</FailedToDeleteDueToRetention>
  <FailedToDeleteDueToPermission>0</FailedToDeleteDueToPermission>
  <FailedToDeleteDueToOther>0</FailedToDeleteDueToOther>
</EmptyBucketStatus>

Completed:
mathias@client:/usr/share/s3curl$ ./s3curl.pl --id=b_mathias_iam -- http://10.60.x.xx:9020/ExampleBucket?empty-bucket-status |xmllint --format -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   180    0   180    0     0   1300      0 --:--:-- --:--:-- --:--:--  1304
<?xml version="1.0"?>
<Error>
  <Code>NoSuchBucket</Code>
  <Message>The specified bucket does not exist</Message>
  <Resource>ExampleBucket</Resource>
  <RequestId>0a3c0812:18d77e3a715:2d7:1f33</RequestId>
</Error>


若為 3.8 之前的程式碼版本,請升級以取得上述選項的可用性。

Affected Products

ECS Appliance

Products

ECS Appliance
Article Properties
Article Number: 000014767
Article Type: How To
Last Modified: 21 Aug 2025
Version:  8
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.