1. 程式人生 > >azkaban3.43.0安裝教程(git編譯版)

azkaban3.43.0安裝教程(git編譯版)

一、環境要求

  • mysql資料庫
  • linux --git

二、下載編譯安裝

1、從Git下載原始碼

cd /root
git clone https://github.com/azkaban/azkaban.git

2、下載完成後切換到azkaban目錄下(gradlew 壓縮獲取tar包)

cd /root/azkaban

編譯

./gradlew distTar

顯示 BUILD SUCCESSFUL 壓縮成功

注:所有壓縮後的tar包都在各目錄下的/build/distributions目錄下

例如:/root/azkaban/azkaban-web-server的tar包/build/distributions 目錄下為:azkaban-web-server的tar包

3、複製所有tar包到azkaban目錄下


cp /root/azkaban/azkaban-*/build/distributions/*.tar.gz  /root/azkaban

cd /root/azkaban

tar zxvf azkaban-exec-server-0.1.0-SNAPSHOT.tar.gz
tar zxvf azkaban-web-server-0.1.0-SNAPSHOT.tar.gz
tar zxvf azkaban-db-0.1.0-SNAPSHOT.tar.gz


4、匯入表到Mysql資料庫

(sql檔案為:/root/azkaban/azkaban-db/build/sql目錄下create-all-sql-3.46.0-2-gf9ec3aa.sql檔案) 

5、生成keystore檔案

cd /root/keystore

keytool -keystore keystore -alias jetty -genkey -keyalg RSA

輸入金鑰庫口令:(輸入keystore)  
再次輸入新口令: (輸入keystore)
您的名字與姓氏是什麼?
  [Unknown]:  
您的組織單位名稱是什麼?
  [Unknown]:  
您的組織名稱是什麼?
  [Unknown]:  
您所在的城市或區域名稱是什麼?
  [Unknown]:  
您所在的省/市/自治區名稱是什麼?
  [Unknown]:  
該單位的雙字母國家/地區程式碼是什麼?
  [Unknown]:  CN
CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=CN是否正確?
  [否]:  y

輸入 <jetty> 的金鑰口令
	(如果和金鑰庫口令相同, 按回車): (回車)

6、配置conf/azkaban.properties:

如果Azkaban WebServer下面沒有conf目錄,將azkaban-solo-web 下的conf目錄拷貝過來


# 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=/root/azkaban/azkaban-web-server-3.43.0/conf/azkaban-users.xml
# Loader for projects
executor.global.properties=/root/azkaban/azkaban-web-server-3.43.0/conf/global.properties
azkaban.project.dir=projects
project.temp.dir=temp
trigger.plugin.dir=/root/azkaban/azkaban-web-server-3.43.0/plugins/triggers
#database.type=h2
#h2.path=./h2
#h2.create.tables=true
database.type=mysql
mysql.port=3306
mysql.host=192.168.66.170
mysql.database=azkaban
mysql.user=root
mysql.password=sql_9879
mysql.numconnections=100
# Velocity dev mode
velocity.dev.mode=false
# Azkaban Jetty server properties.
jetty.maxThreads=25
jetty.ssl.port=8666
jetty.port=8081
jetty.keystore=web/keystore
jetty.password=123456
jetty.keypassword=123456
jetty.truststore=web/keystore
jetty.trustpassword=123456
jetty.excludeCipherSuites=SSL_RSA_WITH_DES_CBC_SHA,SSL_DHE_RSA_WITH_DES_CBC_SHA,SSL_DHE_DSS_WITH_DES_CBC_SHA,SSL_RSA_EXPORT_WITH_RC4_40_MD5,SSL_RSA_EXPORT_WITH_DES40_CBC_SHA,SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA,SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA,SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA,TLS_DHE_RSA_WITH_AES_256_CBC_SHA256,TLS_DHE_DSS_WITH_AES_256_CBC_SHA256,TLS_DHE_RSA_WITH_AES_256_CBC_SHA,TLS_DHE_DSS_WITH_AES_256_CBC_SHA,TLS_DHE_RSA_WITH_AES_128_CBC_SHA256,TLS_DHE_DSS_WITH_AES_128_CBC_SHA256,TLS_DHE_RSA_WITH_AES_128_CBC_SHA,TLS_DHE_DSS_WITH_AES_128_CBC_SHA

#jetty.use.ssl=false
#jetty.maxThreads=25
#jetty.port=8081
# Azkaban Executor settings
executor.port=12321
# mail settings
[email protected] 
mail.host=smtp.163.com
[email protected]
[email protected]
# 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

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



5.修改azkabanazkaban-web-server-3.43.0檔案

(1)複製conf目錄到/root/azkaban/azkaban-exec-server-3.43.0/目錄下

cd /root/azkaban
cp conf /root/azkabanazkaban-web-server-3.43.0/

(2)azkaban-web-server 配置azkaban.properties檔案

cd /root/azkaban/azkaban-exec-server-3.43.0/conf

內容如下(注將時區:default.timezone.id 改為Asia/Shanghai):

#Azkaban
default.timezone.id=Asia/Shanghai

# Azkaban JobTypes Plugins
azkaban.jobtype.plugin.dir=/root/azkaban/azkaban-exec-server-3.43.0/plugins/azkaban-jobtype-2.5.0

#Loader for projects
executor.global.properties=/root/azkaban/azkaban-exec-server-3.43.0/conf/global.properties
azkaban.project.dir=projects
azkaban.execution.dir=executions
project.temp.dir=temp

database.type=mysql
mysql.port=3306
mysql.host=192.168.66.170
mysql.database=azkaban
mysql.user=root
mysql.password=sql_9879
mysql.numconnections=100

# Azkaban Executor settings
executor.maxThreads=50
executor.port=12321
executor.flow.threads=30

如果啟動時報錯

報錯:Exception: java.lang.StackOverflowError thrown from the UncaughtExceptionHandler in thread “main”

解決方式:在Azkaban-web-server 的conf目錄下建立資料夾conf/log4j.properties:
log4j.rootLogger=INFO,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

7.訪問並輸入

賬號:azkaban 密碼:azkaban

https://192.168.66.194:8666

(賬號密碼設定修改在 /root/azkaban/azkaban-web-server-3.43.0/conf/azkaban-users.xml中配置)

<azkaban-users>
	<user username="azkaban" password="azkaban" roles="admin" groups="azkaban" />
	<user username="metrics" password="metrics" roles="metrics"/>
	<user username="admin" password="admin" roles="admin,metrics" />
	<role name="admin" permissions="ADMIN" />
	<role name="metrics" permissions="METRICS"/>
</azkaban-users>

出現以下頁面部署成功:

7、 Azkaban Executor Server 安裝和配置

進入azkaban-executor-server目錄,將azkaban-web-server下的conf目錄拷貝到該目錄下

1)配置executor端的azkaban.properties

#Azkaban
default.timezone.id=Asia/Shanghai

# Azkaban JobTypes Plugins
azkaban.jobtype.plugin.dir=/root/azkaban/azkaban-exec-server-3.43.0/plugins/azkaban-jobtype-2.5.0

#Loader for projects
executor.global.properties=/root/azkaban/azkaban-exec-server-3.43.0/conf/global.properties
azkaban.project.dir=projects
azkaban.execution.dir=executions
project.temp.dir=temp

database.type=mysql
mysql.port=3306
mysql.host=192.168.66.170
mysql.database=azkaban
mysql.user=root
mysql.password=sql_9879
mysql.numconnections=100

# Azkaban Executor settings
executor.maxThreads=50
executor.port=12321
executor.flow.threads=30

6.啟動 Web Server和 Executor Server


sh bin/azkaban-executor-start.sh 

錯誤解決

執行一個demo,發現報錯 Missing required property 'azkaban.native.lib'

在官網中有這樣一段話:
Plugin Configurations
Execute-As-User
With a new security enhancement in Azkaban 3.0, Azkaban jobs can now run as the submit user or the user.to.proxy of the flow by default. This ensures that Azkaban takes advantage of the Linux permission security mechanism, and operationally this simplifies resource monitoring and visibility. Set up this behavior by doing the following:-
Execute.as.user is set to true by default. In case needed, it can also be configured to false in azkaban-plugin’s commonprivate.properties
Configure azkaban.native.lib= to the place where you are going to put the compiled execute-as-user.c file (see below)
Generate an executable on the Azkaban box for azkaban-common/src/main/c/execute-as-user.c. it should be named execute-as-user Below is a sample approach
scp ./azkaban-common/src/main/c/execute-as-user.c onto the Azkaban box
run: gcc execute-as-user.c -o execute-as-user
run: chown root execute-as-user (you might need root privilege)
run: chmod 6050 execute-as-user (you might need root privilege)
但是在最新的版本里面沒有這個 execute-as-user.c 檔案了

解決方法:
a) 先關閉兩個服務
b) 在編譯好的  azkaban-solo-server 中將 plugins/jobtypes/commonprivate.properties 連帶目錄直接拷貝到
azkaban-exec-server 目錄中,並在 commonprivate.properties 新增一條 azkaban.native.lib=false
commonprivate.properties 中有兩條記錄:
execute.as.user=false
azkaban.native.lib=false