Panduan memulai: Men-deploy kumpulan pekerja contoh ke Cloud Run
Halaman ini menunjukkan cara men-deploy container kumpulan pekerja contoh. Setelah di-deploy, kumpulan pekerja akan terus menulis pesan log.
Sebelum memulai
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
- Aktifkan Cloud Run Admin API:
Aktifkan Cloud Run Admin API - Instal dan lakukan inisialisasi gcloud CLI.
-
Perbarui komponen:
gcloud components update
Deploy kumpulan pekerja
Untuk men-deploy container kumpulan pekerja contoh, ikuti langkah-langkah berikut:
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
Jalankan perintah berikut:
Anda dapat menggunakan nama atau region apa pun yang Anda inginkan untuk kumpulan pekerja. Panduan memulai cepat ini mengasumsikan Anda menggunakan namagcloud beta run worker-pools deploy example-worker-pool --image us-docker.pkg.dev/cloudrun/container/worker-pool:latest --region europe-west1
example-worker-pool
dan regioneurope-west1
.Setelah deployment berhasil diselesaikan, Cloud Run akan menampilkan pesan yang mirip dengan pesan ini:
Worker pool [my-example-worker-pool] revision [my-example-worker-pool-REVISION] has been deployed
Lihat log yang ditulis oleh kumpulan pekerja.
Di konsol Google Cloud , buka halaman Cloud Run:
Klik Kumpulan pekerja.
Klik kumpulan pekerja dalam daftar kumpulan pekerja.
Klik tab Logs untuk mendapatkan log container untuk semua revisi kumpulan pekerja ini. Worker pool terus menulis pesan log
Cloud Run Worker Pool instance is running!
.
Pembersihan
Worker pool contoh terus-menerus menulis log. Jadi, untuk menghentikannya, Anda harus menghapus kumpulan pekerja.Untuk menghapus kumpulan pekerja, gunakan perintah:
gcloud beta run worker-pools delete my-example-workerpool
--region europe-west1
Ganti my-example-workerpool
dengan nama kumpulan pekerja jika Anda menggunakan
nama yang berbeda saat men-deploy, dan ganti
europe-west1
dengan region Anda jika Anda menggunakan region yang berbeda
saat men-deploy.
Langkah berikutnya
Untuk mengetahui informasi selengkapnya tentang kumpulan pekerja, lihat: