監控及排解互動工作階段的相關問題

本文說明如何使用 Spark UI 監控 Managed Service for Apache Spark 互動式工作階段,以及排解相關問題。

Spark UI

Spark UI 會從 Managed Service for Apache Spark 互動式工作階段收集 Apache Spark 執行作業詳細資料。Spark UI 功能預設為啟用,不需付費。Spark UI 功能收集的資料會保留 90 天。

必要的 Identity and Access Management 權限和角色

必須具備下列權限,才能在互動式工作階段使用 Spark UI 功能:

  • 資料收集權限:dataproc.sessions.sparkApplicationWrite。這項權限必須授予執行互動式工作階段的服務帳戶。這項權限包含在 Managed Service for Apache Spark Worker 角色中,該角色會自動授予 Managed Service for Apache Spark 預設使用的 Compute Engine 預設服務帳戶。不過,如果您為工作階段或執行階段設定檔 (工作階段範本) 指定自訂服務帳戶,則必須將這項 dataproc.sessions.sparkApplicationWrite 權限新增至該服務帳戶 (通常是將 Managed Service for Apache Spark Worker 角色授予服務帳戶)。

  • Spark UI 存取權限:dataproc.sessions.sparkApplicationRead。使用者必須具備這項權限,才能在Google Cloud 控制台存取 Spark UI。Dataproc Viewer、Dataproc Editor 和 Dataproc Administrator 角色都包含這項權限。如要在 Google Cloud 控制台開啟 Spark UI,您必須具備下列其中一個角色,或具備包含這項權限的自訂角色。

開啟 Spark UI

Spark UI 頁面位於 Google Cloud 控制台。

  1. 前往 Managed Service for Apache Spark 互動式工作階段

  2. 按一下「互動式工作階段 ID」,開啟「互動式工作階段詳細資料」頁面。
  3. 點選頂端選單中的「查看 Spark UI」。

「View Spark UI」(查看 Spark UI) 連結是否已停用?如果未授予必要權限、在互動式工作階段詳細資料頁面取消勾選「啟用 Spark UI」核取方塊,或是在建立工作階段或建立執行階段設定檔 (工作階段範本) 時,將 spark.dataproc.appContext.enabled 屬性設為 false (預設值:true),「查看 Spark UI」按鈕就會停用。