一、前言
最近試着參照官方文檔搭建 Azkaban,發現文檔很多地方有坑,所以在此記錄一下。
二、環境及軟件
安裝環境:
- 系統環境: ubuntu-12.04.2-server-amd64
- 安裝目錄: /usr/local/ae/ankaban
- JDK 安裝目錄: export JAVA_HOME=/usr/local/ae/jdk1.7.0_51
- Hadoop 安裝目錄 export HADOOP_HOME=/usr/local/ae/hadoop-1.2.1
- Mysql 版本:mysql-server-5.5
需要軟件:
- azkaban-web-server-2.5.0.tar.gz
- azkaban-executor-server-2.5.0.tar.gz
- azkaban-sql-script-2.5.0.tar.gz
Azkaban source: github.com/azkaban/azkaban
Azkaban plugins source:github.com/azkaban/azkaban-plugins
doc:azkaban.github.io/azkaban/docs/2.5/
三、配置Mysql
- 解壓azkaban-sql-script-2.5.0.tar.gz
user@ae01:/usr/local/ae/azkaban$ tar -zxvx azkaban-sql-script-2.5.0.tar.gz
- 登錄Mysql 創建Database azkaban
user@ae01:/usr/local/ae/azkaban$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 165 Server version: 5.5.37-0ubuntu0.12.04.1 (Ubuntu) Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database azkaban;
- 創建 Azkaban 表格
mysql> use azkaban Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> source /usr/local/ae/azkaban/azkaban-2.5.0/create-all-sql-2.5.0.sql
- 為 Azkaban 創建用戶 azkaban
mysql> grant all privileges on azkaban.* to 'azkaban'@'localhost' identified by 'azkaban'; mysql> flush privileges;
四、配置 azkaban-web
- 解壓 azkaban-web-server-2.5.0.tar.gz
user@ae01:/usr/local/ae/azkaban$ tar -zxvx azkaban-web-server-2.5.0.tar.gz
- 生成SSL 證書
關於怎么使用 Java keytool 生成 keystore 和 Truststore 文件 可以參考我之前的隨筆。
在這里可以只簡單的生成 keystore 文件,並將生成的 keystore 文件拷貝至 /usr/local/ae/azkaban/azkaban-web-2.5.0/web 文件下。
本文中證書文件為 keystone, keypass 為 kestore。 - 修改 ./conf/azkaban.properties
#Azkaban Personalization Settings azkaban.name=Azkaban azkaban.label=My Local Azkaban azkaban.color=#FF3601 azkaban.default.servlet.path=/index 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 executor.global.properties=../conf/global.properties azkaban.project.dir=projects project.temp.dir=temp trigger.plugin.dir=plugins/triggers database.type=mysql mysql.port=3306 mysql.host=localhost mysql.database=azkaban mysql.user=azkaban mysql.password=azkaban mysql.numconnections=100 # Velocity dev mode velocity.dev.mode=false # Azkaban Jetty server properties. jetty.maxThreads=25 jetty.ssl.port=8443 jetty.port=8081 jetty.keystore=web/keystore jetty.password=keystore jetty.keypassword=jetty-azkaban jetty.truststore=web/keystore jetty.trustpassword=keystore # Azkaban Executor settings executor.port=12321 # mail settings mail.sender=*********************** mail.host=*********************** mail.user=************************ mail.password=****** job.failure.email=************************* job.success.email=************************* lockdown.create.projects=false cache.directory=cache
- 啟動 azkaban-web
user@ae01:/usr/local/ae/azkaban/azkaban-web-2.5.0$ sh bin/azkaban-web-start.sh
Note: 1. Azkaban 在啟動是會生成兩個日志文件azkaban-access.log/azkaban-webserver.log,他們的生成位置是在你執行腳本的目錄,所以建議你最好還是在AZKABAN_HOME 目錄下執行啟動腳本,如果你喜歡在 ./bin 目錄下啟動,你需要將上文第3步驟的紅色標記處修改目錄位置為 ../${dir}。
2. Azkaban 需要在 ./plugins 的文件夾下手動生成一個 triggers 的目錄,否則啟動日志會報錯。但如果添加 triggers 文件夾后,登錄頁面時 500 並提示 Velocity could not be initialized! 那就刪除 ./plugins/tirggers 文件夾。 - 登錄 https:ae01:8443 username:azkaban; password:azkaban
- 修改 azkaban-web 啟動文件
如果發現無法上傳文件,需要修改 azkaban-web 的啟動腳本 azkaban-web-start.sh
if [[ -z "$tmpdir" ]]; then ---> if [ -z "$tmpdir" ]; then
五、配置 azkaban-executor
- 解壓 azkaban-executor-server-2.5.0.tar.gz
user@ae01:/usr/local/ae/azkaban$ tar -zxvx azkaban-executor-server-2.5.0.tar.gz
- 配置 ./conf/azkaban.properties
#Azkaban default.timezone.id=America/Los_Angeles # Azkaban JobTypes Plugins azkaban.jobtype.plugin.dir=plugins/jobtypes #Loader for projects executor.global.properties=conf/global.properties azkaban.project.dir=projects azkaban.execution.dir=executions project.temp.dir=temp database.type=mysql mysql.port=3306 mysql.host=localhost mysql.database=azkaban mysql.user=azkaban mysql.password=azkaban mysql.numconnections=100 # Azkaban Executor settings executor.maxThreads=50 executor.port=12321 executor.flow.threads=30
- 配置 jobtype 插件
解壓 azkaban-jobtype-2.5.0.tar.gz 至 ./plugins 並重命名為 jobtypes
user@ae01:/usr/local/ae/azkaban/azkaban-executor-2.5.0/plugins$ tar -zxvx azkaban-jobtype-2.5.0.tar.gz user@ae01:/usr/local/ae/azkaban/azkaban-executor-2.5.0/plugins$ mv ./azkaban-jobtype-2.5.0 ./jobtypes
配置 ./conf/common.propertes
## everything that the user job can know hadoop.home=/usr/local/ae/hadoop-1.2.1 #hive.home= #pig.home= azkaban.should.proxy=true jobtype.global.classpath=${hadoop.home}/hadoop-core-1.2.1.jar,${hadoop.home}/conf
- 啟動 azkaban-executor
user@ae01:/usr/local/ae/azkaban/azkaban-executor-2.5.0$ sh bin/azkaban-executor-start.sh
Note: 1. Azkaban 在啟動是會生成兩個日志文件azkaban-access.log/azkaban-webserver.log,他們的生成位置是在你執行腳本的目錄,所以建議你最好還是在AZKABAN_HOME 目錄下執行啟動腳本,如果你喜歡在 ./bin 目錄下啟動,你需要將上文第2步驟的紅色標記處修改目錄位置為 ../${dir}