azkaban多個executor部署

azkaban多個executor部署

多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數據庫,並且完成初始化

初始化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                 |
+--------------------------+
初始化完成

Azkaban webserver安裝配置

在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 <jetty>        
(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-users>
  <user groups="azkaban" password="azkaban" roles="admin" username="azkaban"/>
  <user password="metrics" roles="metrics" username="metrics"/>
  <user password="admin" roles="metrics,admin" username="admin"/>
  <role name="admin" permissions="ADMIN"/>
  <role name="metrics" permissions="METRICS"/>
</azkaban-users>
多個用戶添加多行即可。

Azkaban executor的安裝配置

在hadoop02、hadoop03上安裝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都已經安裝完成。

多executor的測試

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協議!!!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章