原文地址:https://www.cnblogs.com/heml/p/6552818.html#_label2?tdsourcetag=s_pctim_aiomsg
目錄
回到頂部
MySQL
Azkaban使用mysql存儲很多狀態,AzkabanWebServer和AzkabanExecutorServer都會使用mysql數據庫
AzkabanWebServer使用mysql主要有一下用途:
1、Project Management - 管理項目和項目上傳文件
2、Executing Flow State - 跟蹤執行流程和運行他們的Executor
3、Previous Flow/Jobs:搜索之前的job執行以及訪問他們的日誌
4、Scheduler - 保存調度任務的狀態
5、SLA(服務等級協議) - 保存sla規則
AzkabanExecutorServer使用mysql主要有一下用途:
1、Access the project - 從數據庫中查找項目文件
2、Executing Flows/Jobs - 查找和更新正在執行的流的數據
3、Logs - 記錄job和flow輸出的日誌
4、dependency(交流) - 如果一個flow運行在不同的executor,那麼他會把狀態存儲在數據庫中
AzkabanWebServer是azkaban中最主要的管理者,他主要處理項目管理、認證、調度、監控執行器,它提供了一個web UI界面
回到頂部
下載源碼
1、如果是下面那麼下載,則下載的需要jdk1.8或者更高,此處不使用這種下載方式
git clone https://github.com/azkaban/azkaban.git
2、下載指定版本的azkaban
git clone --branch 3.0.0 https://github.com/azkaban/azkaban.git
下載完成後會有如下警告:
warning: Remote branch 3.0.0 not found in upstream origin, using HEAD instead
解決方法:
進入到下載目錄,執行:git checkout 3.0.0
安裝gradle,配置好環境變量
gradle 編譯防止網絡下載gradle包
第一種方式使用gradlew編譯:修改下圖中紅色的部分爲本地已經下載好的gradle安裝包路徑
第二種方式使用gradle編譯:配置好gradle環境變量即可,使用gradle命令編譯
安裝git
編譯源碼
此處修改gradle-wrapper.properties中distributionUrl爲本地gradle
編譯中遇見的問題:
1、編譯警告影響編譯失敗
warning: [EqualsHashCode] Classes that override equals should also override hashCode.
public boolean equals(Object obj)
^
(see http://errorprone.info/bugpattern/EqualsHashCode)
解決方法編輯build.gradle添加如下內容:
1
2
3
4
5
6
7
8
9
10
11
|
allprojects {
repositories {
mavenCentral()
mavenLocal()
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
|
2、編譯錯誤:
What went wrong:
Execution failed for task ':azkaban-common:compileMainExecutableMainC'.
> Could not find C compiler 'gcc' in system path.
解決方法:
3、編譯錯誤:
Could not find Linker 'g++' in system path
解決方法:
1
2
|
sudo yum install g++
sudo yum install -y gcc -c++*
|
回到頂部
編譯成功後,拷貝azkaban-sql-3.0.0.tar.gz、azkaban-exec-server-3.0.0.tar.gz、azkaban-web-server-3.0.0.tar.gz到/home/hadoop/apps/azkaban目錄下
azkaban web服務器安裝
1、解壓 tar -zxvf azkaban-web-server-3.0.0.tar.gz
2、重命名 mv azkaban-web-server-3.0.0 server
azkaban executor服務器安裝
1、解壓 tar -zxvf azkaban-exec-server-3.0.0.tar.gz
2、重命名 mv azkaban-exec-server-3.0.0 executor
創建SSL配置
命令:keytool -keystore keystore -alias jetty -genkey -keyalg RSA
執行後會提示填寫一些信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
keytool -keystore keystore - alias jetty -genkey -keyalg RSA
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]:
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]: CN
Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN correct?
[no]: y
Enter key password for <jetty>
(RETURN if same as keystore password):
|
執行成功後會在當前目錄生成keystore證書文件
此時,只需要拷貝證書文件到azkaban web服務器的根目錄下即可
修改配置文件
配置時區
1、使用tzselect 生成時區
2、覆蓋系統時區
1
|
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
修改azkaban web服務器配置文件
1、進入到配置文件所在目錄conf中
2、編輯azkaban.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# Azkaban Personalization Settings
#服務器UI名稱,用於服務器上方顯示的名字
azkaban.name=Test
#描述
azkaban.label=My Local Azkaban
#UI顏色
azkaban.color= #FF3601
azkaban.default.servlet.path= /index
#默認根web目錄
web.resource. dir =web/
#默認時區,已改爲亞洲/上海 默認爲美國
default.timezone. id =Asia /Shanghai
# Azkaban UserManager class
#用戶權限管理默認類
user.manager.class=azkaban.user.XmlUserManager
#用戶配置文件所在的目錄
user.manager.xml. file =conf /azkaban-users .xml
# Loader for projects
# global配置文件所在位置
executor.global.properties=conf /global .properties
azkaban.project. dir =projects
#數據庫類型,目前只支持mysql
database. type =mysql
#端口號
mysql.port=3306
#數據庫連接IP
mysql.host=localhost
#數據庫實例名
mysql.database=azkaban
#數據庫用戶名
mysql.user=root
#數據庫密碼
mysql.password=root
#最大連接數
mysql.numconnections=100
# Velocity dev mode
velocity.dev.mode= false
# Azkaban Jetty server properties.
#最大線程數
jetty.maxThreads=25
#Jetty SSL端口
jetty.ssl.port=8443
#Jetty端口
jetty.port=8081
#SSL文件名
jetty.keystore=keystore
#SSL文件密碼
jetty.password=123456
#Jetty主密碼 與 keystore文件相同
jetty.keypassword=123456
#SSL文件名
jetty.truststore=keystore
# SSL文件密碼
jetty.trustpassword=123456
jetty.excludeCipherSuites=SSL_RSA_WITH_DES_CBC_SHA,SSL_DHE_RSA_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5,SSL_RSA_EXPORT_WITH_DES40_CBC_SHA,SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA,SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_SHA
# Azkaban Executor settings
#執行服務器端口
executor.port=12321
# mail settings 郵件設置
#發送郵箱
[email protected]
#發送郵箱smtp地址
mail.host=smtp.qq.com
#發送郵件時顯示的名稱
[email protected]
#發送郵件時的密碼
mail.password=*************
#任務失敗時發送郵件的地址
[email protected]
#任務成功時發送郵件的地址
[email protected]
lockdown.create.projects= false
#緩存目錄
cache.directory=cache
# JMX stats
jetty.connector.stats= true
executor.connector.stats= true
|
修改azkaban executor器配置文件
1、進入到配置文件所在目錄conf中
2、編輯azkaban.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# Azkaban
#時區
default.timezone. id =Asia /Shanghai
# Azkaban JobTypes Plugins
#jobtype 插件所在位置
azkaban.jobtype.plugin. dir =plugins /jobtypes
# Loader for projects
executor.global.properties=conf /global .properties
azkaban.project. dir =projects
#數據庫相關配置
database. type =mysql
mysql.port=3306
mysql.host=localhost
mysql.database=azkaban
mysql.user=root
mysql.password=root
mysql.numconnections=100
# Azkaban Executor settings
# 執行服務器配置
executor.maxThreads=50
executor.port=12321
executor.flow.threads=30
# JMX stats
jetty.connector.stats= true
executor.connector.stats= true
# uncomment to enable inmemory stats for azkaban
#executor.metric.reports=true
#executor.metric.milisecinterval.default=60000
|
用戶配置
進入azkaban web服務器conf目錄,修改azkaban-users.xml
1
2
3
4
5
6
7
|
<azkaban- users >
<user username= "azkaban" password= "azkaban" roles= "admin" groups = "azkaban" />
<user username= "metrics" password= "metrics" roles= "metrics" />
<user username= "admin" password= "admin" roles= "admin,metrics" />
<role name= "admin" permissions= "ADMIN" />
<role name= "metrics" permissions= "METRICS" />
< /azkaban-users >
|
主要是添加下面一行
1
|
<user username= "admin" password= "admin" roles= "admin,metrics" />
|
導入azkaban表結構到mysql中
1、創建數據庫azkaban
1
|
create database azkaban;
|
2、導入表結構
1
|
source /home/hadoop/apps/azkaban/azkaban-sql-3 .0.0 /create-all-sql-3 .0.0.sql;
|
3、執行鍼對3.0.0升級的sql
update.execution_flows.3.0.sql
update.active_executing_flows.3.0.sql
啓動
1、啓動web服務器,進入web服務器(不要進入bin目錄,直接在bin目錄所在那層執行,原因是有些配置文件寫的是相對路徑),執行如下命令
1
|
nohup . /bin/azkaban-web-start .sh &
|
2、啓動executor,進入executor,不要進入bin目錄(原因和上面一樣),執行如下命令
1
|
nohup . /bin/azkaban-executor-start .sh
|
瀏覽器訪問web服務器:https://服務器IP地址:8443,需要輸入的用戶名和密碼就是在azkaban-users.xml添加的那個用戶名和密碼
azkaban3.0.0: http://pan.baidu.com/s/1c19b5gk
博客園:http://www.cnblogs.com/heml
個人博客:http://www.hemingliang.site