Oozie安装
一.准备
默认hadoop,maven,mysql已经安装,我的hadoop是2.5.0
下载oozie安装包:oozie-4.1.0.tar.gz http://mirror.bit.edu.cn/apache/oozie/
下载ext-2.2.zip http://oozie.apache.org/docs/4.0.1/DG_QuickStart.html该路径有extjs的链接
二.编译
1. 修改源码中的一个bug,在
oozie-4.1.0.tar.gz\oozie-4.1.0\core\src\main\java\org\apache\oozie\executor\jpa目录下的WorkflowJobsGetFromWorkflowParentIdJPAExecutor文件是以jav结尾需修改为java
2. 解压
tar -zxvfoozie-4.1.0.tar.gz
3. 编辑pom.xml,修改hadoop版本
cdoozie-4.1.0
vimpom.xml
<!—我的jdk版本 -->
<targetJavaVersion>1.7</targetJavaVersion>
<!—我的jdk版本 -->
<hive.version>0.13.1</hive.version>
<pig.version>0.12.0</pig.version>
<pig.classifier></pig.classifier>
<sqoop.version>1.4.3</sqoop.version>
<hbase.version>0.94.2</hbase.version>
修改 1134行,hadoop版本为2.5.0:
<profile>
<id>hadoop-2</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<hadoop.version>2.5.0</hadoop.version>
<hadoop.auth.version>2.5.0</hadoop.auth.version>
<pig.classifier>h2</pig.classifier>
<sqoop.classifier>hadoop200</sqoop.classifier>
</properties>
</profile>
修改252行:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-minikdc</artifactId>
<version>2.5.0</version>
</dependency>
4. 执行mvn clean package assembly:single –DskipTests
编译后的包在./oozie-4.0.1/distro/target/oozie-4.1.0-distro.tar.gz
三.安装
1. 解压
Cp oozie-4.1.0-distro.tar.gz /home/hadoop
Cd /home/hadoop
tar xvzf oozie-4.1.0-distro.tar.gz
/home/hadoop/oozie-4.1.0即为oozie的根目录
2. 设置环境变量
Vi /etc/profile
export OOZIE_HOME=/home/hadoop/oozie-4.1.0
export PATH=$PATH:$ OOZIE _HOME/bin
3. 引入jar包
在OOZIE_HOME下创建libext文件夹
mkdir libext
将hadoop的所有jar包复制到该目录下
cp HADOOP_HOME/share/hadoop/*/hadoop-*.jar./libext/
cp HADOOP_HOME /share/hadoop/*/lib/*.jar./libext/
cp mysql-connector-java-5.1.29-bin.jarlibext/
删除jasper*.jar, servlet-api.jar, jsp-api.jar,与oozie-4.0.1/oozie-server/lib/下jar包冲突,war包会报:
org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem
4. 生成war包
bin/oozie-setup.sh prepare-war
会生成OOZIE_HOME/oozie-server/webapps/oozie.war
解压ext-2.2.zip后生成ext-2.2文件夹,将该文件夹打入oozie.war。我的做法是在后面启动服务之后oozie.war包会解压为oozie,让后将ext-2.2直接拖进去。
注:在网上看到用以下命令可以生成oozie.war,并已经将ext-2.2.zip打入了war包之中
./addtowar.sh -inputwar OOZIE_HOME/oozie.war -outputwar OOZIE_HOME/oozie-server/webapps/oozie.war -hadoop 2.3.0 HADOOP_HOME -extjs /home/oozie/ext-2.2.zip
5. 修改配置
vi OOZIE_HOME/ conf/oozie-site.xml
<property>
<name>oozie.service.JPAService.jdbc.driver</name>
<value>com.mysql.jdbc.Driver</value>
<description>
JDBC driver class.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.url</name>
<value>jdbc:mysql://mysql-server:3306/oozie</value>
<description>
JDBC URL.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.username</name>
<value>root</value>
<description>
DB user name.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.password</name>
<value>mapengbo</value>
<description>
DB user password.
</description>
</property>
6. 创建数据库
创建名为oozie的数据库并赋权
CREATE DATABASE oozie;
G R A N T ALL ON oozie.* TO ‘shirdrn‘@‘oozie-server‘IDENTIFIED BY ‘0o21e‘;
FLUSH PRIVILEGES;
生成所需的数据库表,并执行
bin/ooziedb.sh create -sqlfile oozie.sql –run
查看数据库oozie生成了oozie的相关表。
7. 启动服务
bin/oozied.sh start
访问控制台http://hadoop1:11000/oozie hadoop1为我的主机名
四.配置hadoop的jobhistory和用户
修改HADOOP_HOME/etc/hadoop/mapred-site.xml
和OOZIE_HOME/conf/hadoop-conf/core-site.xml添加如下配置。
<property>
<name>mapreduce.jobhistory.address</name>
<value> hadoop1:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value> hadoop1:19888</value>
</property>
<property>
<name>mapreduce.jobhistory.intermediate-done-dir</name>
<value>${hadoop.tmp.dir}/mr/history-tmp</value>
</property>
<property>
<name>mapreduce.jobhistory.done-dir</name>
<value>${hadoop.tmp.dir}/mr/history-done</value>
</property>
需要在hadoop的core-site.xml里面添加如下内容:
<property>
<name>hadoop.proxyuser.root.hosts</name>
<value>192.168.0.2</value>
</property>
<property>
<name>hadoop.proxyuser.root.groups</name>
<value>*</value>
</property>
root为hadoop的用户,hadoop.proxyuser.root.groups属性配置用户所属组名称,配置完成重启hadoop
启动hadoop历史jobHistory服务
HADOOP_HOME/sbin/mr-jobhistory-daemon.shstart historyserver
重启oozie
bin/oozied.sh start
五.Client测试
tar –zxvf oozie-client-4.1.0.tar.gz
tar –zxvf oozie-examples.tar.gz
tar –zxvf oozie-sharelib-4.1.0.tar.gz
hdsf dfs -put examples /user/root/
hdsf dfs -put share /user/root/
修改OOZIE_HOME/conf/hadoop-conf/core-site.xml文件,添加如下:
<property>
<name>yarn.resourcemanager.address</name>
<value>192.168.0.2:18040</value>(应与hadoop的配置相同,同下)
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>192.168.0.2:18030</value>
</property>
修改oozie.service.HadoopAccessorService.hadoop.configurations 属性,将其值调整为 *=HADOOP_HOME/etc/hadoop
修改OOZIE_HOME/examples/apps/map-reduce/job.properties(yarn中已经没有jobTracker,以下jobTracker填入yarn.resourcemanager.address的值,oozie.wf.application.path即HDFS中oozie示例程序的路径)
nameNode=hdfs://hadoop1:9000
jobTracker=hadoop1:18040
queueName=default
examplesRoot=examples
oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}/apps/map-reduce
outputDir=map-reduce
在OOZIE_HOME/oozie-client-4.0.1/bin中调用oozie脚本,执行工作流
./oozie job -oozie http://localhost:11000/oozie -config OOZIE_HOME/examples/apps/map-reduce/job.properties-run
访问控制台http://hadoop1:11000/oozie