如何優雅地關閉SparkStreaming

2021-10-09 08:05:54 字數 782 閱讀 6423

how to shutdown a spark streaming job gracefully

17/02/02 01:31:35 info streaming.streamingcontext: invoking stop(stopgracefully=true) from shutdown hook

17/02/02 01:31:45 info streaming.streamingcontext: streamingcontext stopped successfully

17/02/02 01:31:45 info spark.sparkcontext: invoking stop() from shutdown hook

17/02/02 01:31:45 info spark.sparkcontext: successfully stopped sparkcontext

17/02/02 01:31:45 info util.shutdownhookmanager: shutdown hook called

需要注意的事項

info streaming.streamingcontext: invoking stop(stopgracefully=true) from shutdown hook

方案2 (推薦)

取代sigterm訊號,可以通過另外一種方式來完成優雅地關閉。一種方式是,在hdfs中設定乙個標記檔案,定期地校驗該標記檔案,如果該檔案存在,則呼叫ssc.stop(true, true);或者, 啟動乙個監聽埠,當該埠監聽到訊號時,則觸發優雅關閉;

優雅地關閉worker程序

關閉nginx兩種方式 nginx s stop 立即停止nginx程序 nginx s quit 優雅地關閉worker程序 開始優雅的關閉worker程序後 01設定定時器 worker shutdown timeout 設定多少秒後關閉連線 02關閉監聽控制代碼,不在接收新的連線 03關閉空閒...

如何優雅地關閉乙個socket

如何優雅地關閉乙個socket 1.關閉socket時究竟做了什麼 關閉socket分為主動關閉 active closure 和被動關閉 passive closure 兩種情況。前者是指有本地主機主動發起的關閉 而後者則是指本地主機檢測到遠端主機發起關閉之後,作出回應,從而關閉整個連線。其狀態圖...

如何優雅地寫部落格

如何優雅地寫部落格 現在寫部落格面臨著幾個問題 編寫麻煩,大部分的部落格編輯器都很爛,csdn和等等。維護麻煩,維護多個部落格的資料同步很麻煩。歷史檢視,大部分部落格編寫都不能檢視之前的歷史資料。用github做部落格倉庫,將資料都寫在github上,這樣可以隨時檢視一年前的部落格資料,方便在原文件...