一、下载azkaban
官网:https://azkaban.github.io/downloads.html
GitHub下载地址:https://github.com/azkaban/azkaban
下载:
[root@salt ~]# git clone https://github.com/azkaban/azkaban.git
二、安装
1、构建
我这里没有用git下载,是直接下载的压缩包,不过都问题不大;
1、编译成tar包(如果不是第一次构建需要先clean,执行:./gradlew clean)
[root@salt azkaban]# cd /opt/azkaban/azkaban-3.81.0/
[root@salt azkaban]# vim azkaban-common/src/main/java/azkaban/jobExecutor/ProcessJob.java
将final boolean isExecuteAsUser = this.sysProps.getBoolean(EXECUTE_AS_USER, true); 里面的true修改为false
[root@salt azkaban-3.81.0]# ./gradlew distTar #最后会显示:BUILD SUCCESSFUL
2、把相应的tar包复制出来
[root@salt azkaban-3.81.0]# mkdir /usr/local/src/azkaban
[root@salt azkaban-3.81.0]# cp azkaban-db/build/distributions/azkaban-db-0.1.0-SNAPSHOT.tar.gz /usr/local/src/azkaban/packages
[root@salt azkaban-3.81.0]# cp azkaban-exec-server/build/distributions/azkaban-exec-server-0.1.0-SNAPSHOT.tar.gz /usr/local/src/azkaban/packages
[root@salt azkaban-3.81.0]# cp azkaban-solo-server/build/distributions/azkaban-solo-server-0.1.0-SNAPSHOT.tar.gz /usr/local/src/azkaban/packages
[root@salt azkaban-3.81.0]# cp azkaban-hadoop-security-plugin/build/distributions/azkaban-hadoop-security-plugin-0.1.0-SNAPSHOT.tar.gz /usr/local/src/azkaban/packages
[root@salt azkaban-3.81.0]# cp azkaban-web-server/build/distributions/azkaban-web-server-0.1.0-SNAPSHOT.tar.gz /usr/local/src/azkaban/packages
3、解压tar包
[root@salt azkaban-3.81.0]# cd /usr/local/src/azkaban/
[root@saltstack azkaban]# tar zxf packages/azkaban-web-server-0.1.0-SNAPSHOT.tar.gz -C .
[root@saltstack azkaban]# tar zxf packages/azkaban-exec-server-0.1.0-SNAPSHOT.tar.gz -C .
[root@saltstack azkaban]# tar zxf packages/azkaban-db-0.1.0-SNAPSHOT.tar.gz -C .
[root@saltstack azkaban]# tar zxf packages/azkaban-hadoop-security-plugin-0.1.0-SNAPSHOT.tar.gz -C .
[root@saltstack azkaban]# tar zxf packages/azkaban-solo-server-0.1.0-SNAPSHOT.tar.gz -C .
[root@saltstack azkaban]# ls
azkaban-db-0.1.0-SNAPSHOT
azkaban-hadoop-security-plugin-0.1.0-SNAPSHOT
azkaban-web-server-0.1.0-SNAPSHOT
azkaban-exec-server-0.1.0-SNAPSHOT
azkaban-solo-server-0.1.0-SNAPSHOT
packages
2、创建数据库及导入数据结构
这里使用的mysql:
mysql> CREATE DATABASE azkaban;
mysql> use azkaban;
mysql> source /usr/local/src/azkaban/azkaban-db-0.1.0-SNAPSHOT/create-all-sql-0.1.0-SNAPSHOT.sql
mysql> show tables;
+-----------------------------+
| Tables_in_azkaban |
+-----------------------------+
| QRTZ_BLOB_TRIGGERS |
| QRTZ_CALENDARS |
| QRTZ_CRON_TRIGGERS |
| QRTZ_FIRED_TRIGGERS |
| QRTZ_JOB_DETAILS |
| QRTZ_LOCKS |
......
三、配置keystore
[root@salt azkaban]# cd azkaban-web-server-0.1.0-SNAPSHOT/ [root@salt azkaban-web-server-0.1.0-SNAPSHOT]# keytool -keystore keystore -alias jetty -genkey -keyalg RSA 输入密钥库口令: #123456 再次输入新口令: #123456 您的名字与姓氏是什么? #直接回车 [Unknown]: 您的组织单位名称是什么? #直接回车 [Unknown]: 您的组织名称是什么? #直接回车 [Unknown]: 您所在的城市或区域名称是什么? #直接回车 [Unknown]: 您所在的省/市/自治区名称是什么? #直接回车 [Unknown]: 该单位的双字母国家/地区代码是什么? #输入 CN [Unknown]: CN CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN是否正确? [否]: Y #输入 Y 输入 <jetty> 的密钥口令 (如果和密钥库口令相同, 按回车): #直接回车 Warning: JKS 密钥库使用专用格式。建议使用 "keytool -importkeystore -srckeystore keystore -destkeystore keystore -deststoretype pkcs12" 迁移到行业标准格式 PKCS12。 ----------- 完成上述工作后,将在当前目录生成 keystore 证书文件,将keystore 考贝到 azkaban web服务器根目录中,由于我目前在web server目录中,就不用复制了; [root@salt azkaban-web-server-0.1.0-SNAPSHOT]# ls bin conf keystore lib web
四、配置文件
1、配置每个服务器节点时区
[root@node1 ~]# ll /etc/localtime
lrwxrwxrwx. 1 root root 35 11月 14 17:06 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
[root@node2 ~]# ll /etc/localtime
lrwxrwxrwx. 1 root root 35 11月 14 17:06 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
[root@node3 bin]# ll /etc/localtime
lrwxrwxrwx. 1 root root 35 11月 14 17:06 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
可见我的已经指向对的;
如果不对,可以(在每个节点)执行以下命令:
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
2、azkaban web服务器配置
azkaban.properties (路径写绝对路径)
# Azkaban Personalization Settings
azkaban.name=test
azkaban.label=test
azkaban.color=#FF3601
azkaban.default.servlet.path=/index
web.resource.dir=/usr/local/src/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/web/
default.timezone.id=Asia/Shanghai
# Azkaban UserManager class
user.manager.class=azkaban.user.XmlUserManager
user.manager.xml.file=/usr/local/src/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/conf/azkaban-users.xml
# Loader for projects
executor.global.properties=/usr/local/src/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/conf/global.properties
azkaban.project.dir=projects
# Velocity dev mode
velocity.dev.mode=false
# Azkaban Jetty server properties.
jetty.maxThreads=25
jetty.port=8081
jetty.ssl.port=8443
jetty.keystore=/usr/local/src/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/keystore
jetty.password=123456
jetty.keypassword=123456
jetty.truststore=/usr/local/src/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/keystore
jetty.trustpassword=123456
# Project Manager settings
#project.temp.dir=/temp
#project.version.retention=3
# Azkaban Executor settings
executor.port=12321
# mail settings
mail.sender=
mail.host=
job.failure.email=
job.success.email=
lockdown.create.projects=false
cache.directory=cache
# JMX stats
jetty.connector.stats=true
executor.connector.stats=true
# Azkaban plugin settings
azkaban.jobtype.plugin.dir=/usr/local/src/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/plugins/jobtypes
# Azkaban mysql settings by default. Users should configure their own username and password.
database.type=mysql
mysql.port=3306
mysql.host=172.16.0.109
mysql.database=azkaban
mysql.user=root
mysql.password=123456
mysql.numconnections=100
#Multiple Executor
azkaban.use.multiple.executors=true
azkaban.executorselector.filters=StaticRemainingFlowSize,MinimumFreeMemory,CpuStatus
azkaban.executorselector.comparator.NumberOfAssignedFlowComparator=1
azkaban.executorselector.comparator.Memory=1
log4j.properties
log4j.rootLogger=INFO, Console
log4j.logger.azkaban=INFO, server
log4j.appender.server=org.apache.log4j.RollingFileAppender
log4j.appender.server.layout=org.apache.log4j.PatternLayout
log4j.appender.server.File=logs/azkaban-webserver.log
log4j.appender.server.layout.ConversionPattern=%d{yyyy/MM/dd HH:mm:ss.SSS Z} %p [%c{1}] [Azkaban] %m%n
log4j.appender.server.MaxFileSize=102400MB
log4j.appender.server.MaxBackupIndex=2
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d{yyyy/MM/dd HH:mm:ss.SSS Z} %p [%c{1}] [Azkaban] %m%n
azkaban-users.xml
增加 管理员用户 admin
<azkaban-users> <user username="azkaban" password="azkaban" roles="admin" groups="azkaban" /> <user username="metrics" password="metrics" roles="metrics"/> <user username="admin" password="123456" roles="admin,metrics" /> <role name="admin" permissions="ADMIN" /> <role name="metrics" permissions="METRICS"/> </azkaban-users>
cp -a azkaban-solo-server-0.1.0-SNAPSHOT/plugins azkaban-web-server-0.1.0-SNAPSHOT/
3、azkaban 执行服务器(executor)配置
azkaban.properties
# Azkaban Personalization Settings
default.timezone.id=Asia/Shanghai
# Azkaban UserManager class
# Loader for projects
executor.global.properties=/usr/local/src/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT/conf/global.properties
azkaban.project.dir=projects
# Velocity dev mode
velocity.dev.mode=false
# Azkaban Jetty server properties.
# mail settings
lockdown.create.projects=false
cache.directory=cache
# JMX stats
jetty.connector.stats=true
executor.connector.stats=true
# Azkaban Executor settings
executor.maxThreads=50
executor.flow.threads=30
# 这里添加一个端口配置
executor.port=12321
azkaban.execution.dir=executions
# Azkaban plugin settings
azkaban.jobtype.plugin.dir=/usr/local/src/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT/plugins/jobtypes
# Azkaban mysql settings by default. Users should configure their own username and password.
database.type=mysql
mysql.port=3306
mysql.host=172.16.0.109
mysql.database=azkaban
mysql.user=root
mysql.password=123456
mysql.numconnections=100
log4j.properties
同上
五、启动
启动azkaban-exec-server
xxx/bin/azkaban-exec-start.sh
启动azkaban-web-server
xxx/bin/azkaban-web-start.sh
jps
浏览器中:https://ip:8443