標籤:dr elephant hadoop 效能最佳化
公司基礎架構這邊想提取慢作業和獲悉資源浪費的情況,所以裝個dr elephant看看。LinkIn開源的系統,可以對基於yarn的mr和spark作業進行效能分析和調優建議。
DRE大部分基於java開發,spark監控部分使用scala開發,使用play堆棧式架構。這是一個類似Python裡面Django的架構,基於java?scala?沒太細瞭解,直接下來就能用,需要java1.8以上。
prerequest list:
Java 1.8
PlayFramework+activator
Nodejs+npm
scala+sbt
編譯伺服器是設立在美國矽谷的某雲主機,之前為了bigtop已經裝好了java,maven,ant,scala,sbt等編譯工具,所以下載activator解壓放到/usr/local並加入PATH即可。
然後從 github clone一份dr-elephant下來,開啟compile.conf,修改hadoop和spark版本為當前使用版本,:wq儲存退出,運行compile.sh進行編譯,經過短暫的等待之後,因為美國伺服器,下依賴快。會有個dist檔案夾,裡面會打包一個dr-elephant-2.0.x.zip,拷出來解壓縮就可以用了。
DRE本身需要mysql 5.5以上支援,或者mariadb最新的10.1穩定版本亦可。這裡會有一個問題,就是在DRE/conf/evolutions/default/1.sql裡面的這三行:
create index yarn_app_result_i4 on yarn_app_result (flow_exec_id);create index yarn_app_result_i5 on yarn_app_result (job_def_id);create index yarn_app_result_i6 on yarn_app_result (flow_def_id);
由於在某些資料庫情況下,索引長度會超過資料庫本身的限制,所以,需要修改索引長度來避免無法啟動的情況發生。
create index yarn_app_result_i4 on yarn_app_result (flow_exec_id(150));create index yarn_app_result_i5 on yarn_app_result (job_def_id(150));create index yarn_app_result_i6 on yarn_app_result (flow_def_id(150));
然後就應該沒啥問題了。
到資料庫裡建立一個叫drelephant的資料庫,並給出相關存取權限使用者
接下來是需要配置DRE:
開啟app-conf/elephant.conf
# Play application server port# 啟動dre後play架構監聽的web連接埠port=8080# Database configuration# 資料庫主機,使用者名稱密碼庫名db_url=localhostdb_name=drelephantdb_user="root"db_password=
其他預設即可,不需更改
然後是GeneralConf.xml
<configuration> <property> <name>drelephant.analysis.thread.count</name> <value>3</value> <description>Number of threads to analyze the completed jobs</description> </property> <property> <name>drelephant.analysis.fetch.interval</name> <value>60000</value> <description>Interval between fetches in milliseconds</description> </property> <property> <name>drelephant.analysis.retry.interval</name> <value>60000</value> <description>Interval between retries in milliseconds</description> </property> <property> <name>drelephant.application.search.match.partial</name> <value>true</value> <description>If this property is "false", search will only make exact matches</description> </property></configuration>
修改drelephant.analysis.thread.count,預設是3,建議修改到10,3的話從jobhistoryserver讀取的速度太慢,高於10的話又讀取的太快,會對jobhistoryserver造成很大壓力。下面兩個一個是讀取的時間周期,一個是重試讀取的間隔時間周期。
然後到bin下執行start.sh啟動。And then, show smile to the yellow elephant。
裝完看了一下這個東西,其實本身原理並不複雜,就是讀取各種jmx,metrics,日誌資訊,自己寫一個也不是沒有可能。功能主要是把作業資訊裡的內容匯總放到一屏裡面顯示,省的在JHS的頁面裡一個一個點了。
650) this.width=650;" src="http://s5.51cto.com/wyfs02/M01/8C/74/wKiom1hsx8jRByDsAAZdBTE75J0031.png-wh_500x0-wm_3-wmp_4-s_2404359343.png" style="float:none;" title="螢幕快照 2017-01-04 下午5.57.29.png" alt="wKiom1hsx8jRByDsAAZdBTE75J0031.png-wh_50" />
650) this.width=650;" src="http://s5.51cto.com/wyfs02/M01/8C/71/wKioL1hsx8yDxMmTAAa6YRfEAs0611.png-wh_500x0-wm_3-wmp_4-s_1193186933.png" style="float:none;" title="螢幕快照 2017-01-04 下午5.58.05.png" alt="wKioL1hsx8yDxMmTAAa6YRfEAs0611.png-wh_50" />
That‘s it, so easy
本文出自 “實踐檢驗真理” 部落格,請務必保留此出處http://slaytanic.blog.51cto.com/2057708/1889037
Hadoop監控分析工具Dr.Elephant