Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform GCP存储版本控制:删除具有两个以上版本的文件_Google Cloud Platform_Google Cloud Storage_Versioning_Lifecycle - Fatal编程技术网

Google cloud platform GCP存储版本控制:删除具有两个以上版本的文件

Google cloud platform GCP存储版本控制:删除具有两个以上版本的文件,google-cloud-platform,google-cloud-storage,versioning,lifecycle,Google Cloud Platform,Google Cloud Storage,Versioning,Lifecycle,我正在尝试GCP存储桶上的对象生命周期管理。我想删除bucket中有2个更新版本的对象的所有文件。为此,我创建了以下规则 { "lifecycle": { "rule": [ { "action": {"type": "Delete"}, "condition": { "numNewerVersions&

我正在尝试GCP存储桶上的对象生命周期管理。我想删除bucket中有2个更新版本的对象的所有文件。为此,我创建了以下规则

 {
  "lifecycle": {
    "rule": [
    {
       "action": {"type": "Delete"},
       "condition": {
       "numNewerVersions": 2
    }
   }
 ] 
 }
 }
已在bucket上启用版本控制,如下所示

     $ gsutil versioning get gs://<my bucket>/
     gs://<my bucket>/: Enabled  

请澄清

生命周期是一个异步过程,您的配置最多需要24小时。你不知道它什么时候扫描你的桶。这里详细介绍一下

云存储定期检查一个bucket中配置了对象生命周期管理的所有对象,并根据该bucket的规则执行所有适用的操作。云存储以异步方式执行操作,因此在满足条件和执行操作之间可能存在延迟

对生命周期配置的更新可能需要24小时才能生效。这意味着,当您更改生命周期配置时,对象生命周期管理仍可能在24小时内基于旧配置执行操作


非常感谢。如果你能澄清的话,我需要一些额外的澄清
gsutil ls -a gs://bucketdataflowtest/
gs://<my bucket>//inputFile.txt#1597038772164786
gs://<my bucket>//inputFile.txt#1600169465982831
gs://<my bucket>//inputFile.txt#1600680502763401
gs://<my bucket>//jsonSchema.json#1597038769578689
gs://<my bucket>//transformCSVtoJSON.js#1597038773640155
  $ gsutil lifecycle  get  gs://<my bucket>/
  {"rule": [{"action": {"type": "Delete"}, "condition": {"numNewerVersions": 2}}]}
      $ gsutil ls -la gs://<my bucket>/
   209  2020-08-10T05:52:52Z  gs://<my bucket>/inputFile.txt#1597038772164786  metageneration=1
   347  2020-09-15T11:31:05Z  gs://<my bucket>/inputFile.txt#1600169465982831  metageneration=1
   347  2020-09-21T09:28:22Z  gs://<my bucket>/inputFile.txt#1600680502763401  metageneration=1
   347  2020-09-21T09:48:00Z  gs://<my bucket>/inputFile.txt#1600681680007546  metageneration=1
   571  2020-08-10T05:52:49Z  gs://<my bucket>/jsonSchema.json#1597038769578689  metageneration=1
   495  2020-08-10T05:52:53Z  gs://<my bucket>/transformCSVtoJSON.js#1597038773640155  metageneration=1
   {
    "lifecycle": {
     "rule": [
        {
           "action": {"type": "Delete"},
            "condition": {
            "age": 60,
            "isLive": true
        }
      },

    {
      "action": {"type": "Delete"},
        "condition": {
          "age": 70 ,
          "isLive": false
     }
    }
  ]
  }
  }