Greenplum实战--添加standby master

GreenPlum数据库对于数据的冗余,也支持类似Oracle数据库物理DataGuard的数据冗余机制,Master的数据库镜像称为Standby,Segment节点的数据库镜像称之为Mirror,本文主要介绍如何为没有做Standby的Master节点添加Standby。

需要注意,在为Master节点搭建Standby的过程中,GreenPlum会自动关闭数据库,并以utility模式打开Master节点,然后修改gp_segment_configuration字典中增加Standby的信息,然后再关闭Master节点,将Master的数据拷贝到Standby节点,最后启动数据库,所以,在为Master节点添加Standby时,需要在空闲时段进行,否则会影响业务。

在搭建Standby的时候,Standby主机需要先安装GreenPlum数据库软件,这和正常安装GreenPlum数据库软件没有区别,从规范化考虑,尽量使用和Master主机同样的安装路径,下面简单结束安装过程。

1.创建gpadmin用户及安装目录

 

---------增加master的mirror----------

在smdw上root执行

mkdir -p /greenplum/gpdata/master

chown gpadmin:gpadmin /greenplum/gpdata/master

 

2.配置hosts文件,添加所有主机的信息

修改hosts文件



10.102.254.24           sdw1

10.102.254.25           sdw2

10.102.254.26           sdw3 smdw

10.102.254.27           mdw

除Standby主机外,其他所有主机(Master节点和所有Segment节点)的hosts文件均需要添加Standby主机的信息,也就是所有GreenPlum数据库包含的主机的hosts文件都需要包含以上hosts文件中的所有主机信息。

 

  1. 上传安装文件及解压

省略,因为我的standby和 sdw3一起的

 

4 创建

在mdw上gpadmin执行

gpinitstandby -s smdw



[gpadmin@mdw ~]$ gpinitstandby -s smdw

20200419:00:58:17:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Validating environment and parameters for standby initialization...

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Checking for filespace directory /greenplum/gpdata/master/gpseg-1 on smdw

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master initialization parameters

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master hostname               = mdw

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master data directory         = /greenplum/gpdata/master/gpseg-1

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master port                   = 5432

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master hostname       = smdw

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master port           = 5432

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master data directory = /greenplum/gpdata/master/gpseg-1

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum update system catalog         = On

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:- Filespace locations

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------

20200419:00:58:18:002040 gpinitstandby:mdw:gpadmin-[INFO]:-pg_system -> /greenplum/gpdata/master/gpseg-1

Do you want to continue with standby master initialization? Yy|Nn (default=N):

> y

20200419:00:58:34:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Syncing Greenplum Database extensions to standby

20200419:00:58:35:002040 gpinitstandby:mdw:gpadmin-[INFO]:-The packages on smdw are consistent.

20200419:00:58:35:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Adding standby master to catalog...

20200419:00:58:35:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Database catalog updated successfully.

20200419:00:58:35:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Updating pg_hba.conf file...

20200419:00:58:36:002040 gpinitstandby:mdw:gpadmin-[INFO]:-pg_hba.conf files updated successfully.

20200419:00:58:38:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Updating filespace flat files...

20200419:00:58:38:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Filespace flat file updated successfully.

20200419:00:58:38:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Starting standby master

20200419:00:58:38:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Checking if standby master is running on host: smdw  in directory: /greenplum/gpdata/master/gpseg-1

20200419:00:58:38:002040 gpinitstandby:mdw:gpadmin-[WARNING]:-Unable to cleanup previously started standby: 'Warning: the ECDSA host key for 'smdw' differs from the key for the IP address '10.102.254.26'

Offending key for IP in /home/gpadmin/.ssh/known_hosts:1

Matching host key in /home/gpadmin/.ssh/known_hosts:9

'

20200419:00:58:40:002040 gpinitstandby:mdw:gpadmin-[INFO]:-Cleaning up pg_hba.conf backup files...

 

 

同时:有一个blog写的详细过程比较好

http://www.dbdream.com.cn/2016/02/greenplum%e6%95%b0%e6%8d%ae%e5%ba%93master%e8%8a%82%e7%82%b9%e6%90%ad%e5%bb%bastandby/

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值