首先将我们的安装包下载下来,总共是4个,一个是web,一个是executor,一个是solo,一个是sql
然后解压到我们的linux机器上
1. 为Azkaban创建一个数据库:
mysql> CREATE DATABASE azkaban;
2. 为Azkaban创建一个数据库用户:
mysql> CREATE USER ''@'%' IDENTIFIED BY '';
出现上述原因:
错误是由于你曾经升级过数据库,升级完后没有使用
mysql_upgrade升级数据结构造成的。
使用mysql_upgrade命令
root@localhost ~]# mysql_upgrade -u root -p 13456
3. 为用户赋予Azkaban数据库的增删查改的权限:
mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON .* to ''@'%' WITH GRANT OPTION;
mysql>grant all privileges on *.* to 'haha'@'%' identified by 'password' with grant option;
4. 将azkaban sql表结构导入mysql
该文件位于解压后的 azkaban-db 目录下。(一定是带all的sql文件)
mysql> use azkaban;
mysql> source /opt/azkaban/azkaban-db-0.1.0-SNAPSHOT/create-all-sql-0.1.0-SNAPSHOT.sq
第二步:配置keystore
在azkaban-web-server目录下执行这条命令,在执行完这条命令之后,会生成一个文件:keystore 并将该生成的文件复制到azkaban-web-server的bin目录下
[root@hadoop1 azkaban-web-server-0.1.0-SNAPSHOT]# keytool -keystore keystore -alias jetty -genkey -keyalg RSA
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: firstName
What is the name of your organizational unit?
[Unknown]: companyName
What is the name of your organization?
[Unknown]: groupName
What is the name of your City or Locality?
[Unknown]: shanghai
What is the name of your State or Province?
[Unknown]: shanghai
What is the two-letter country code for this unit?
[Unknown]: CN
Is CN=firstName, OU=companyName, O=groupName, L=shanghai, ST=shanghai, C=CN correct?
[no]: Y
Enter key password for
(RETURN if same as keystore password):
Re-enter new password:
[root@hadoop1 azkaban-web-server-0.1.0-SNAPSHOT]#
keystore 并将该生成的文件复制到azkaban-web-server的bin目录下
[root@hadoop1 azkaban-web-server-0.1.0-SNAPSHOT]# cp keystore bin/
以上配置完成之后会在当前目录生成一个keystore文件。以下配置会用到。
# Azkaban Personalization Settings
azkaban.name=THE_BIGDATA
azkaban.label=My Local Azkaban
azkaban.color=#FF3601
azkaban.default.servlet.path=/index
web.resource.dir=/opt/azkaban3.65/azkaban-web-server/web/
default.timezone.id=Asia/Shanghai
# Azkaban UserManager class
user.manager.class=azkaban.user.XmlUserManager
user.manager.xml.file=/opt/azkaban3.65/azkaban-web-server/conf/azkaban-users.xml
# Loader for projects
executor.global.properties=/opt/azkaban3.65/azkaban-web-server/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
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=localhost
mysql.database=azkaban
mysql.user=azkaban
mysql.password=azkaban
mysql.numconnections=100
# Azkaban Executor settings
executor.port=12321
#Multiple Executor
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
注意:
配置的默认时区是:default.timezone.id=America/Los_Angeles 修改为:default.timezone.id=Asia/Shanghai
相对路径改为绝对路径
user.manager.xml.file=conf/azkaban-users.xml
executor.global.properties=conf/global.properties
azkaban.jobtype.plugin.dir=/opt/azkaban/azkaban-web-server-0.1.0-SNAPSHOT/plugins/jobtypes
修改start-web.sh 将我们的log输出文件改成logs/下
进入 azkaban web 服务器 conf 目录, azkaban-users.xml ,管理用户:
修改azkaban.properties配置文件和web相同
在这种模式下,先要启动exec-server,再启动web-server
如果显示没有executor那么就需要手动将数据库中executors的active改为1
这里注意在配置azkaban.properties得时候 需要加azkaban.jobtype.plugin.dir=plugins/jobtypes这一项一定要配置,并且创建文件夹,不然会报错,
总结几个坑
mail.sender、mail.host、mail.user、mail.password这四项每一项配置都不能少,端口可以不配置,而且mail.sender和mail.user的值是一样的,少一项或者配错一项都会报出错误,错误信息如下:
2018/12/28 15:56:01.187 +0800 ERROR [EmailMessage] [Azkaban] Connecting to SMTP server failed, attempt: 0
javax.mail.AuthenticationFailedException: 500 Error: bad syntax
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:823)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:756)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:673)
at javax.mail.Service.connect(Service.java:295)
at azkaban.utils.JavaxMailSender.connect(JavaxMailSender.java:34)
at azkaban.utils.EmailMessage.connectToSMTPServer(EmailMessage.java:220)
at azkaban.utils.EmailMessage.retryConnectToSMTPServer(EmailMessage.java:230)
at azkaban.utils.EmailMessage.sendEmail(EmailMessage.java:213)
at azkaban.utils.Emailer.sendEmail(Emailer.java:220)
at azkaban.utils.Emailer.alertOnSuccess(Emailer.java:153)
at azkaban.executor.selector.ExecutionControllerUtils.alertUser(ExecutionControllerUtils.java:123)
at azkaban.executor.ExecutionFinalizer.finalizeFlow(ExecutionFinalizer.java:98)
at azkaban.executor.RunningExecutionsUpdater.updateExecutions(RunningExecutionsUpdater.java:131)
at azkaban.executor.RunningExecutionsUpdaterThread.run(RunningExecutionsUpdaterThread.java:54)
在网上看到一个说这个错误信息解决方法的,要改源码,其实是配置信息写错了。
azkaban.jobtype.plugin.dir=plugins/jobtypes这一项一定要配置,并且创建文件夹,不然会报错,错误信息如下:
2018/12/28 15:50:30.898 +0800 ERROR [FlowTriggerScheduler] [Azkaban] unable to get scheduled flow triggers
java.lang.NullPointerException
at azkaban.flowtrigger.quartz.FlowTriggerScheduler.getScheduledFlowTriggerJobs(FlowTriggerScheduler.java:132)
at azkaban.webapp.servlet.FlowTriggerServlet.handlePage(FlowTriggerServlet.java:140)
at azkaban.webapp.servlet.FlowTriggerServlet.handleGet(FlowTriggerServlet.java:55)
at azkaban.webapp.servlet.LoginAbstractAzkabanServlet.doGet(LoginAbstractAzkabanServlet.java:123)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:713)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.j
或者报native executor not 存在
Multiple Executor的几项必须配置,不然的话会报出以下错误:
2018/12/28 15:43:28.406 +0800 ERROR [StdOutErrRedirect] [Azkaban] Exception in thread "main"
2018/12/28 15:43:28.406 +0800 ERROR [StdOutErrRedirect] [Azkaban] java.lang.IllegalArgumentException: azkaban.use.multiple.executors must be true. Single executor mode is not supported any more.
2018/12/28 15:43:28.407 +0800 ERROR [StdOutErrRedirect] [Azkaban] at azkaban.executor.ExecutorManager.checkMultiExecutorMode(ExecutorManager.java:240)
2018/12/28 15:43:28.407 +0800 ERROR [StdOutErrRedirect] [Azkaban] at azkaban.executor.ExecutorManager.setupExecutors(ExecutorManager.java:229)
2018/12/28 15:43:28.407 +0800 ERROR [StdOutErrRedirect] [Azkaban] at azkaban.executor.ExecutorManager.initialize(ExecutorManager.java:155)
2018/12/28 15:43:28.407 +0800 ERROR [StdOutErrRedirect] [Azkaban] at azkaban.executor.ExecutorManager.start(ExecutorManager.java:168)
2018/12/28 15:43:28.407 +0800 ERROR [StdOutErrRedirect] [Azkaban] at azkaban.webapp.AzkabanWebServer.launch(AzkabanWebServer.java:235)
2018/12/28 15:43:28.407 +0800 ERROR [StdOutErrRedirect] [Azkaban] at azkaban.webapp.AzkabanWebServer.main(AzkabanWebServer.java:226)
如果web启动报错,没有活跃得executor,那么需要去数据库中手动修改native状态为1
# mail settings
[email protected]
mail.host=smtp.163.com
[email protected]
mail.password=XXXX
这里需要注意的是可能新申请的邮箱不可以设置成为sender邮箱
设置邮箱必须开启客户端授权密码,这里passwork就是授权密码
在发送邮件的时候会出现
•554 DT:SPM 发送的邮件内容包含了未被许可的信息,或被系统识别为垃圾邮件。请检查是否有用户发送病毒或者垃圾邮件;
错误,这个时候我们只需要将我们的发送邮件人加上自己就可以了
在任务流Flow的最后一个.job中文件中添加如下内容#任务执行失败发送邮件,多个接收邮件人之间用“,”分隔
[email protected],[email protected]
#任务执行成功发送邮件
[email protected]
#任务执行完成,无论成功还是失败发送邮件
[email protected]
在.job
文件中,添加如下命令:
retries=12
retry.backoff=300000 #代表重试间隔时间
在job中加入dependencies=
在Azkaban executor的conf/azkaban.properties中配置:
**executor.flow.threads 当前可以运行的flow的数量。默认为30
flow.num.job.threads 每个flow中并发运行的job数。默认为10**
在选择调度一个WorkFlow到Azkaban集群中的某个Executor Server时,需要比较Executor Server的如下4个指标: