Quay lại bộ đề
Question #179 Topic 1
You are deploying an Apache Airflow directed acyclic graph (DAG) in a Cloud Composer 2 instance. You have incoming files in a Cloud Storage bucket that the DAG processes, one file at a time. The Cloud Composer instance is deployed in a subnetwork with no Internet access. Instead of running the DAG based on a schedule, you want to run the DAG in a reactive way every time a new file is received. What should you do?
Bạn đang triển khai một đồ thị có hướng không chu trình (DAG) Apache Airflow trong một môi trường Cloud Composer 2. Bạn có các tệp tin được đưa vào một bucket Cloud Storage mà DAG sẽ xử lý, từng tệp một. Thực thể Cloud Composer được triển khai trong một mạng con (subnetwork) không có quyền truy cập Internet. Thay vì chạy DAG dựa trên một lịch trình biểu (schedule), bạn muốn chạy DAG theo cách phản ứng (reactive) mỗi khi nhận được một tệp mới. Bạn nên làm gì?
A
1. Enable Private Google Access in the subnetwork, and set up Cloud Storage notifications to a Pub/Sub topic.2. Create a push subscription that points to the web server URL.
1. Bật Quyền truy cập Google riêng tư (Private Google Access) trong mạng con và thiết lập thông báo Cloud Storage tới một topic Pub/Sub.
2. Tạo một push subscription trỏ đến URL của web server.
B
1. Enable the Cloud Composer API, and set up Cloud Storage notifications to trigger a Cloud Function.2. Write a Cloud Function instance to call the DAG by using the Cloud Composer API and the web server URL.3. Use VPC Serverless Access to reach the web server URL.
1. Bật Cloud Composer API và thiết lập thông báo Cloud Storage để kích hoạt một Cloud Function.
2. Viết một hàm Cloud Function để gọi DAG bằng cách sử dụng Cloud Composer API và URL của web server.
3. Sử dụng VPC Serverless Access để kết nối tới URL của web server.
C
1. Enable the Airflow REST API, and set up Cloud Storage notifications to trigger a Cloud Function instance.2. Create a Private Service Connect (PSC) endpoint.3. Write a Cloud Function that connects to the Cloud Composer cluster through the PSC endpoint.
1. Bật Airflow REST API và thiết lập thông báo Cloud Storage để kích hoạt một thực thể Cloud Function.
2. Tạo một endpoint Private Service Connect (PSC).
3. Viết một Cloud Function kết nối tới cụm Cloud Composer thông qua endpoint PSC đó.
D
1. Enable the Airflow REST API, and set up Cloud Storage notifications to trigger a Cloud Function instance.2. Write a Cloud Function instance to call the DAG by using the Airflow REST API and the web server URL.3. Use VPC Serverless Access to reach the web server URL.
1. Bật Airflow REST API và thiết lập thông báo Cloud Storage để kích hoạt một thực thể Cloud Function.
2. Viết một hàm Cloud Function để gọi DAG bằng cách sử dụng Airflow REST API và URL của web server.
3. Sử dụng VPC Serverless Access để kết nối tới URL của web server.
Giải thích & Tài liệu tham khảo
Để kích hoạt (trigger) DAG trong môi trường Cloud Composer 2 Private IP khi có tệp mới trên Cloud Storage:
- Airflow REST API: Cần được bật để nhận yêu cầu trigger bên ngoài.
- Private Service Connect (PSC): Trong Cloud Composer 2 Private IP, Airflow web server được chạy trong một mạng riêng (tenant project) do Google quản lý. Để kết nối an toàn từ mạng VPC của bạn (hoặc từ Cloud Function) tới web server này mà không qua Internet, bạn phải tạo một endpoint PSC tương ứng trong VPC của mình.
- Cloud Function: Lắng nghe sự kiện tải tệp lên từ Cloud Storage và gửi yêu cầu REST API thông qua endpoint PSC để kích hoạt DAG.
- Tại sao chọn C: Đây là mô hình kết nối chính xác và bảo mật được Google khuyến nghị dành cho Composer 2 Private IP.
- Tại sao A sai: Web server của Composer Private IP không thể nhận lưu lượng trực tiếp từ một Pub/Sub push subscription công cộng bên ngoài.
- Tại sao B và D sai: Việc sử dụng URL web server công cộng thông qua Serverless VPC Access không thể phân giải hoặc kết nối thành công đến môi trường Composer 2 Private IP nếu thiếu cấu hình endpoint PSC.
(Đáp án được gợi ý bởi AI)