Setting up Oozie high availability

本文介绍如何搭建四节点的Oracle Linux 7集群以及oozie的High Availability。环境如下图:
Setting up Oozie high availability
一、创建HA集群
1、安装集群软件包
分别在4个节点上安装,如下:

[root@hdp01 ~]#  yum install pcs fence-agents-all -y
[root@hdp02 ~]#  yum install pcs fence-agents-all -y
[root@hdp03 ~]#  yum install pcs fence-agents-all -y
[root@hdp04 ~]#  yum install pcs fence-agents-all -y

2、设置集群用户密码
集群软件包安装完成后,会在系统中创建一个hacluster用户,默认是没有密码的,需要单独设置,否则后续节点认证会失败。

[root@hdp01 ~]# for id in {1..4};do ssh hdp0$id "echo redhat|passwd --stdin hacluster";done
Changing password for user hacluster.
passwd: all authentication tokens updated successfully.
Changing password for user hacluster.
passwd: all authentication tokens updated successfully.
Changing password for user hacluster.
passwd: all authentication tokens updated successfully.
Changing password for user hacluster.
passwd: all authentication tokens updated successfully.

3、启用集群服务
安装完成后,集群服务默认是禁用状态,使用下面的命令启用:

[root@hdp01 ~]# for id in {1..4};do ssh hdp0$id "systemctl enable pcsd.service;systemctl start pcsd.service";done
Created symlink from /etc/systemd/system/multi-user.target.wants/pcsd.service to /usr/lib/systemd/system/pcsd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/pcsd.service to /usr/lib/systemd/system/pcsd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/pcsd.service to /usr/lib/systemd/system/pcsd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/pcsd.service to /usr/lib/systemd/system/pcsd.service.
[root@hdp01 ~]# for id in {1..4};do ssh hdp0$id "systemctl status pcsd.service";done

4、集群节点认证
通过下面的命令进行集群节点认证:

[root@hdp01 ~]# pcs cluster auth hdp01 hdp02 hdp03 hdp04

Setting up Oozie high availability
5、创建集群

[root@hdp01 ~]# pcs cluster setup --start --name hcluster hdp01 hdp02 hdp03 hdp04

Setting up Oozie high availability
6、配置集群服务自启动

[root@hdp01 ~]# pcs cluster enable --all

7、验证集群状态

[root@hdp01 ~]# pcs cluster status

Setting up Oozie high availability
8、禁用fence服务
这里的4个几点都是虚拟机,所以不需要启用fence服务,但如果是物理机就需要启用,具体参考官方文档。

[root@hdp01 ~]# pcs property set stonith-enabled=false
[root@hdp01 ~]# pcs property set no-quorum-policy=ignore
[root@hdp01 ~]# pcs resource defaults migration-threshold=1

9、创建资源组
这里只针对hadoop提供虚拟IP服务,所以只创建一个虚拟IP的资源,如下:

[root@hdp01 ~]# pcs resource create vip_res IPaddr2 ip=192.168.120.101 cidr_netmask=24 nic=eth0 op monitor interval=30s --group hadoop
Assumed agent name 'ocf:heartbeat:IPaddr2' (deduced from 'IPaddr2')
[root@hdp01 ~]# pcs status

Setting up Oozie high availability
10、启用资源组

[root@hdp01 ~]# pcs cluster start --all && pcs status 

Setting up Oozie high availability
二、配置Oozie HA
4个节点上都运行oozie服务,而且使用的是同一个mysql作为metastore database。对外服务的IP是一个虚拟IP。(这里先在hdp01上做完所有配置,然后再拷贝到其他机器)。在做以下配置之前,确保每个节点的oozie服务未运行。
1、编辑oozie-site.xml文件
加入以下内容:

oozie.services.ext=org.apache.oozie.service.ZKLocksService,org.apache.oozie.service.ZKXLogStreamingService,org.apache.oozie.service.ZKJobsConcurrencyService,org.apache.oozie.service.ZKUUIDService
--如果zookeeper是多个服务器则之间使用逗号隔开
oozie.zookeeper.connection.string=hdp01:2181,hdp02:2181,hdp03:2181,hdp04:2181
oozie.zookeeper.namespac=oozie
oozie.base.url=http://192.168.120.101:11000/oozie
--其他节点的instance.id改成对应的主机名即可
oozie.instance.id=hdp01

Setting up Oozie high availability
2、同步oozie至其他节点

[hadoop@hdp01 ~]$ for i in {2..4};do scp -r /u01/oozie hdp0$i:/u01;done

注意:
同步完成后,将oozie存放pid文件夹下的pid文件删除,另外还需要更改oozie-site.xml的instance.id为本机主机名。
3、启动每个节点的oozie服务

[hadoop@hdp01 ~]$ for i in {1..4};do ssh hdp0$i "source .bash_profile;oozied.sh start";done
--在任意一台节点通过虚拟IP测试是否可以访问
[hadoop@hdp03 ~]$ oozie admin -oozie http://192.168.120.101:11000/oozie -status
System mode: NORMAL

4、Zookeeper检查是否已注册oozie服务
Setting up Oozie high availability

参考文献:
1、Configuring Oozie for High Availability
2、Configure High-Avaliablity Cluster on CentOS 7 / RHEL 7

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值