刪除執行個體

使用其中一個 Bigtable 用戶端程式庫時,可以透過程式刪除執行個體,也可以使用Google Cloud 控制台、Google Cloud CLI 或 cbt CLI 手動刪除執行個體:

控制台

  1. 在 Google Cloud 控制台中開啟 Bigtable 執行個體清單。

    開啟執行個體清單

  2. 按一下要刪除的執行個體,然後點選「刪除執行個體」。 即會顯示確認對話方塊。

    「刪除執行個體」對話方塊的螢幕截圖

  3. 按照確認對話方塊中的指示操作,然後按一下「刪除」。 執行個體已永久刪除。

gcloud

  1. 如果尚未安裝,請安裝 Google Cloud CLI
  2. 如果您不知道執行個體 ID,請使用 bigtable instances list 指令查看專案的執行個體清單:

    gcloud bigtable instances list
    
  3. 使用 bigtable instances delete 指令刪除執行個體:

    gcloud bigtable instances delete INSTANCE_ID
    

    INSTANCE_ID 替換為執行個體的永久 ID。

cbt

  1. 如果尚未安裝,請安裝 cbt CLI
  2. 如果您不知道執行個體 ID,請使用 listinstances 指令查看專案的執行個體清單:

    cbt listinstances
    
  3. 使用 deleteinstance 指令刪除執行個體:

    cbt deleteinstance INSTANCE_ID
    

    INSTANCE_ID 替換為執行個體的永久 ID。

C++

如要瞭解如何安裝及使用 Bigtable 的用戶端程式庫,請參閱「Bigtable 用戶端程式庫」。

如要向 Bigtable 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

namespace cbt = ::google::cloud::bigtable;
namespace cbta = ::google::cloud::bigtable_admin;
using ::google::cloud::Status;
[](cbta::BigtableInstanceAdminClient instance_admin,
   std::string const& project_id, std::string const& instance_id) {
  std::string instance_name = cbt::InstanceName(project_id, instance_id);
  Status status = instance_admin.DeleteInstance(instance_name);
  if (!status.ok()) throw std::runtime_error(status.message());
  std::cout << "Successfully deleted the instance " << instance_id << "\n";
}

C#

如要瞭解如何安裝及使用 Bigtable 的用戶端程式庫,請參閱「Bigtable 用戶端程式庫」。

如要向 Bigtable 進行驗證,請設定應用程式預設憑證。詳情請參閱「為本機開發環境設定驗證機制」。

// Deletes an instance from the project.
// Initialize request argument(s).
DeleteInstanceRequest request = new DeleteInstanceRequest
{
    InstanceName = new InstanceName(projectId, instanceId)
};
try
{
    // Make request.
    Console.WriteLine("Waiting for operation to complete...");
    bigtableInstanceAdminClient.DeleteInstance(request);
}