天天看點

黑猴子的家:Centos7 安裝部署 Azkaban 3.84.4

1、準備好安裝包

[[email protected] azkaban_tar.gz]$ pwd
/opt/software/azkaban_tar.gz
[[email protected] azkaban_tar.gz]$ ls -l
-rw-rw-r-- 1 alex alex     3876 May 20 13:32 azkaban-db-3.84.4.tar.gz
-rw-rw-r-- 1 alex alex 15766958 May 20 13:32 azkaban-exec-server-3.84.4.tar.gz
-rw-rw-r-- 1 alex alex 20003240 May 20 13:33 azkaban-web-server-3.84.4.tar.gz
           

選擇Mysql作為Azkaban資料庫,因為Azkaban建立了一些Mysql連接配接增強功能,以友善Azkaban設定,并增強服務可靠性。

2、建立安裝目錄

[[email protected] module]$ mkdir azkaban
           

3、解壓安裝包

[[email protected] software]$ tar -xzvf azkaban_tar.gz/azkaban-web-server-3.84.4.tar.gz -C ../module/azkaban
[[email protected] software]$ tar -xzvf azkaban_tar.gz/azkaban-exec-server-3.84.4.tar.gz -C ../module/Azkaban
[[email protected] software]$ tar -xzvf azkaban_tar.gz/azkaban-db-3.84.4.tar.gz -C ../module/azkaban
           

4、修改名稱

[[email protected] azkaban]$ mv azkaban-db-3.84.4 azkaban-db
[[email protected] azkaban]$ mv azkaban-web-server-3.84.4 azkaban-web-server
[[email protected] azkaban]$ mv azkaban-exec-server-3.84.4 azkaban-exec-server
           

5、發送sql檔案

[[email protected] azkaban-db]$ scp -r create-all-sql-3.84.4.sql [email protected]:/opt/software/
           

6、azkaban腳本導入

進入mysql,建立azkaban資料庫,并将解壓的腳本導入到azkaban資料庫。

[[email protected] ~]$ vim /etc/my.cnf
[mysqld]
max_allowed_packet=1024M
[[email protected] ~]$ sudo systemctl restart mysqld
[[email protected] ~]$ mysql -hhadoop103 -P3306 -uroot -p000000
mysql> drop database if exists azkaban;
mysql> create database azkaban;
mysql> show databases;
mysql> use azkaban;
mysql> source /opt/software/create-all-sql-0.1.0-SNAPSHOT.sql
mysql> show tables;
           

尖叫提示:這裡可以使用navicat 連接配接一下試一試

source後跟.sql檔案,用于批量處理.sql檔案中的sql語句

7、生成密鑰庫

keystore 是java 的一個工具,生成密鑰庫後,拷貝到azkaban 的web 服務裡面

1)生成 keystore的密碼及相應資訊的密鑰庫

[[email protected] azkaban]$ keytool -keystore keystore -alias jetty -genkey -keyalg RSA
           

注意:

密鑰庫的密碼至少必須6個字元,可以是純數字或者字母或者數字和字母的組合等等

密鑰庫的密碼最好和<jetty> 的密鑰相同,友善記憶

2)将keystore 拷貝到 azkaban web伺服器根目錄中

[[email protected] azkaban]$ mv keystore azkaban-web-server/
           

Keytool是java資料證書的管理工具,使使用者能夠管理自己的公/私鑰對及相關證書。

keystore 指定密鑰庫的名稱及位置(産生的各類資訊将不在.keystore檔案中)

-genkey 在使用者主目錄中建立一個預設檔案".keystore"

-alias 對我們生成的.keystore 進行指認别名;如果沒有預設是mykey

-keyalg 指定密鑰的算法 RSA/DSA 預設是DSA

8、時間同步配置

先配置好伺服器節點上的時區

1)tzselect

如果在/usr/share/zoneinfo/這個目錄下不存在時區配置檔案Asia/Shanghai,就要用 tzselect 生成。

[[email protected] azkaban]$ date -R
Thu, 20 May 2021 15:25:30 +0800

[[email protected] azkaban]$ tzselect
Please identify a location so that time zone rules can be set correctly.
Please select a continent or ocean.
 1) Africa
 2) Americas
 3) Antarctica
 4) Arctic Ocean
 5) Asia
 6) Atlantic Ocean
 7) Australia
 8) Europe
 9) Indian Ocean
10) Pacific Ocean
11) none - I want to specify the time zone using the Posix TZ format.
#? 5
Please select a country.
 1) Afghanistan           18) Israel                35) Palestine
 2) Armenia               19) Japan                 36) Philippines
 3) Azerbaijan            20) Jordan                37) Qatar
 4) Bahrain               21) Kazakhstan            38) Russia
 5) Bangladesh            22) Korea (North)         39) Saudi Arabia
 6) Bhutan                23) Korea (South)         40) Singapore
 7) Brunei                24) Kuwait                41) Sri Lanka
 8) Cambodia              25) Kyrgyzstan            42) Syria
 9) China                 26) Laos                  43) Taiwan
10) Cyprus                27) Lebanon               44) Tajikistan
11) East Timor            28) Macau                 45) Thailand
12) Georgia               29) Malaysia              46) Turkmenistan
13) Hong Kong             30) Mongolia              47) United Arab Emirates
14) India                 31) Myanmar (Burma)       48) Uzbekistan
15) Indonesia             32) Nepal                 49) Vietnam
16) Iran                  33) Oman                  50) Yemen
17) Iraq                  34) Pakistan
#? 9
Please select one of the following time zone regions.
1) Beijing Time
2) Xinjiang Time
#? 1

The following information has been given:

        China
        Beijing Time

Therefore TZ='Asia/Shanghai' will be used.
Local time is now:      Thu Oct 18 16:24:23 CST 2018.
Universal Time is now:  Thu Oct 18 08:24:23 UTC 2018.
Is the above information OK?
1) Yes
2) No
#? 1

You can make this change permanent for yourself by appending the line
        TZ='Asia/Shanghai'; export TZ
to the file '.profile' in your home directory; then log out and log in again.

Here is that TZ value again, this time on standard output so that you
can use the /usr/bin/tzselect command in shell scripts:
Asia/Shanghai
           

2)拷貝該時區檔案,覆寫系統本地時區配置

[[email protected] azkaban]$ cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
           

3)叢集時間同步(同時發給三個視窗)

[[email protected] azkaban]$ sudo date -s '2021-05-20 16:39:30'
           

9、azkaban-web-server 修改配置檔案

1)azkaban.properties

[[email protected] ~]$ cd /opt/module/azkaban/azkaban-web-server/conf/
[[email protected] conf]$ pwd
/opt/module/azkaban/azkaban-web-server/conf

[[email protected] conf]$ ll
-rw-rw-r-- 1 alex alex 1946 Sep 25  2018 azkaban.properties
-rw-rw-r-- 1 alex alex  267 Sep 25  2018 azkaban-users.xml
-rw-rw-r-- 1 alex alex    0 Sep 25  2018 global.properties
-rw-rw-r-- 1 alex alex  644 Sep 25  2018 log4j.properties

[[email protected] conf]$ vim azkaban.properties

default.timezone.id=Asia/Shanghai

database.type=mysql
mysql.port=3306
mysql.host=hadoop103
mysql.database=azkaban
mysql.user=root
mysql.password=000000
mysql.numconnections=100

azkaban.executorselector.filters=StaticRemainingFlowSize,CpuStatus
           

2)azkaban-users.xml

[[email protected] conf]$ pwd
/opt/module/azkaban/azkaban-web-server/conf

[[email protected] conf]$ vim azkaban-users.xml
<azkaban-users>
  <user groups="azkaban" password="azkaban" roles="admin" username="azkaban"/>
  <user password="metrics" roles="metrics" username="metrics"/>
  <user username="admin" password="admin" roles="admin,metrics" />
  <role name="admin" permissions="ADMIN"/>
  <role name="metrics" permissions="METRICS"/>
</azkaban-users>
           

尖叫提示:增加管理者使用者

3)log4j.properties

[[email protected] conf]$ pwd
/opt/module/azkaban/azkaban-web-server/conf

[[email protected] conf]$ vim log4j.properties
log4j.appender.server.File=/opt/module/azkaban/azkaban-web-server/logs/azkaban-webserver.log
           

10、azkaban-exec-server修改配置檔案

1)azkaban.properties

[[email protected] conf]$ pwd
/opt/module/azkaban/azkaban-exec-server/conf

[[email protected] conf]$ vim azkaban.properties

default.timezone.id=Asia/Shanghai

azkaban.webserver.url=http://hadoop102:8081

database.type=mysql
mysql.port=3306
mysql.host=hadoop103
mysql.database=azkaban
mysql.user=root
mysql.password=000000
mysql.numconnections=100

executor.port=12321
executor.metric.reports=true
executor.metric.milisecinterval.default=60000
           

2)log4j.properties

[[email protected] conf]$ vim log4j.properties
log4j.appender.server.File=/opt/module/azkaban/azkaban-exec-server/logs/azkaban-execserver.log
           

3)commonprivate.properties

[[email protected] jobtypes]$ pwd
/opt/module/azkaban/azkaban-exec-server/plugins/jobtypes
[[email protected] jobtypes]$ vim commonprivate.properties 
azkaban.native.lib=false
memCheck.enabled=false
           

若不添加這個參數,在執行Job時會報錯

azkaban.utils.UndefinedPropertyException: Missing required property 'azkaban.native.lib'
  at azkaban.utils.Props.getString(Props.java:450)
  at azkaban.jobExecutor.ProcessJob.run(ProcessJob.java:242)
  at azkaban.execapp.JobRunner.runJob(JobRunner.java:823)
  at azkaban.execapp.JobRunner.doRun(JobRunner.java:602)
  at azkaban.execapp.JobRunner.run(JobRunner.java:563)
  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)
           

11、分發

[[email protected] azkabn]$ xsync.sh azkaban-exec-server/
           

12、啟動Azkaban

先啟動azkaban-exec-serve,再啟動azkaban-web-server

因為要避免Web Server因為找不到執行器而啟動失敗

1)啟動azkaban-exec-serve

[[email protected] azkaban-exec-server]$ bin/start-exec.sh
[[email protected] azkaban-exec-server]$ bin/start-exec.sh
[[email protected] azkaban-exec-server]$ bin/start-exec.sh
           

尖叫提示:如果在/opt/module/azkaban/azkaban-exec-serve目錄下出現executor.port檔案,說明啟動成功

2)需要激活executor

[[email protected] azkaban-exec-server]$ curl -G "hadoop102:$(<./executor.port)/executor?action=activate" && echo
{"status":"success"}

[[email protected] azkaban-exec-server]$ curl -G "hadoop103:$(<./executor.port)/executor?action=activate" && echo
{"status":"success"}

[[email protected] azkaban-exec-server]$ curl -G "hadoop104:$(<./executor.port)/executor?action=activate" && echo
{"status":"success"}
           

尖叫提示:每次重新啟動azkaban-exec-server的時候,都需要激活一下

3)修改executors表 active字段的狀态

mysql> use azkaban;
mysql> update executors set active=1;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

mysql> select * from executors;
+----+-----------+-------+--------+
| id | host      | port  | active |
+----+-----------+-------+--------+
|  1 | hadoop102 | 42680 |      1 |
|  4 | hadoop103 | 43817 |      1 |
|  5 | hadoop104 | 42601 |      1 |
+----+-----------+-------+--------+
3 rows in set (0.00 sec)
           

尖叫提示:azkaban 不能使用shutdown-exec.sh 和 shutdown-web.sh 來關閉服務,因為關閉服務的時候,會修改active狀态為0,是以推薦使用kill -9 pid來關閉服務

4)啟動azkaban-web-server服務

[[email protected] azkaban-web-server]$ bin/start-web.sh
           

5)浏覽器通路

https://hadoop102:8443/
http://hadoop102:8081/
           
黑猴子的家:Centos7 安裝部署 Azkaban 3.84.4

尖叫提示:使用者名和密碼都是admin

6)登陸成功

黑猴子的家:Centos7 安裝部署 Azkaban 3.84.4

7)控制台檢視

[[email protected] azkaban-web-server]$ jps
22114 Jps
15396 AzkabanExecutorServer
18276 AzkabanWebServer