Untuk menghentikan ekspor CSV atau SQL yang sedang berlangsung dan mengosongkan resource cluster, Anda dapat membatalkan operasi ekspor AlloyDB untuk PostgreSQL menggunakan Google Cloud CLI atau REST API.
Sebelum memulai
Untuk membatalkan ekspor data, temukan ID operasi ekspor yang ingin Anda batalkan. Untuk menemukan ID, lakukan salah satu hal berikut:
Ikuti petunjuk di Mengekspor file CSV atau Mengekspor file SQL. ID operasi ditampilkan di kolom
namerespons.Lakukan panggilan
operations.listpada cluster AlloyDB.
Membatalkan operasi ekspor
Anda dapat menggunakan perintah gcloud CLI atau REST API untuk membatalkan operasi ekspor.
gcloud
Gunakan perintah gcloud alloydb operations cancel
untuk membatalkan operasi:
gcloud alloydb operations cancel OPERATION_ID --region=REGIONGanti kode berikut:
OPERATION_ID: ID operasi. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.REGION: region tempat cluster AlloyDB di-deploy.
REST v1
Gunakan metode HTTP dan URL berikut:
POST https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel
Untuk informasi selengkapnya, lihat operations.cancel.
Sebelum menggunakan data permintaan apa pun, lakukan penggantian berikut:
- PROJECT_ID: project ID.
- REGION: region tempat cluster AlloyDB di-deploy.
- OPERATION_ID: ID operasi ekspor. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
Untuk mengirim permintaan Anda, luaskan salah satu opsi berikut:
curl (Linux, macOS, atau Cloud Shell)
Jalankan perintah berikut:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
"https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel"
PowerShell (Windows)
Jalankan perintah berikut:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-Uri "https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID:cancel" | Select-Object -Expand Content
Panggilan REST API ini tidak menampilkan respons apa pun. Untuk mengetahui informasi selengkapnya tentang cara memeriksa status pembatalan operasi ekspor, lihat Memeriksa status yang dibatalkan.
Memeriksa status yang dibatalkan
Anda dapat menggunakan perintah gcloud CLI atau REST API untuk memeriksa status operasi ekspor yang dibatalkan.
gcloud
Gunakan perintah gcloud alloydb operations describe
untuk memeriksa status operasi yang dibatalkan.
gcloud alloydb operations describe OPERATION_ID --region=REGIONGanti kode berikut:
OPERATION_ID: ID operasi yang dibatalkan. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.REGION: region tempat cluster AlloyDB di-deploy.
REST v1
Jalankan perintah berikut:
GET https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID
Untuk informasi selengkapnya, lihat operations.get.
Sebelum menggunakan data permintaan apa pun, lakukan penggantian berikut:
- REGION: region tempat cluster AlloyDB di-deploy.
- PROJECT_ID: project ID.
- OPERATION_ID: ID operasi ekspor. Untuk mengetahui informasi selengkapnya, lihat Sebelum memulai.
Untuk mengirim permintaan Anda, luaskan salah satu opsi berikut:
curl (Linux, macOS, atau Cloud Shell)
Jalankan perintah berikut:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID"
PowerShell (Windows)
Jalankan perintah berikut:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://alloydb.googleapis.com/v1/projects/PROJECT_ID/locations/REGION/operations/OPERATION_ID" | Select-Object -Expand Content
Jika berhasil, isi respons akan memuat instance
Operation.
Langkah berikutnya
- Pelajari cara mengekspor file CSV.
- Pelajari cara mengekspor file dump SQL.