1. 程式人生 > >greenplum 集群新增 standby節點

greenplum 集群新增 standby節點

stat running path oca key 直接 ges 過程 變量

greenplum 單獨添加 standby

本文主要介紹如何為沒有做Standby的Master節點添加Standby。(快速整理版)

舊版本gp集群需要註意!!!!

在為Master節點搭建Standby的過程中,GreenPlum會自動關閉數據庫,並以utility模式打開Master節點,然後修改gp_segment_configuration字典中增加Standby的信息,然後再關閉Master節點,將Master的數據拷貝到Standby節點,最後啟動數據庫,所以,在為Master節點添加Standby時,需要在空閑時段進行,否則會影響業務。

添加新節點需要完成如下工作:

參考信息:

http://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 $DIR
9:設置standby 節點gpadmin賬戶的環境變量,使之生效;

以上確認配置沒問題後:

10.在Master節點通過gpinitstandby命令添加Standby。 (gpadmin 用戶執行)

[gpadmin@mdw config]$ gpinitstandby -s standby-node

操作實例:

[gpadmin@kangjianhua-6-16 ~]$ gpinitstandby -s kangjianhua-6-15.ptmind.com

gpadmin-[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.com
gpadmin-[INFO]:------------------------------------------------------
gpadmin-[INFO]:-Greenplum standby master initialization parameters
gpadmin-[INFO]:------------------------------------------------------
gpadmin-[INFO]:-Greenplum master hostname = kangjianhua-6-16.ptmind.com
gpadmin-[INFO]:-Greenplum master data directory = /usr/local/gpdata/gpmaster/gpseg-1
gpadmin-[INFO]:-Greenplum master port = 5432
gpadmin-[INFO]:-Greenplum standby master hostname = kangjianhua-6-15.ptmind.com
gpadmin-[INFO]:-Greenplum standby master port = 5432
gpadmin-[INFO]:-Greenplum standby master data directory = /usr/local/gpdata/gpmaster/gpseg-1
gpadmin-[INFO]:-Greenplum update system catalog = On
gpadmin-[INFO]:------------------------------------------------------
gpadmin-[INFO]:- Filespace locations
gpadmin-[INFO]:------------------------------------------------------
gpadmin-[INFO]:-pg_system -> /usr/local/gpdata/gpmaster/gpseg-1

Do you want to continue with standby master initialization? Yy|Nn (default=N):
> y
gpadmin-[INFO]:-Syncing Greenplum Database extensions to standby
gpadmin-[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 master
gpadmin-[INFO]:-Checking if standby master is running on host: kangjianhua-6-15.ptmind.com in directory: /usr/local/gpdata/gpmaster/gpseg-1
20181115: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/conf
cp app.conf app.conf.bak
vim app.conf

[gpadmin@kangjianhua-6-16 conf]$ more app.conf
appname = gpccws
listentcp4 = true
runmode = prod
session = true
enablexsrf = true
xsrfexpire = 2592000
xsrfkey = 61oETzKXQAGaYdkLxxxxxxxxxxxxxx
rendertype = json
printallsqls = false
master_port = 5432
path = /usr/local/gpcc
display_name = gpcc
enable_kerberos = false
EnableHTTPS = false
EnableHTTP = true
httpport = 28080
rpc_port = 8899
master_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

安裝參考:
http://blog.51cto.com/michaelkang/2170631

greenplum 集群新增 standby節點