Oozie4.3.1安装指南详解

一、环境支持

Oozie4.3.1

Centos 6.5

Java JDK 1.8

Maven 3.5.4

Hadoop2.7.4

Pig0.17

Mysql5.5.28

二、安装步骤详解

Java的安装

1、解压安装包

tar -zxvf jdk-8u73-linux-x64.gz -C /export/service

2、配置环境变量

vi /etc/profile

export JAVA_HOME=/export/service/jdk1.8.0_73

export JRE_HOME=$JAVA_HOME/jre

export PATH=$JAVA_HOME/bin:$PATH

export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib

3、环境变量生效

source /etc/profile

4、检查是否安装成功

java -version

 

Maven的安装

1、解压安装包

tar -zxvf apache-maven-3.5.4-bin.tar.gz -C /export/service

2、配置环境变量

vi /etc/profile

export MAVEN_HOME=/export/service/maven-3.5.4

export PATH=$MAVEN_HOME/bin:$PATH

3、使得环境变量生效

source /etc/profile

4、检查是否安装成功

mvn -version

 

Hadoop的安装部署

略:详见hadoop安装部署文档

Pig的安装部署

1、解压安装包

tar -zxvf pig-0.17.0-tar.gz -C /export/service

2、配置环境变量

vi /etc/profile

export MAVEN_HOME=/export/service/pig-0.17

export PATH=$MAVEN_HOME/bin:$PATH

3、使环境变量生效

source /etc/profile

4、检查是否安装成功

pig version

 

Mysql yum在线安装

mysql

yum install mysql mysql-server mysql-devel

完成后,用  /etc/init.d/mysqld start    启动mysql

启动mysql控制台:

mysql

mysql>; USE mysql;

mysql>; UPDATE user SET Password=PASSWORD('newpassword') WHERE user='root';

mysql>; FLUSH PRIVILEGES;

允许远程登录

mysql -u root -p

Enter Password: <your new password>

mysql>GRANT ALL PRIVILEGES ON *.* TO '用户名'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

完成后就能远程管理mysql了。

mysql服务名字   service  mysqld start   

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION; 

Oozie的解压编译

1、解压源码包

tar -zxvf   oozie-4.3.1.tar.gz -C /export/service

2、配置环境变量

vi /etc/profile

export OOZIE_HOME=/export/service/oozie-3.4.1

export PATH=$OOZIE_HOME/bin:$PATH

3、使环境生效

source /etc/profile

4、编译Oozie4.3.1-distro.tar.Gz的包

bin/mkdistro.sh -DskipTests -Phadoop-2 -Dhadoop.auth.version = 2.7.4 -Ddistcp.version = 2.7.4

(这是一个十分漫长的过程,还请耐心等待)


1、修改配置文件

修改oozie-4.3.1/conf的配置文件,添加如下

<!--mysql作为元数据存放的数据库-->

<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</value>

    <description>

        JDBC URL.

    </description>

</property>

<property>

    <name>oozie.service.JPAService.jdbc.username</name>

    <value>root</value>

    <description>

        DB user name.

    </description>

</property>

    <value>123456</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.

<!--设置Hadoop的配置文件的路径-->

<property>

    <name>oozie.service.HadoopAccessorService.hadoop.configurations</name>

    <value>*=/export/service/hadoop-2.7.4/etc/hadoop</value>

    <description>

        Comma separated AUTHORITY=HADOOP_CONF_DIR, where AUTHORITY is the HOST:PORT of

        the Hadoop service (JobTracker, YARN, HDFS). The wildcard '*' configuration is

        used when there is no exact match for an authority. The HADOOP_CONF_DIR contains

        the relevant Hadoop *-site.xml files. If the path is relative is looked within

        the Oozie configuration directory; though the path can be absolute (i.e. to point

        to Hadoop client conf/ directories in the local filesystem.

    </description>

</property>

<!--设置Spark的配置文件的路径-->

<property>

    <name>oozie.service.SparkConfigurationService.spark.configurations</name>

    <value>*=/export/service/spark-2.0.2-bin-hadoop2.7/conf</value>

    <description>

        Comma separated AUTHORITY=SPARK_CONF_DIR, where AUTHORITY is the HOST:PORT of

        the ResourceManager of a YARN cluster. The wildcard '*' configuration is

        used when there is no exact match for an authority. The SPARK_CONF_DIR contains

        the relevant spark-defaults.conf properties file. If the path is relative is looked within

        the Oozie configuration directory; though the path can be absolute.  This is only used

        when the Spark master is set to either "yarn-client" or "yarn-cluster".

    </description>

</property>

<!--

设置系统库存放在hdfs中,注意只有在job.properties中将设置oozie.use.system.libpath=true才会引用>系统库

。注意,下面node-1namenode的逻辑名称,根据自己集群的情况进行更改即可-->

<property>

    <name>oozie.service.WorkflowAppService.system.libpath</name>

    <value>hdfs://node-1/user/${user.name}/share/lib</value>

    <description>

        System library path to use for workflow applications.

        This path is added to workflow application if their job properties sets

        the property 'oozie.use.system.libpath' to true.

    </description>

</property>

 

 

/export/service/oozie-4.3.1目录下,新建文件夹libextcd$HADOOP_HOME/ 下,执行如下命令,把jar包全都copy到该目录下

find -name *.jar |xargs -t -i cp {} /export/service/oozie-4.2.1/libext

 

7

注意:需要将libext中的hsqldb-2.0.0.jar删掉,否则会引起jar包冲突

将下载好的ext-2.2.zipmysql驱动包也放到libext目录下

执行下面的命令,ext2.2.0.ziphadoop的相关jar包、以及mysql-connector-java-<版本>.jarhtrace-core-<版本>.jaravro-<版本>.jar 打进新war包里:

删除oozie-server/webapps/oozie.war包,执行如下命令

 

bin/addtowar.sh -inputwar oozie.war  -outputwar oozie-server/webapps/oozie.war -hadoop 2.7.3 /opt/hadoop-2.7.3/ -extjs libext/ext-2.2.zip -jars /opt/oozie/oozie-4.3.0/libext/mysql-connector-java-5.1.38.jar:/opt/oozie/oozie-4.3.0/libext/htrace-core-3.1.0-incubating.jar:/opt/oozie/oozie-4.3.0/libext/avro-1.7.4.jar

 

注意: htrace-coreavro这两个jar包不加的话,后面提交job时会出错!并且执行了上面这句后,就不能再执行./bin/oozie-setup.sh prepare-war 了,否则替换掉oozie-server/webapps/中已经生成的oozie.war

 

8

果还没有安装mysql,那么需要安装一个mysql。安装好后,mysql数据库中创建名为oozie的数据库(注意:oozie-site.xml中有个配置项oozie.service.JPAService.create.db.schema,默认值为false,表示非自动创建数据库,所以我们需要自己创建oozie数据库),并进行访问授权,然后在/usr/local/oozie-4.3.0下执行:

ooziedb.sh create -sqlfile oozie.sql -run

查看oozie数据库,如果产生了以下的表,就说明该步骤OK

 

注意:如果执行以上语句报错:Caused by: java.lang.ClassNotFoundException: org.w3c.dom.ElementTraversal

以上的简单解决办法如下:

[root@hadoop01 oozie-4.3.0]# cp ./libext/xml-apis-1.4.01.jar /usr/local/jdk1.8.0_152/jre/lib/ext/

9、安装oozie-sharelib

/export/service/oozie-4.3.1/oozie-sharelib-4.3.1.tar.gz解压到安装目录:

[root@node-1 oozie-4.3.1]# tar -zxvf /usr/local/oozie-4.3.0/oozie-sharelib-4.3.0.tar.gz

 

mysql-connector-java-5.1.38.jar复制到 /export/service/oozie-4.3.1/share/lib/sqoop目录中。如果没有这个jar,将不能从mysql将数据导入或导出。

[root@node-1 oozie-4.3.1]# cp ./libext/mysql-connector-java-5.1.38.jar ./share/lib/sqoop/

 

将这个share上传到hdfs上:

[root@node-1 oozie-4.3.1]# hdfs dfs -put /usr/local/oozie-4.3.0/share /user/root

注意:oozie-site.xml中的oozie.service.WorkflowAppService.system.libpath的值保持一致,所以必须放到/user/root这个目录下。

 

10、使用以下命令启动oozie服务:

[root@node-1 oozie-4.3.1]# ./bin/oozie-start.sh

 

11、使用以下命令验证服务是否启动成功,

[root@node-1 oozie-4.3.1]# oozie admin -oozie http://localhost:11000/oozie -status

如果是System model:Normal,表明启动成功,否则失败。

12、查看是否可以通过浏览器访问web页面:

http://node-1:11000/oozie/

Oozie4.3Client安装

Oozie server 安装中已经包括了Oozie client。如果想要在其他机子上也使用Oozie,那么只要在那些机子上安装Oozeiclient即可。

所需环境:

Centos6.5

Java 1.8

开始安装

14.3.1中有一个oozie-client-4.3.1.tar.gz,将它复制到需要安装oozie client的机子上并解压:

[root@node-1 oozie-4.3.1]# tar -zxvf ./oozie-client-4.3.1.tar.gz -C /usr/local/

这时在/usr/local下有一个oozie-client-4.3.1

2、添加环境变量:

注意:上面还可以添加一个环境变量,export OOZIE_URL=http://hadoop01:11000/oozie这样在后面的oozie job这个命令中就不需要加 -oozie


Oozieexample:

1、在/expoet/service/oozie-4.3.1下有一个oozie-examples.tar.gz 。将它进行解压,解压之后生成一个examples目录。在该目录的apps中有一些简单的例子:

[root@node-1 oozie-4.3.1]# tar -zxvf ./oozie-examples.tar.gz

 

2、在运行这些例子之前,需要对这些例子进行一些修改,例如我们运行shell这个例子。

 

先来查看一下job.properties的内容:

[root@node-1 oozie-4.3.1]# vi ./examples/apps/shell/job.properties

 

注意:这些例子中JobTracker 都是localhost:8021NameNode 都是hdfs://localhost:8020 。这是hadoop1的端口。我们需要根据自己集群的情况,对它做相应的修改。我现在的hadoop集群是2.7.4版本的。并且NameNodeResourceManager都是HA的。

 

3、将examples这个文件上传到hdfs中的/user/${user.name} 中,我采用的是root这个用户,所以是/user/root

[root@node-1 oozie-4.3.1]# hdfs dfs -put ./examples/ /user/root

 

4、执行以下命令运行

注意: -oozie 后面跟的是oozie server的地址,-config后面跟的是执行的脚本,除了在hdfs上要有一份examples,在本地也需要一份。这个命令中的/export/service/oozie-4.3.1/examples/apps/shell/job.properties是本地路径的job.properties,不是hdfs上的。

[root@node-1 oozie-4.3.1]# oozie job -oozie http://node-1:11000/oozie -config ./examples/apps/shell/job.properties -run

 

4、查看oozie的任务信息(或者用浏览器查看):

[root@node-1 oozie-4.3.1]# oozie job -oozie http://node-1:11000/oozie -info 0000000-180705090045992-oozie-root-W

 

 

5、查看任务的日志:

[root@node-1 oozie-4.3.1]# oozie job -oozie http://node-1:11000/oozie -log 0000000-180705090045992-oozie-root-W

 

6、杀死任务:

[root@node-1 oozie-4.3.1]# oozie job -oozie http://node-1:11000/oozie -kill 0000000-180705090045992-oozie-root-W

 


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值