准备环节:(如已安装,均可略过)
A-基础命令安装
由于测试机选择的是centOS7的最小安装,好多Linux的命令是没有的,所以选择先通过yum安装这些命令
1-yum -y install wget
2-yum -y install cmake
3-yum -y install readline-devel zlib-devel openssl-dev
4-yum install -y gcc
5-yum install -y gcc-c++
6-yum install -y bison.x86_64
7-yum -y install unzip
8-yum -y install git
B-JDK1.8的安装(azkaban强依赖jdk1.8)
Azkaban依赖JDK1.8,所以首先需要安装JDK1.8
1-创建一个文件夹存储azkaban和jdk(这个自定义)
mkdir /software
cd /software
2-通过wget下载jdk安装包(直接复制下面的内容回车等待下载完成即可)
wget --no-cookies --no-check-certificate --header "Cookie:gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
3-解压jdk安装包
tar -zxvfjdk-8u141-linux-x64.tar.gz
文件jdk1.8.0_141为解压后的jdk文件
4-配置jdk环境变量
vim /etc/profile 添加下面的内容到文件末尾
export JAVA_HOME=/software/jdk1.8.0_141 #jdk安装文件的绝对路径
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/rt.jar
如果PATH中没有导入$JAVA_HOME,在PATH的结尾加入:$JAVA_HOME/bin即可,冒号不要丢
5-验证jdk
执行source /etc/profile重新加载环境变量
命令行输入:
java -version
显示java版本,jdk安装完成
编译azkaban
1-下载azkaban源码包
cd /software
wget https://github.com/azkaban/azkaban/archive/master.zip
2-解压刚刚下载的zip安装包
unzip master.zip
得到文件azkaban-master
cd /software/azkaban-master/gradle/wrapper
运行wget命令下载gradle-4.1-all.zip
wget https://services.gradle.org/distributions/gradle-4.1-all.zip
vim /software/azkaban-master/gradle/wrapper/gradle-wrapper.properties
修改最后一项,只保留安装包名称
3-安装npm(不安装可能会报错):
curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -
yum install -y nodejs
4-编译
cd /software/azkaban-master
[执行下面命令开始编译,第一步7-10min,第二步1h+]
./gradlew clean
./gradlew build installDist -x test
DB的安装.(如本机已安装则直接到第三步)
第一步:添加 MariaDB yum 仓库
首先在CentOS操作系统中/etc/yum.repos.d/目录下添加 MariaDB 的YUM配置文件MariaDB.repo文件
vi /etc/yum.repos.d/MariaDB.repo
在该文件中添加以下内容保存:
[mariadb]
name = MariaDB
baseurl =http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
第二步:安装 MariaDB
通过yum命令轻松安装 MariaDB。
yum install MariaDB-server MariaDB-client -y
MariaDB 安装完毕后,立即启动数据库服务守护进程。
systemctl start mariadb
设置 MariaDB 在操作系统重启后自动启动服务。
systemctl enable mariadb
第三步: 创建azkaban库 (很关键)
输入mysql(直接回车)进入mariadb
mysql> CREATE DATABASE azkaban;
创建azkaban用户
mysql> CREATE USER'azkaban'@'%'IDENTIFIED BY 'azkaban';
给azkaban用户授权
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ONazkaban.* to 'azkaban'@'%' WITH GRANT OPTION;
加载azkaban的建表文件
mysql> use azkaban
mysql> source/software/azkaban-master/azkaban-db/build/sql/create-all-sql-0.1.0-SNAPSHOT.sql
在azkaban库中添加executors的ip/域名和端口
mysql> insert into executors(host,port)values("ip或者hostname",12321);
mysql> insert into executors(host,port)values("ip或者hostname",12321);
设置所有node的状态为1
mysql> update executors set active=1;
安装azkaban
1-拷贝出编译好的安装包
mkdir /software/azkaban
cd /software/azkaban
cp/software/azkaban-master/azkaban-web-server/build/distributions/azkaban-web-server-0.1.0-SNAPSHOT.tar.gz /softwear/azkaban
cp/software/azkaban-master/azkaban-solo-server/build/distributions/azkaban-solo-server-0.1.0-SNAPSHOT.tar.gz /softwear/azkaban
cp/software/azkaban-master/azkaban-exec-server/build/distributions/azkaban-exec-server-0.1.0-SNAPSHOT.tar.gz/softwear/azkaban
2-解压
tar -zxvfazkaban-web-server-0.1.0-SNAPSHOT.tar.gz
tar -zxvfazkaban-solo-server-0.1.0-SNAPSHOT.tar.gz
tar -zxvfazkaban-exec-server-0.1.0-SNAPSHOT.tar.gz
3-删除安装包后得到三个文件
rm -rf *.tar.gz
4-复制solo-server目录下的conf和plugins文件到web-server和executor-server
cp -r /software/azkaban/azkaban-solo-server-0.1.0-SNAPSHOT/conf/software/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/
cp -r /software/azkaban/azkaban-solo-server-0.1.0-SNAPSHOT/plugins/software/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/
cp -r /software/azkaban/azkaban-solo-server-0.1.0-SNAPSHOT/plugins/software/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT/
cp -r /software/azkaban/azkaban-solo-server-0.1.0-SNAPSHOT/conf/software/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT/
5-创建文件夹
mkdir /software/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT/extlib
mkdir /software/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/extlib
6-下载mysql-connector 到两个extlib目录下
cd /software
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz
tar -zxvf mysql-connector-java-5.1.46.tar.gz
cd mysql-connector-java-5.1.46
cp mysql-connector-java-5.1.46.jar/software/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/extlib/
cp mysql-connector-java-5.1.46.jar/software/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT/extlib/
7-配置azkaban-web-server的jetty ssl
cd /software/azkaban/azkaban-web-server-0.1.0-SNAPSHOT
[a-配置jetty ssl]
输入命令: keytool -keystore keystore -alias jetty -genkey -keyalg RSA
[输入过程如下图,里面所有的密码都是azkaban]
执行完毕后会生成一个keystore文件,要保证该文件在/software/azkaban/azkaban-web-server-0.1.0-SNAPSHOT下
[b-修改conf/azkaban.properties配置文件]
cd /software/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/conf
mv azkaban.properties azkaban.properties.bak
touch azkaban.properties
vim azkaban.properties
[复制下面的内容保存]
#cat azkaban.properties
# Azkaban Personalization Settings
azkaban.name=Test
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
# Velocity dev mode
velocity.dev.mode=false
# Azkaban Jetty server properties.
jetty.maxThreads=25
jetty.ssl.port=8443
jetty.port=8081
jetty.keystore=keystore
jetty.password=azkaban
jetty.keypassword=azkaban
jetty.truststore=keystore
jetty.trustpassword=azkaban
# Azkaban Executor settings
executor.port=12321
# mail settings
mail.sender=
mail.host=
mail.password=
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=plugins/jobtypes
database.type=mysql
mysql.port=3306
mysql.host=172.16.21.23
mysql.database=azkaban
mysql.user=root
mysql.password=123456
mysql.numconnections=100
#multiple settings
azkaban.use.multiple.executors=true
azkaban.executorselector.filters=StaticRemainingFlowSize,MinimumFreeMemory,CpuStatus
azkaban.executorselector.comparator.NumberOfAssignedFlowComparator=1
azkaban.executorselector.comparator.Memory=1
azkaban.executorselector.comparator.LastDispatched=1
azkaban.executorselector.comparator.CpuUsage=1
[c-上传log4j文件]
(也可直接拷贝\software\azkaban-master\azkaban-solo-server\src\main\resources\log4j.properties)
在conf的同级目录下创建logs文件夹.
mkdir logs
在conf目录中创建log4j.properties文件
cd conf
touch log4j.properties
vim log4j.properties
[输入下面内容保存退出]
log4j.rootLogger=DEBUG,C
log4j.appender.C=org.apache.log4j.ConsoleAppender
log4j.appender.C.Target=System.err
log4j.appender.C.layout=org.apache.log4j.PatternLayout
log4j.appender.C.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss}%-5p %c{1}:%L - %m%n
[d-启动azkaban]
cd /software/azkaban/azkaban-web-server-0.1.0-SNAPSHOT
bin/start-web.sh
启动后查看进程
8-配置executor-server
[a-配置azkaban.properties]
cd/software/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT
mvconf/azkaban.properties conf/azkaban.properties.bak
touchconf/azkaban.properties
vimconf/azkaban.properties
[输入下面的内容保存退出]
# catazkaban.properties
# AzkabanPersonalization Settings
default.timezone.id=Asia/Shanghai
# Loader forprojects
executor.global.properties=conf/global.properties
azkaban.project.dir=projects
# Azkaban pluginsettings
azkaban.jobtype.plugin.dir=plugins/jobtypes
#DB settings
database.type=mysql
mysql.port=3306
mysql.host=172.16.21.23
mysql.database=azkaban
mysql.user=root
mysql.password=123456
mysql.numconnections=100
# AzkabanExecutor settings
executor.maxThreads=50
executor.port=12321
executor.flow.threads=30
azkaban.use.multiple.executors=true
azkaban.executorselector.filters=StaticRemainingFlowSize,MinimumFreeMemory,CpuStatus
azkaban.executorselector.comparator.NumberOfAssignedFlowComparator=1
azkaban.executorselector.comparator.Memory=1
azkaban.executorselector.comparator.LastDispatched=1
azkaban.executorselector.comparator.CpuUsage=1
[b-上传log4j.properties文件]
(也可直接拷贝\software\azkaban-master\azkaban-solo-server\src\main\resources\log4j.properties)
在conf的同级目录下创建logs文件夹.
mkdir logs
在conf目录中创建log4j.properties文件
cd conf
touch log4j.properties
vim log4j.properties
[输入下面内容保存退出]
log4j.rootLogger=DEBUG,C
log4j.appender.C=org.apache.log4j.ConsoleAppender
log4j.appender.C.Target=System.err
log4j.appender.C.layout=org.apache.log4j.PatternLayout
log4j.appender.C.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss}%-5p %c{1}:%L - %m%n
[c-启动executor]
bin/start-exec.sh
启动后,jps查看进程
[d-多executor]
登录另一个节点172.16.21.24
创建对应目录
mkdir -p /
cd /software/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT
通过scp将配置好的executor整个目录拷贝即可
scp -r root:172.16.21.23:/software/azkaban/azkaban-exec-server-0.1.0-SNAPSHOT .
bin/start-exec.sh #启动executor
到此,搭建完成.
问题解决:
1-找不到可用的executor.
每次运行bin/start-exec.sh之后手动设置executor的active值为1.再去启动web-server
或者在启动脚本的最后增加shell语句设置其active值为1
进入mysql
mysql> use azkaban
mysql> update executors set active = 1;
###########2020-07-08##########
前同事遇到了同样找不到可用executor的问题,解决办法:
curl http://${executorHost}:${executorPort}/executor?action=activate
帖子地址:https://www.jianshu.com/p/5a3f31698042
2-提交azkaban job后,作业一直处于preparing状态不执行.
修改 conf/azkaban.properties 中azkaban.executorselector.filters的值为StaticRemainingFlowSize,CpuStatus
azkaban.executorselector.filters=StaticRemainingFlowSize,CpuStatus
去掉的MinimumFreeMemory选项会检查机器的可用内存是否大于6G,当机器内存小于6G时,等待执行.
3-登录时报如下错误
2018-05-22 16:54:29 WARN log:89 - EXCEPTION
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710)
at sun.security.ssl.InputRecord.read(InputRecord.java:527)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:708)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
因为登录的方式不是https,使用https://xxx.xxx.xxx.xxx:8443登录即可
参考文档:
https://blog.csdn.net/lotusctxcm/article/details/70779296?utm_source=itdadao&utm_medium=referral