大資料求索(4):配置Spark History Server
阿新 • • 發佈:2018-12-25
大資料求索(4):配置Spark History Server
修改配置檔案
- 修改conf/spark-default.conf
cp spark-default.conf.template spark-default.conf
vim spark-default.conf
屬性說明
(1) spark.eventLog.enabled。
是否記錄Spark事件,用於應用程式在完成後的籌夠WebUI。
(2) spark.eventLog.dir。
設定spark.eventLog.enabled為true後,該屬性為記錄spark時間的根目錄。在此根目錄中,Spark為每個應用程式建立分目錄,並將應用程式的時間記錄到此目錄中。使用者可以將此屬性設定為HDFS目錄,以便History Server讀取。
- 修改conf/spark-env.sh
export SPARK_HISTORY_OPTS="-Dspark.history.ui.port=18080 -Dspark.history.retainedApplications=3 -Dspark.history.fs.logDirectory=hdfs://wds001:8020/spark-history"
注意:hdfs的目錄要提前建立好,不然會報錯
屬性說明
(1) spark.history.ui.port
web視覺化埠
(2) spark.history.retainedApplications
設定快取Cache中儲存的應用程式歷史記錄的個數,預設50,如果超過這個值,舊的將被刪除。注:快取檔案數不表示實際顯示的檔案總數。只是表示不在快取中的檔案可能需要從硬碟讀取,速度稍有差別。
(3) spark.history.fs.logDirectory
存放歷史記錄檔案的目錄。可以是Hadoop APIs支援的任意檔案系統。
啟動
依次啟動Hadoop的start-dfs.sh
和Spark的start-all.sh
後,再執行start-history-server.sh
檔案即可啟動歷史服務。