Google Cloud ์ฝ์์ ์ฌ์ฉํ์ฌ ํฌ๋ก ์์ ์์ฝ ๋ฐ ์คํ
์ด ๋น ๋ฅธ ์์์์๋ Cloud Scheduler๋ฅผ ์ฌ์ฉํ์ฌ ๋ช ๊ฐ์ง ๊ธฐ๋ณธ ์์ ์ ์ํํ๊ธฐ ์ํด Google Cloud ์ฝ์์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ์์๋ด ๋๋ค.
์ด ๋น ๋ฅธ ์์์์๋ ๋ค์์ ์ํํฉ๋๋ค.
- Cloud Scheduler ์์ ๋์์ผ๋ก ์ค์ ํ Pub/Sub ์ฃผ์ ๋ฅผ ๋ง๋ญ๋๋ค.
- Cloud Scheduler๋ฅผ ์ฌ์ฉํ์ฌ ํฌ๋ก ์์ ์ ๋ง๋ค๊ณ ์์ ์ ๋ฐ๋ณต ์ผ์ ์ ๊ตฌ์ฑํฉ๋๋ค.
- ์์ ์ ์คํํฉ๋๋ค.
- ์์ ์ด ์ฑ๊ณต์ ์ผ๋ก ์คํ๋์๋์ง ํ์ธํฉ๋๋ค.
Cloud Scheduler์๋ ๋ฌด๋ฃ ๋ฑ๊ธ์ด ์์ผ๋ฏ๋ก ์ด ๋น ๋ฅธ ์์์ ์คํํด๋ ๋น์ฉ์ด ๋ฐ์ํ์ง ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ๊ฐ๊ฒฉ ์ฑ ์ ์ ์ฐธ์กฐํ์ธ์.
Google Cloud ์ฝ์์์ ์ด ํ์คํฌ์ ๋ํ ๋จ๊ณ๋ณ ์๋ด๋ฅผ ์ง์ ์ํํ๋ ค๋ฉด ๋๋ฌ๋ณด๊ธฐ๋ฅผ ํด๋ฆญํฉ๋๋ค.
์์ํ๊ธฐ ์ ์
- 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.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Cloud Scheduler, Pub/Sub APIs.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Cloud Scheduler, Pub/Sub APIs.
Pub/Sub ์ฃผ์ ๋ฐ ๊ตฌ๋ ๋ง๋ค๊ธฐ
Pub/Sub ์ฃผ์ ๋ ๊ฒ์์๊ฐ ๋ฉ์์ง๋ฅผ ์ ์กํ ์ ์๋ ๋ฆฌ์์ค์ ๋๋ค. ์ฃผ์ ์ ๊ฒ์๋ ๋ฉ์์ง๋ฅผ ๋ฐ์ผ๋ ค๋ฉด ํด๋น ์ฃผ์ ์ ๋ํ ๊ตฌ๋ ์ ๋ง๋ค์ด์ผ ํฉ๋๋ค.
Google Cloud ์ฝ์์์ Pub/Sub ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
์ฃผ์ ๋ง๋ค๊ธฐ๋ฅผ ํด๋ฆญํฉ๋๋ค.
์ฃผ์ ID ํ๋์ ์ฃผ์ ์ ID๋ก cron-topic์ ์ ๋ ฅํฉ๋๋ค.
๊ธฐ๋ณธ ๊ตฌ๋ ์ถ๊ฐ ์ต์ ์ ํฌํจํ์ฌ ๊ธฐ๋ณธ๊ฐ์ ์ ์งํฉ๋๋ค.
๋ค๋ฅธ ์ต์ ์ ์ ํํ์ง ๋ง์ธ์.
๋ง๋ค๊ธฐ๋ฅผ ํด๋ฆญํฉ๋๋ค.
๊ทธ๋ฌ๋ฉด cron-topic
์ด๋ผ๊ณ ํ๋ Pub/Sub ์ฃผ์ ์ cron-topic-sub
๋ผ๊ณ ํ๋ ํด๋น ์ฃผ์ ์ ๊ตฌ๋
์ด ์์ฑ๋ฉ๋๋ค.
Cloud Scheduler๋ฅผ ์ฌ์ฉํ์ฌ ํฌ๋ก ์์ ๋ง๋ค๊ธฐ
๋ฐ๋ณต ์ผ์ ์ผ๋ก ๋์์ ์ ์ก๋๋ ์์ฝ ์์ ๋จ์(ํฌ๋ก ์์ ์ด๋ผ๊ณ ํจ)๋ฅผ ์ค์ ํฉ๋๋ค.
Google Cloud ์ฝ์์์ Cloud Scheduler ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
์์ ๋ง๋ค๊ธฐ๋ฅผ ํด๋ฆญํฉ๋๋ค.
์์ ์ ์ด๋ฆ์ ์ง์ ํฉ๋๋ค.
๋ฆฌ์ ๋ชฉ๋ก์์ ์์ ์ ๋ฆฌ์ ์ ์ ํํฉ๋๋ค.
unix-cron์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ ํ์์ ์ฌ์ฉํ์ฌ ์์ ์ ๋น๋๋ฅผ ์ง์ ํฉ๋๋ค. ์๋ฅผ ๋ค๋ฉด ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
30 16 * * 7
์์ธํ ๋ด์ฉ์ ํฌ๋ก ์์ ์ผ์ ๊ตฌ์ฑ์ ์ฐธ์กฐํ์ธ์.
์๊ฐ๋ ๋ชฉ๋ก์์ ์๊ฐ๋๋ฅผ ์ ํํฉ๋๋ค.
์ผ๋ถ ์๊ฐ๋์ ๊ฒฝ์ฐ ์ผ๊ด ์ ์ฝ ์๊ฐ์ผ๋ก ์ธํด ์์ ์ด ์๊ธฐ์น ์๊ฒ ์คํ๋๊ฑฐ๋ ์คํ๋์ง ์์ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ ์๊ฐ๋๋ฅผ ์ฐธ์กฐํ์ธ์.
๊ณ์์ ํด๋ฆญํฉ๋๋ค.
๋์ ์ ํ ๋ชฉ๋ก์์ Pub/Sub๋ฅผ ์ ํํฉ๋๋ค.
์์ ๋ง๋ ์ฃผ์ (
cron-topic
)๋ฅผ ์ ํํฉ๋๋ค.๋ฉ์์ง ๋ณธ๋ฌธ ํ๋์ Pub/Sub ๋์ ์ฃผ์ ๋ก ์ ์กํ ๋ฌธ์์ด์ ์ ๋ ฅํฉ๋๋ค. 'Hello world!'๋ฅผ ์๋ก ๋ค ์ ์์ต๋๋ค.
๋ง๋ค๊ธฐ๋ฅผ ํด๋ฆญํฉ๋๋ค.
์ผ์์ผ ์คํ 4์ 30๋ถ์ Pub/Sub ์ฃผ์ ์ ๋ฉ์์ง๋ฅผ ์ ์กํ๋ ์์ ์ ๋ง๋ค์์ต๋๋ค. ์ด์ ์์ ์ ์คํํ ์ ์์ต๋๋ค.
์์ ์คํ
์ง์ ๋ ์ผ์ ์ ๋ฐ๋ผ ์คํํ๋ ๊ฒ ์ธ์๋ ์์ ์ ๊ฐ์ ๋ก ์ฆ์ ์คํํ ์ ์์ต๋๋ค.
Google Cloud ์ฝ์์์ Cloud Scheduler ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
์์ ์ด ํ์๋์ด์ผ ํฉ๋๋ค.
์์ ํ์์ > ๊ฐ์ ์คํ์ ํด๋ฆญํฉ๋๋ค.
์์์ด๊ธฐ ๊ตฌ์ฑ๋๋ฌธ์ ํ๋ก์ ํธ์์ ๋ง๋ ์ฒซ ๋ฒ์งธ ์์ ์ ์คํํ๋ ๋ฐ ๋ช ๋ถ ์ ๋ ๊ฑธ๋ฆด ์ ์์ต๋๋ค.
์ต์ข ์คํ ์ํ ์ด์์
Success
์ํ๋ ํฌ๋ก ์์ ์ด ์ฑ๊ณต์ ์ผ๋ก ์คํ๋์์์ ๋ํ๋ ๋๋ค.
๊ทธ๋ฐ ๋ค์ Pub/Sub์์ ๋ฉ์์ง๋ฅผ ์์ ํ๋์ง ํ์ธํ ์ ์์ต๋๋ค.
Pub/Sub์์ ๊ฒฐ๊ณผ ํ์ธ
๊ตฌ๋ ์์ Pub/Sub ๋ฉ์์ง๋ฅผ ๊ฐ์ ธ์์ Pub/Sub ์ฃผ์ ๊ฐ ํด๋น ์์ ์ ๋ฉ์์ง๋ฅผ ์์ ํ๋์ง ํ์ธํฉ๋๋ค.
Google Cloud ์ฝ์์์ Pub/Sub ๊ตฌ๋ ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
Pub/Sub ์ฃผ์ ์ ๊ตฌ๋ ์ ํด๋ฆญํฉ๋๋ค.
๋ฉ์์ง ํญ์ ํด๋ฆญํฉ๋๋ค.
๊ฐ์ ธ์ค๊ธฐ๋ฅผ ํด๋ฆญํฉ๋๋ค.
๊ฒ์ํ ๋ฉ์์ง๊ฐ ๋ฉ์์ง ๋ณธ๋ฌธ, Hello world
, ๋ฉ์์ง๊ฐ ๊ฒ์๋ ์๊ฐ๊ณผ ํจ๊ป ํ์๋ฉ๋๋ค.
์ญ์
์ด ํ์ด์ง์์ ์ฌ์ฉํ ๋ฆฌ์์ค ๋น์ฉ์ด Google Cloud ๊ณ์ ์ ์ฒญ๊ตฌ๋์ง ์๋๋ก ํ๋ ค๋ฉด ๋ค์ ๋จ๊ณ๋ฅผ ์ํํฉ๋๋ค.
๋ง๋ ํฌ๋ก ์์ ์ ์ญ์ ํฉ๋๋ค.
Google Cloud ์ฝ์์์ Cloud Scheduler ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
์์ ์ ์ฒดํฌ๋ฐ์ค๋ฅผ ์ ํํฉ๋๋ค.
์ญ์ ๋ฅผ ํด๋ฆญํ๊ณ ์ญ์ ๋์๋์ง ํ์ธํฉ๋๋ค.
Pub/Sub ์ฃผ์ ๋ฅผ ์ญ์ ํฉ๋๋ค.
Google Cloud ์ฝ์์์ Pub/Sub ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
์ฃผ์ ์ ์ฒดํฌ๋ฐ์ค๋ฅผ ์ ํํฉ๋๋ค.
์ญ์ ๋ฅผ ํด๋ฆญํ๊ณ ์ญ์ ๋์๋์ง ํ์ธํฉ๋๋ค.
Pub/Sub ๊ตฌ๋ ์ ์ญ์ ํฉ๋๋ค.
Google Cloud ์ฝ์์์ Pub/Sub ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค.
๊ตฌ๋ ์ ์ฒดํฌ๋ฐ์ค๋ฅผ ์ ํํฉ๋๋ค.
์ญ์ ๋ฅผ ํด๋ฆญํ๊ณ ์ญ์ ๋์๋์ง ํ์ธํฉ๋๋ค.
๋๋ Cloud Scheduler ํ์ต์ฉ์ผ๋ก ๋ง๋ ์ ํ๋ก์ ํธ๊ฐ ๋ ์ด์ ํ์ํ์ง ์์ผ๋ฉด ํ๋ก์ ํธ๋ฅผ ์ญ์ ํฉ๋๋ค.
- In the Google Cloud console, go to the Manage resources page.
- In the project list, select the project that you want to delete, and then click Delete.
- In the dialog, type the project ID, and then click Shut down to delete the project.
๋ค์ ๋จ๊ณ
- Cloud Scheduler์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
- Cloud Scheduler ๋ก๊ทธ ๋ณด๋ ๋ฐฉ๋ฒ ์์๋ณด๊ธฐ