1、编译oozie
环境条件:
Unix box (tested on Mac OS X and Linux)
Java JDK 1.6+
Maven 3.0.1+
Hadoop 0.20.2+
Pig 0.7+
注意
JDK commands (java, javac) must be in the command path.
The Maven command (mvn) must be in the command path.
1.1、安装maven:将maven的源码包解压缩,将解压后的文件夹放置/opt/目录下,并将/opt/apache-maven-3.2.3/bin目录添加至用户的环境变量中
1.2、安装pig:将pigxx.tar.gz解压,将解压后的文件夹放在/opt/目录下,并将${PIG_HOME}/bin路径加入到用户的环境变量中
修改ooize根目录下的pom.xml文件:
//更改jdk为系统所用的版本,1.8版本的jdk编译会出错
<javaVersion>1.7</javaVersion>
<targetJavaVersion>1.7</targetJavaVersion>
//默认为2.3.0,改为2.5.0后,编译出错
<hadoop.version>2.3.0</hadoop.version>
1.3、执行oozie-4.0.1.tar.gz解压后bin目录下的mkdistro脚本
./mkdistro.sh -DskipTests
编译成功后,执行第二步
2、安装Oozie
2.1 将oozie-4.0.1目录下的distro/target目录下的oozie-4.0.1-distro.tar.gz解压至/usr/local/目录下,并将其重命名为oozie(个人喜好,也可不用重命名)
2.2、/usr/local/oozie/目录下,解压share,example,client三个tar包,如下:
oozie-client-4.0.1.tar.gz(oozie的客户端,可通过它提交工作流任务)、oozie-examples.tar.gz(oozie的工作流事例程序)、oozie-sharelib-4.0.1.tar.gz
2.3、在HDFS文件系统中创建一个/user/hu的目录('hu'应改为oozie的使用者名称),并将oozie-sharelib-4.0.1.tar.gz解压后的share目录上传至HDFS中的/user/hu目录下;
hu@master:/usr/local/hadoop/bin$ hadoop fs -mkdir /user/hu (创建/user/hu目录)
hu@master:/usr/local/hadoop$ bin/hadoop dfs -copyFromLocal /usr/local/oozie/share /user/hu (将share目录上传至/user/hu目录)
hu@master:/usr/local/hadoop$ bin/hadoop dfs -ls /user/hu (列出HDFS中/user/hu目录下的文件,看是否上传成功)
2.4、在/usr/local/oozie目录下创建libext目录,将oozie-4.0.1/hadooplibs/target/oozie-4.0.1-hadooplibs/oozie-4.0.1/hadooplibs/hadooplib-2.3.0.oozie-4.0.1目录下的所有tar包copy至新建的libext目录
cp hadooplib-2.3.0.oozie-4.0.1/* /usr/local/oozie/libext/
2.5、将mysql-connector-java-5.1.27.jar(应对应自己的mysql版本)和ext2.2.zip拷贝至/usr/local/oozie/lib和/usr/local/oozie/libext目录下
2.6、 将ext2.2.0和hadoop的jar包打进新war包里,否则会启动会失败。可以检查下/usr/local/oozie/oozie-server/webapps/有没有 oozie.war,来验证是否成功
在/usr/local/oozie/bin下执行命令(这将会把/usr/locao/oozie/libext目录下的jar包打包为一个war文件,该war文件存放在/usr/local/oozie/oozie-server/webapps目录下):
./oozie-setup.sh prepare-war
2.7、设置环境变量
编辑/etc/profile文件,添加如下:
export OOZIE_HOME=/usr/local/oozie
export CATALINA_HOME=/usr/local/oozie/oozie-server
export PATH=${CATALINA_HOME}/bin:${OOZIE_HOME}/bin:$PATH
export OOZIE_URL=http://localhost:11000
export OOZIE_CONFIG=/usr/local/oozie/conf
2.8、修改/usr/local/oozie/conf/oozie-site.xml文件:修改如下
<property>
<name>oozie.db.schema.name</name>
<value>oozie</value>
<description>
Oozie DataBase Name
</description>
</property>
<property>
<name>oozie.service.JPAService.create.db.schema</name>
<value>false</value>
<description>
</description>
</property>
<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://localhost:3306/${oozie.db.schema.name}</value>
<description>
JDBC URL.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.username</name>
<value>oozie</value>
<description>
DB user name.
</description>
</property>
<property>
<name>oozie.service.JPAService.jdbc.password</name>
<value>oozie</value>
<description>
DB user password.
IMPORTANT: if password is emtpy leave a 1 space string, the service trims the value,
if empty Configuration assumes it is NULL.
</description>
</property>