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

greenplum 叢集新增 standby節點

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 使用者執行)

[
[email protected]
config]$ gpinitstandby -s standby-node

操作例項:

[[email protected] ~]$ 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

[[email protected] 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