千家信息网

greenplum 集群新增 standby节点

发表于:2024-11-11 作者:千家信息网编辑
千家信息网最后更新 2024年11月11日,greenplum 单独添加 standby本文主要介绍如何为没有做Standby的Master节点添加Standby。(快速整理版)旧版本gp集群需要注意!!!!在为Master节点搭建Standb
千家信息网最后更新 2024年11月11日greenplum 集群新增 standby节点

greenplum 单独添加 standby

本文主要介绍如何为没有做Standby的Master节点添加Standby。(快速整理版)

旧版本gp集群需要注意!!!!

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

添加新节点需要完成如下工作:

参考信息:
https://blog.51cto.com/michaelkang/2167195

1:新建gp 用户,用户id 与集群节点保持一直;2:新建数据目录,chown gpadmin.gpadmin $DIR;3:集群所有主机(Master节点和所有Segment节点)的hosts文件均需要添加Standby主机的信息。4:完成系统初始化(关闭防火墙,selinux ,sysctl.conf ,limits.conf ...),具体参考greenplum 集群安装初始化安装步骤;5:直接打通master节点 ssh 免密登陆新添加standby ;6:standby节点 ssh 免密登陆集群其它节点,通过gpssh工具测试;7:安装greenplum 软件包8:检查新添加standby 节点安装目录权限,chown gpadmin.gpadmin $DIR9:设置standby 节点gpadmin账户的环境变量,使之生效;以上确认配置没问题后:10.在Master节点通过gpinitstandby命令添加Standby。 (gpadmin 用户执行)[gpadmin@mdw config]$ gpinitstandby -s standby-node
操作实例:
[gpadmin@kangjianhua-6-16 ~]$ gpinitstandby -s kangjianhua-6-15.ptmind.comgpadmin-[INFO]:-Validating environment and parameters for standby initialization...gpadmin-[INFO]:-Checking for filespace directory /usr/local/gpdata/gpmaster/gpseg-1 on kangjianhua-6-15.ptmind.comgpadmin-[INFO]:------------------------------------------------------gpadmin-[INFO]:-Greenplum standby master initialization parametersgpadmin-[INFO]:------------------------------------------------------gpadmin-[INFO]:-Greenplum master hostname = kangjianhua-6-16.ptmind.comgpadmin-[INFO]:-Greenplum master data directory = /usr/local/gpdata/gpmaster/gpseg-1gpadmin-[INFO]:-Greenplum master port = 5432gpadmin-[INFO]:-Greenplum standby master hostname = kangjianhua-6-15.ptmind.comgpadmin-[INFO]:-Greenplum standby master port = 5432gpadmin-[INFO]:-Greenplum standby master data directory = /usr/local/gpdata/gpmaster/gpseg-1gpadmin-[INFO]:-Greenplum update system catalog = Ongpadmin-[INFO]:------------------------------------------------------gpadmin-[INFO]:- Filespace locationsgpadmin-[INFO]:------------------------------------------------------gpadmin-[INFO]:-pg_system -> /usr/local/gpdata/gpmaster/gpseg-1Do you want to continue with standby master initialization? Yy|Nn (default=N):> ygpadmin-[INFO]:-Syncing Greenplum Database extensions to standbygpadmin-[INFO]:-The packages on kangjianhua-6-15.ptmind.com are consistent.gpadmin-[INFO]:-Adding standby master to catalog...gpadmin-[INFO]:-Database catalog updated successfully.gpadmin-[INFO]:-Updating pg_hba.conf file...gpadmin-[INFO]:-pg_hba.conf files updated successfully.gpadmin-[INFO]:-Updating filespace flat files...gpadmin-[INFO]:-Filespace flat file updated successfully.gpadmin-[INFO]:-Starting standby mastergpadmin-[INFO]:-Checking if standby master is running on host: kangjianhua-6-15.ptmind.com in directory: /usr/local/gpdata/gpmaster/gpseg-120181115:18:06:06:176421 gpinitstandby:kangjianhua-6-16:gpadmin-[WARNING]:-Unable to cleanup previously started standby: 20181115:18:06:07:176421 gpinitstandby:kangjianhua-6-16:gpadmin-[INFO]:-Cleaning up pg_hba.conf backup files...20181115:18:06:08:176421 gpinitstandby:kangjianhua-6-16:gpadmin-[INFO]:-Backup files of pg_hba.conf cleaned up successfully.20181115:18:06:08:176421 gpinitstandby:kangjianhua-6-16:gpadmin-[INFO]:-Successfully created standby master on kangjianhua-6-15.ptmind.com
gpcc 问题处理:

greenplum master 节点迁移后,gpcc节点的配置要需要修改gpcc 连接节点的指向新的master地址:

gp 集群master切换后,需要修改:

/usr/local/gpcc/greenplum-cc-web-4.3.1/confcp app.conf app.conf.bakvim app.conf[gpadmin@kangjianhua-6-16 conf]$ more app.confappname = gpccwslistentcp4 = truerunmode = prodsession = trueenablexsrf = truexsrfexpire = 2592000xsrfkey = 61oETzKXQAGaYdkLxxxxxxxxxxxxxxrendertype = jsonprintallsqls = falsemaster_port = 5432path = /usr/local/gpccdisplay_name = gpccenable_kerberos = falseEnableHTTPS = falseEnableHTTP = truehttpport = 28080rpc_port = 8899master_host = kangjianhua-6-15.ptmind.com ==> kangjianhua-6-16.ptmind.com (新master) 《《《===修改内容查看状态:gpcc status启动服务:gpcc start#查看服务进程:ps  -ef|grep ccagent/usr/local/gpcc/greenplum-cc-web-4.3.1/bin/ccagent -udpport 9898 -rpcaddr kangjianhua-6-15.ptmind.com:8899安装参考:https://blog.51cto.com/michaelkang/2170631
0