多executor部署介绍
Azkaban3.0+版本提供了三种安装模式:
单solo-server mode:单机模式,适合开发使用。使用内置的h2数据库,
web server和executor server在同一个进程里; two server mode:双机模式,适合生产环境。使用主从的MySQL做元数据存储,web server和 executor server在不同的进程中,更新和升级对用户的影响较小;
multiple-executor mode:多executor模式,最严格的生产环境。使用主从的MySQL做元数据存 储。理想情况下,web server和executor server在不同的主机上运行,以便升级维护不影响用 户。这种模式为azkaban提供了高可用可扩展的功能。
官网参考地址:https://azkaban.github.io/azkaban/docs/latest/#getting-started
hadoop01:webServer
hadoop02:executor mysql
hadoop03:executor
初始化Azkaban数据库: Azkaban使用MySQL做元数据存储,去MySQL Server创建azkaban数据库,并且完成初始化
1、创建azkaban数据库
mysql -u root -h hadoop-02 -p
进入mysql
create database azkaban
2、解压编译好的azkaban-db-xxx.tar.gz包
[root@hadoop01 azkaban]# pwd /usr/local/azkaban
[root@hadoop01 azkaban]# tar -zxvf /usr/local/azkaban3.57.0/azkaban-db-0.1.0SNAPSHOT.tar.gz -C /usr/local/azkaban
3,初始化azkaban数据库
mysql> use azkaban;
Database changed
mysql> source /usr/local/azkaban/azkaban-db-0.1.0-SNAPSHOT/create-all-sql-0.1.0SNAPSHOT.sql;
mysql> show tables;
+--------------------------+
| Tables_in_azkaban |
+--------------------------+
| QRTZ_BLOB_TRIGGERS |
| QRTZ_CALENDARS |
| QRTZ_CRON_TRIGGERS |
| QRTZ_FIRED_TRIGGERS |
| QRTZ_JOB_DETAILS |
| QRTZ_LOCKS |
| QRTZ_PAUSED_TRIGGER_GRPS |
| QRTZ_SCHEDULER_STATE |
| QRTZ_SIMPLE_TRIGGERS |
| QRTZ_SIMPROP_TRIGGERS |
| QRTZ_TRIGGERS |
| active_executing_flows |
| active_sla |
| execution_dependencies |
| execution_flows |
| execution_jobs |
| execution_logs |
| executor_events |
| executors |
| project_events |
| project_files |
| project_flow_files |
| project_flows |
| project_permissions |
| project_properties |
| project_versions |
| projects |
| properties |
| triggers |
+--------------------------+
初始化完成
在hadoop01上安装webs-server模块。
1、解压
[root@hadoop01 azkaban]# tar -zxvf /usr/local/azkaban3.57.0/azkaban-web-server-0.1.0SNAPSHOT.tar.gz -C /usr/local/azkaban
[root@hadoop01 azkaban]# mv ./azkaban-web-server-0.1.0-SNAPSHOT/ ./web-server [root@hadoop01 azkaban]# cd ./web-server/
2、mysql连接的驱动包(自己下载mysql的驱动包)
[root@hadoop01 web-server]# mkdir ./extlib
[root@hadoop01 web-server]# cp mysql-connector-java-5.1.6-bin.jar ./extlib/
3、生成ssl证书
[root@hadoop01 web-server]# keytool -keystore keystore -alias jetty -genkey keyalg RSA
Enter keystore password: azkaban
Re-enter new password: azkaban
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
(RETURN if same as keystore password):
Re-enter new password:
如果不在web-server目录生成的keystore,则需要将生成的keystore文件拷贝到该目录即可。
密码很重要记住自己设的密码:我的密码是azkaban
4、修改azkaban.properties(使用绝对路径!!!!!!!)
# Azkaban Personalization Settings
azkaban.name=Test
azkaban.label=My Local Azkaban
azkaban.color=#FF3601
azkaban.default.servlet.path=/index
web.resource.dir=/usr/local/azkaban/web-server/web/
default.timezone.id=Asia/Shanghai
# Azkaban UserManager class
user.manager.class=azkaban.user.XmlUserManager
user.manager.xml.file=/usr/local/azkaban/web-server/conf/azkaban-users.xml
# Loader for projects
executor.global.properties=/usr/local/azkaban/executor/conf/global.properties
azkaban.project.dir=projects
# Velocity dev mode
velocity.dev.mode=false
# Azkaban Jetty server properties.
jetty.use.ssl=true
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
# mail settings
mail.sender=
mail.host=
# User facing web server configurations used to construct the user facing server URLs. They are useful when there is a reverse proxy between Azkaban web servers and users.
# enduser -> myazkabanhost:443 -> proxy -> localhost:8081
# when this parameters set then these parameters are used to generate email links.
# if these parameters are not set then jetty.hostname, and jetty.port(if ssl configured jetty.ssl.port) are used.
# azkaban.webserver.external_hostname=myazkabanhost.com
# azkaban.webserver.external_ssl_port=443
# azkaban.webserver.external_port=8081
job.failure.email=
job.success.email=
lockdown.create.projects=false
cache.directory=cache
# JMX stats
jetty.connector.stats=true
executor.connector.stats=true
# Azkaban mysql settings by default. Users should configure their own username and password.
database.type=mysql
mysql.port=3306
mysql.host=hadoop-02
mysql.database=azkaban
mysql.user=root
mysql.password=123456
mysql.numconnections=100
#Multiple Executor
azkaban.use.multiple.executors=true
azkaban.executorselector.filters=StaticRemainingFlowSize,CpuStatus
azkaban.executorselector.comparator.NumberOfAssignedFlowComparator=1
azkaban.executorselector.comparator.Memory=1
azkaban.executorselector.comparator.LastDispatched=1
azkaban.executorselector.comparator.CpuUsage=1
5、修改azkaban-users.xml
多个用户添加多行即可。
Azkaban executor的安装配置
1、将压缩包分发到要安装executor的服务器上
[root@hadoop01 web-server]# scp -r /usr/local/azkaban3.57.0/azkaban-exec-server0.1.0-SNAPSHOT.tar.gz ./mysql-connector-java-5.1.6-bin.jar hadoop02:/usr/local
[root@hadoop01 web-server]# scp -r /usr/local/azkaban3.57.0/azkaban-exec-server0.1.0-SNAPSHOT.tar.gz ./mysql-connector-java-5.1.6-bin.jar hadoop03:/usr/local/
2、分别到hadoop02、hadoop03去解压executor的压缩包
[root@hadoop02 local]# mkdir /usr/local/azkaban
[root@hadoop02 local]# cd /usr/local/azkaban/
[root@hadoop02 azkaban]# tar -zxvf /usr/local/azkaban-exec-server-0.1.0SNAPSHOT.tar.gz -C /usr/local/azkaban/
[root@hadoop02 azkaban]# mv ./azkaban-exec-server-0.1.0-SNAPSHOT/ ./executor [root@hadoop02 azkaban]# cd ./executor/
====hadoop03上执行如上操作 ==========
[root@hadoop02 executor]# mkdir ./extlib
[root@hadoop02 executor]# cp /usr/local/mysql-connector-java-5.1.6-bin.jar ./extlib/
====hadoop03上执行如上命令
3、分别到hadoop02、hadoop03中配置azkaban.properties(绝对路径)
# Azkaban Personalization Settings
azkaban.name=Test
azkaban.label=My Local Azkaban
azkaban.color=#FF3601
azkaban.default.servlet.path=/index
web.resource.dir=/usr/local/azkaban/web-server/web/
default.timezone.id=Asia/Shanghai
# Azkaban UserManager class
user.manager.class=azkaban.user.XmlUserManager
user.manager.xml.file=/usr/local/azkaban/web-server/conf/azkaban-users.xml
# Loader for projects
executor.global.properties=/usr/local/azkaban/executor/conf/global.properties
azkaban.project.dir=projects
# Velocity dev mode
velocity.dev.mode=false
# Azkaban Jetty server properties.
jetty.use.ssl=false
jetty.maxThreads=25
jetty.port=8081
executor.maxThreads=50
executor.port=12321
# Where the Azkaban web server is located
azkaban.webserver.url=http://localhost:8081
# mail settings
mail.sender=
mail.host=
# User facing web server configurations used to construct the user facing server URLs. They are useful when there is a reverse proxy between Azkaban web servers and users.
# enduser -> myazkabanhost:443 -> proxy -> localhost:8081
# when this parameters set then these parameters are used to generate email links.
# if these parameters are not set then jetty.hostname, and jetty.port(if ssl configured jetty.ssl.port) are used.
# azkaban.webserver.external_hostname=myazkabanhost.com
# azkaban.webserver.external_ssl_port=443
# azkaban.webserver.external_port=8081
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/azkaban/executor/plugins/jobtypes
# Azkaban mysql settings by default. Users should configure their own username and password.
database.type=mysql
mysql.port=3306
mysql.host=hadoop-02
mysql.database=azkaban
mysql.user=root
mysql.password=123456
mysql.numconnections=100
# Azkaban Executor settings
executor.maxThreads=50
executor.flow.threads=30
4、向azkaban数据库中插入executor节点
在数据库中配置Multiple Executor模式,多个executor就写入多条记录
[root@hadoop01 ~]# mysql -uroot -p123456
mysql> use azkaban;
mysql> insert into executors (host,port,active) values ('hadoop02','12321',1);
mysql> insert into executors (host,port,active) values ('hadoop03','12321',1);
azkaban-web-server和azkaban-exec-server都已经安装完成。
Azkaban启动的顺序为,先启动executor,再启动web。否则web工程会因为找不到executor而启动失 败。
[root@hadoop02 executor]# ./bin/start-exec.sh
[root@hadoop02 executor]# jps 1945 Jps 1934 AzkabanExecutorServer
===hadoop03上执行如上命令
[root@hadoop03 executor]# ./bin/start-exec.sh
[root@hadoop03 executor]# jps
86196 Jps
84583 AzkabanExecutorServer
启动web
[root@hadoop01 web-server]# ./bin/start-web.sh
[root@hadoop01 web-server]# jps
737 Jps
128816 AzkabanWebServer
访问web测试 ssl访问地址:https://hadoop01:8443
一定是https协议!!!