天天看點

Standalone+ZooKeeper 高可用部署_4

開發者學堂課程【大資料實時計算架構 Spark 快速入門:Standalone+ZooKeeper高可用部署_4】學習筆記,與課程緊密聯系,讓使用者快速學習知識。

課程位址:

https://developer.aliyun.com/learning/course/100/detail/1658

Standalone+ZooKeeper 高可用部署_4

配置結果如下:

Standalone+ZooKeeper 高可用部署_4

把配置檔案拷貝過去,如下圖:

Standalone+ZooKeeper 高可用部署_4

啟動 Zookeeper,如下圖:

Standalone+ZooKeeper 高可用部署_4

需要停掉再重新啟動,如下:

Standalone+ZooKeeper 高可用部署_4

狀态為 STANDBY,說明叢集就搭建好了,如下圖:

Standalone+ZooKeeper 高可用部署_4

Overview

Utilizing Zookeeper to provide leader election and some state storage, you can launch multiple Masters in your cluster connected to the same ZooKeeper instance. One will be elected "leader" and the others will remain in standby mode. If the current leader dies, another Master will be elected, recover the old Master's state, and then resume scheduling. The entire recovery process (from the time the the first leader goes down) should take between 1 and 2 minutes. Note that this delay only affects scheduling new applications - applications that were already running during Master fallover are unaffected.

重新整理一下,如下:

Standalone+ZooKeeper 高可用部署_4

啟動原來的 Master,結果如下:

Standalone+ZooKeeper 高可用部署_4

跑應用程式 REPL

Standalone+ZooKeeper 高可用部署_4

這裡預設建立了 Spark Context,也建立了 sqlContext,如下:

Standalone+ZooKeeper 高可用部署_4

現在可以寫 scala 代碼:

Standalone+ZooKeeper 高可用部署_4

把 scala 應用程式跑起來,重新整理一下,結果如下:

Standalone+ZooKeeper 高可用部署_4

把 Master 停掉,如下:

Standalone+ZooKeeper 高可用部署_4

會有資訊報備,如下

Standalone+ZooKeeper 高可用部署_4

并沒有真的去執行這個檔案,隻是标記了一下,如下:

Standalone+ZooKeeper 高可用部署_4

繼續閱讀