我是靠谱客的博主 哭泣白开水,最近开发中收集的这篇文章主要介绍greenplum6数据库安装部署以及扩容介绍greenplum数据库安装部署,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

greenplum数据库安装部署

环境以及准备工作

集群机器规划

ip主机名基本配置操作系统
11.8.37.111gpmaster4C8GCentOS7.4
11.8.37.112gpstandby4C8GCentOS7.4
11.8.37.113segment014C8GCentOS7.4
11.8.37.114segment024C8GCentOS7.4

【注意】: 根据官方issue,在部署greenplum数据库时,centos7.3版本前使用时会有一些bug问题
【注意】:如果后续需要扩容实施存储,可以直接上更高的配置,例如8核等,根据情况自定

更改主机名【所有机器】

11.8.37.111 # hostnamectl set-hostname gpmaster
11.8.37.112 # hostnamectl set-hostname gpstandby
11.8.37.113 # hostnamectl set-hostname segment01
11.8.37.114 # hostnamectl set-hostname segment02

基本环境信息

root@gpmaster:/root #lscpu | grep "^CPU(s)"
CPU(s):                4
root@gpmaster:/root #free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           7           0           0           7
Swap:             3           0           3
root@gpmaster:/root #cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

安装依赖包【所有机器】

root@gpmaster:/root #yum install -y apr apr-util bash bzip2 curl krb5 libcurl libevent libxml2 libyaml zlib openldap openssh openssl openssl-libs perl readline rsync R sed tar zip krb5-devel

关闭SELINUX与防火墙【所有机器】

[root@gpmaster ~]# vim /etc/selinux/config 
SELINUX=disabled

关闭防火墙【所有机器】

# 本次关闭
[root@gpmaster ~]# systemctl stop firewalld.service
# 开机不启动
[root@gpmaster ~]# systemctl disable firewalld.service

配置主机名解析/etc/hosts【所有机器】

root@gpmaster:/root #vim /etc/hosts

127.0.0.1 ydt-dmcp-gpmaster
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

# greenplum
11.8.37.111 gpmaster
11.8.37.112 gpstandby
11.8.37.113 segment01
11.8.37.114 segment02

修改内核配置参数【所有机器】

root@gpmaster:/root #vim /etc/sysctl.conf

kernel.shmall = 4000000000
kernel.shmmax = 500000000
kernel.shmmni = 4096
vm.overcommit_memory = 2
vm.overcommit_ratio = 95
net.ipv4.ip_local_port_range = 10000 65535
kernel.sem = 500 2048000 200 40960
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.swappiness = 10
vm.zone_reclaim_mode = 0
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
vm.dirty_background_ratio = 0
vm.dirty_ratio = 0
vm.dirty_background_bytes = 1610612736
vm.dirty_bytes = 4294967296

# 加载内核配置参数生效
root@gpmaster:/root #sysctl -p

配置资源限制参数【所有机器】

root@gpmaster:/root #vim /etc/security/limits.conf
# End of file
* soft nofile 524288
* hard nofile 524288
* soft nproc 131072
* hard nproc 131072

创建用户与用户组【所有机器】

root@gpmaster:/root #groupadd -g 530 gpadmin
root@gpmaster:/root #useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin

文件夹授权与创建密码【所有机器】

root@gpmaster:/root #chown -R gpadmin:gpadmin /home/gpadmin/
root@gpmaster:/root #echo gpadmin|passwd --stdin gpadmin
Changing password for user gpadmin.
passwd: all authentication tokens updated successfully.

创建安装目录与授权【所有机器】

root@gpmaster:/root #mkdir /usr/local/greenplum
root@gpmaster:/root #chown -R gpadmin:gpadmin /usr/local/greenplum/

安装部署greenplum数据库

官方下载安装包并安装【master】

root@gpmaster:/root #cd /usr/local/greenplum/
root@gpmaster:/usr/local/greenplum #wget https://github.com/greenplum-db/gpdb/releases/download/6.19.0/open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm
--2021-12-17 11:31:22--  https://github.com/greenplum-db/gpdb/releases/download/6.19.0/open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm
Resolving github.com (github.com)... 20.205.243.166
Connecting to github.com (github.com)|20.205.243.166|:443... connected.
Length: 67544872 (64M) [application/octet-stream]
Saving to: ‘open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm’

 4% [========>                                      ] 3,254,825   54.5KB/s  eta 15m 26s
 
[root@gpmaster greenplum]# ll
total 65964
-rw-r--r-- 1 root root 67544872 Dec 17 11:32 open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm

【注意】: 下载方式为官方github项目地址,部分用户下载有时会出现打不开多尝试几次,或者通过其它方式下载再上传至服务器

安装greenplum安装包【master】

root@gpmaster:/usr/local/greenplum #yum install -y open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm
# 安装后默认生成在/usr/local/greenplum-db-6.19.0/里,因为是用root用户安装,所以要赋权给gpadmin
root@gpmaster:/usr/local/greenplum #cd /usr/local/
root@gpmaster:/usr/local #ll
total 52
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 bin
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 etc
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 games
drwxr-xr-x   2 gpadmin gpadmin 4096 Dec 17 11:21 greenplum
lrwxrwxrwx   1 root    root      30 Dec 17 11:22 greenplum-db -> /usr/local/greenplum-db-6.19.0
drwxr-xr-x  11 root    root    4096 Dec 17 11:22 greenplum-db-6.19.0
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 include
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 lib
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 lib64
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 libexec
drwxr-xr-x. 11 wasadm  wasadm  4096 Jul 20  2018 nginx-1.10
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 sbin
drwxr-xr-x.  5 root    root    4096 Apr 24  2019 share
drwxr-xr-x.  2 root    root    4096 Nov  5  2016 src

root@gpmaster:/usr/local #chown -R gpadmin:gpadmin /usr/local/greenplum*

查看引用Greenplum环境变量文件【master】

# 切换至gpadmin
root@gpmaster:/usr/local #su - gpadmin
Last login: Fri Dec 17 11:31:36 CST 2021 on pts/0
# 环境脚本文件
gpadmin@gpmaster:/home/gpadmin >cat /usr/local/greenplum-db-6.19.0/greenplum_path.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
if [ ! -L "${SCRIPT_DIR}" ]; then
    GPHOME=${SCRIPT_DIR}
else
    GPHOME=$(readlink "${SCRIPT_DIR}")
fi
PYTHONHOME="${GPHOME}/ext/python"
export PYTHONHOME

PATH="${PYTHONHOME}/bin:${PATH}"
LD_LIBRARY_PATH="${PYTHONHOME}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
PYTHONPATH="${GPHOME}/lib/python"
PATH="${GPHOME}/bin:${PATH}"
LD_LIBRARY_PATH="${GPHOME}/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

if [ -e "${GPHOME}/etc/openssl.cnf" ]; then
	OPENSSL_CONF="${GPHOME}/etc/openssl.cnf"
fi

export GPHOME
export PATH
export PYTHONPATH
export LD_LIBRARY_PATH
export OPENSSL_CONF
# 使用source引用(一会统一将会添加至系统bash_profile中)
gpadmin@gpmaster:/home/gpadmin >source /usr/local/greenplum-db-6.19.0/greenplum_path.sh

相互免密【所有机器】

# 注意切换gpadmin用户
root@gpmaster:/root #su - gpadmin
# 创建公钥对,生成时不要输入密码,直接回车
gpadmin@gpmaster:/home/gpadmin >ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gpadmin/.ssh/id_rsa): 
Created directory '/home/gpadmin/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/gpadmin/.ssh/id_rsa.
Your public key has been saved in /home/gpadmin/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:pNz23UkbS3h7Ap0FFfmzoAwZdq43b1XuAiAJLmJvxOk gpadmin@gpmaster
The keys randomart image is:
+---[RSA 2048]----+
|              .o+|
|      .  o .   o |
|   . o .o.=     o|
|  o =..+oo.. + +o|
| . = .o S.+.+ O.+|
|    E  . o *.* O.|
|   .      o +.O..|
|             o.o.|
|            .  . |
+----[SHA256]-----+

# 轮着各台服务器分发密钥依次输入密码
gpadmin@gpmaster:/home/gpadmin >ssh-copy-id gpmaster
gpadmin@gpmaster:/home/gpadmin >ssh-copy-id gpstandby
gpadmin@gpmaster:/home/gpadmin >ssh-copy-id segment01
gpadmin@gpmaster:/home/gpadmin >ssh-copy-id segment02

创建hostlist seg_hosts【master】

# hostlist放全部主机的名字,seg_hosts放存储节点segment主机名:
# 切换root创建必要目录
gpadmin@gpmaster:/home/gpadmin >su - root
Password: 
Last login: Fri Dec 17 11:42:38 CST 2021 from 11.8.40.16 on pts/1
root@gpmaster:/root #mkdir /usr/local/conf

root@gpmaster:/root #chown -R gpadmin:gpadmin /usr/local/conf/
root@gpmaster:/root #su - gpadmin
Last login: Fri Dec 17 11:46:40 CST 2021 on pts/0
gpadmin@gpmaster:/home/gpadmin >cd /usr/local/conf/
gpadmin@gpmaster:/usr/local/conf >vim hostlist

gpmaster
gpstandby
segment01
segment02

gpadmin@gpmaster:/usr/local/conf >vim seg_hosts

segment01
segment02

使用 gpssh-exkeys 打通所有服务器【master】

将所有机器的通道打开,这样在每台机器之间跳转,就不需要输入密码。

gpadmin@gpmaster:/usr/local/conf >source /usr/local/greenplum-db-6.19.0/greenplum_path.sh
gpadmin@gpmaster:/usr/local/conf >gpssh-exkeys -f hostlist
[STEP 1 of 5] create local ID and authorize on local host
  ... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped

[STEP 2 of 5] keyscan all hosts and update known_hosts file

[STEP 3 of 5] retrieving credentials from remote hosts
  ... send to gpstandby
  ... send to segment01
  ... send to segment02

[STEP 4 of 5] determine common authentication file content

[STEP 5 of 5] copy authentication files to all remote hosts
  ... finished key exchange with gpstandby
  ... finished key exchange with segment01
  ... finished key exchange with segment02

[INFO] completed successfully


# 在打通所有机器通道之后,我们就可以使用 gpssh 命令对所有机器进行批量操作了,可以用pwd测试一下,exit退出
gpadmin@gpmaster:/usr/local/conf >gpssh -f hostlist 
pwd
=> pwd
[ gpmaster] /home/gpadmin
[segment01] /home/gpadmin
[gpstandby] /home/gpadmin
[segment02] /home/gpadmin
=> hostname
[ gpmaster] gpmaster
[segment01] segment01
[gpstandby] gpstandby
[segment02] segment02
=> exit

master分发安装包【master】

gpadmin@gpmaster:/usr/local/conf >cd /usr/local/greenplum
gpadmin@gpmaster:/usr/local/greenplum >ll
total 65968
-rw-r--r-- 1 gpadmin gpadmin 67544872 Dec 15 16:45 open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm
gpadmin@gpmaster:/usr/local/greenplum >scp open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm gpstandby:/usr/local/greenplum/
gpadmin@gpmaster:/usr/local/greenplum >scp open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm segment01:/usr/local/greenplum/ 
gpadmin@gpmaster:/usr/local/greenplum >scp open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm segment02:/usr/local/greenplum/

其他机器安装部署greenplum【其余3台】

gpadmin@gpstandby:/usr/local/greenplum >su - root
Password: 
Last login: Fri Dec 17 11:44:20 CST 2021 from 11.8.40.16 on pts/1
root@gpstandby:/root #cd /usr/local/greenplum/
root@gpstandby:/usr/local/greenplum #ll
total 65968
-rw-r--r-- 1 gpadmin gpadmin 67544872 Dec 17 11:53 open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm
root@gpstandby:/usr/local/greenplum #yum install -y open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm
root@gpstandby:/usr/local/greenplum #chown -R gpadmin:gpadmin /usr/local/greenplum*

创建数据存储空间【所有机器】

root@gpmaster:/root #su - gpadmin
Last login: Fri Dec 17 11:51:58 CST 2021 from gpmaster on pts/5
gpadmin@gpmaster:/home/gpadmin >cd /home/gpadmin/
gpadmin@gpmaster:/home/gpadmin >mkdir gpdata
gpadmin@gpmaster:/home/gpadmin >cd gpdata/
gpadmin@gpmaster:/home/gpadmin/gpdata >mkdir gpmaster gpdatap1 gpdatap2 gpdatam1 gpdatam2
gpadmin@gpmaster:/home/gpadmin/gpdata >ll
total 20
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpdatam1
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpdatam2
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpdatap1
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpdatap2
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpmaster

环境配置【所有机器】

# bash_profile最后增添如下配置
gpadmin@gpmaster:/home/gpadmin/gpdata >vim ~/.bash_profile
source /usr/local/greenplum-db-6.19.0/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/gpmaster/gpseg-1
export PGPORT=5432
export PGDATABASE=testdb

# 引用配置
gpadmin@gpmaster:/home/gpadmin/gpdata >source ~/.bash_profile

初始化配置文件【master】

拷贝配置文件,拷贝初始模板,创建个文件夹,再把模版拷贝过来

gpadmin@gpmaster:/home/gpadmin >cd ~
gpadmin@gpmaster:/home/gpadmin >mkdir gpconfigs
gpadmin@gpmaster:/home/gpadmin >cp /usr/local/greenplum-db-6.19.0/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/
gpadmin@gpmaster:/home/gpadmin >cd gpconfigs/
# 修改配置文件
gpadmin@gpmaster:/home/gpadmin/gpconfigs >vim gpinitsystem_config
# 需要修改常用的配置参数如下,供参考,路径建议提前规划/data等专用存储数据路径
gpadmin@gpmaster:/home/gpadmin/gpconfigs >cat gpinitsystem_config |grep -vE "^$|^#"
ARRAY_NAME="Greenplum Data Platform"
SEG_PREFIX=gpseg
PORT_BASE=6000
declare -a DATA_DIRECTORY=(/home/gpadmin/gpdata/gpdatap1 /home/gpadmin/gpdata/gpdatap2)
MASTER_HOSTNAME=gpmaster
MASTER_DIRECTORY=/home/gpadmin/gpdata/gpmaster
MASTER_PORT=5432
TRUSTED_SHELL=/usr/bin/ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
MIRROR_PORT_BASE=7000
declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/gpdata/gpdatam1 /home/gpadmin/gpdata/gpdatam2)

# hostfile_gpinitsystem配置存储节点清单
gpadmin@gpmaster:/home/gpadmin/gpconfigs >vim hostfile_gpinitsystem

segment01
segment02

gpadmin@gpmaster:/home/gpadmin/gpconfigs >cd
# 初始化任务
gpadmin@gpmaster:/home/gpadmin >gpinitsystem -c gpconfigs/gpinitsystem_config -h gpconfigs/hostfile_gpinitsystem
...
...
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:----------------------------------------
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-Greenplum Primary Segment Configuration
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:----------------------------------------
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-segment01 	6000 	segment01 	/home/gpadmin/gpdata/gpdatap1/gpseg0 	2
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-segment01 	6001 	segment01 	/home/gpadmin/gpdata/gpdatap2/gpseg1 	3
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-segment02 	6000 	segment02 	/home/gpadmin/gpdata/gpdatap1/gpseg2 	4
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-segment02 	6001 	segment02 	/home/gpadmin/gpdata/gpdatap2/gpseg3 	5
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:---------------------------------------
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-Greenplum Mirror Segment Configuration
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:---------------------------------------
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-segment02 	7000 	segment02 	/home/gpadmin/gpdata/gpdatam1/gpseg0 	6
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-segment02 	7001 	segment02 	/home/gpadmin/gpdata/gpdatam2/gpseg1 	7
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-segment01 	7000 	segment01 	/home/gpadmin/gpdata/gpdatam1/gpseg2 	8
20211217:12:36:54:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-segment01 	7001 	segment01 	/home/gpadmin/gpdata/gpdatam2/gpseg3 	9

Continue with Greenplum creation Yy|Nn (default=N): y
......
......
20211217:12:37:51:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-has been configured to allow all hosts within this new
20211217:12:37:51:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
20211217:12:37:51:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-new array must be explicitly added to this file
20211217:12:37:51:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
20211217:12:37:51:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-located in the /usr/local/greenplum-db-6.19.0/docs directory
20211217:12:37:51:113333 gpinitsystem:gpmaster:gpadmin-[INFO]:-------------------------------------------------------

初始化Standby【master】

gpadmin@gpmaster:/home/gpadmin >gpinitstandby -s gpstandby
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Validating environment and parameters for standby initialization...
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Checking for data directory /home/gpadmin/gpdata/gpmaster/gpseg-1 on gpstandby
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:------------------------------------------------------
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Greenplum standby master initialization parameters
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:------------------------------------------------------
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Greenplum master hostname               = gpmaster
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Greenplum master data directory         = /home/gpadmin/gpdata/gpmaster/gpseg-1
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Greenplum master port                   = 5432
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Greenplum standby master hostname       = gpstandby
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Greenplum standby master port           = 5432
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Greenplum standby master data directory = /home/gpadmin/gpdata/gpmaster/gpseg-1
20211217:12:40:14:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Greenplum update system catalog         = On
Do you want to continue with standby master initialization? Yy|Nn (default=N):
> y
20211217:12:40:19:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Syncing Greenplum Database extensions to standby
20211217:12:40:20:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-The packages on gpstandby are consistent.
20211217:12:40:20:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Adding standby master to catalog...
20211217:12:40:20:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Database catalog updated successfully.
20211217:12:40:20:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Updating pg_hba.conf file...
20211217:12:40:20:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-pg_hba.conf files updated successfully.
20211217:12:40:22:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Starting standby master
20211217:12:40:22:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Checking if standby master is running on host: gpstandby  in directory: /home/gpadmin/gpdata/gpmaster/gpseg-1
20211217:12:40:23:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Cleaning up pg_hba.conf backup files...
20211217:12:40:23:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Backup files of pg_hba.conf cleaned up successfully.
20211217:12:40:23:118597 gpinitstandby:gpmaster:gpadmin-[INFO]:-Successfully created standby master on gpstandby

修改pg_hba.conf文件连接配置项【master】

gpadmin@gpmaster:/home/gpadmin >vim /home/gpadmin/gpdata/gpmaster/gpseg-1/pg_hba.conf
# 最后增加配置项:
host all all 0.0.0.0/0 md5

查看集群状态【master】

gpadmin@gpmaster:/home/gpadmin >gpstate
20211217:12:42:01:118800 gpstate:gpmaster:gpadmin-[INFO]:-Starting gpstate with args: 
20211217:12:42:01:118800 gpstate:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211217:12:42:01:118800 gpstate:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211217:12:42:01:118800 gpstate:gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20211217:12:42:01:118800 gpstate:gpmaster:gpadmin-[INFO]:-Gathering data from segments...
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-Greenplum instance status summary
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Master instance                                           = Active
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Master standby                                            = gpstandby
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Standby master state                                      = Standby host passive
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total segment instance count from metadata                = 8
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Primary Segment Status
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segments                                    = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segment valid (at master)                   = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segment failures (at master)                = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes found                   = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Mirror Segment Status
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segments                                     = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segment valid (at master)                    = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segment failures (at master)                 = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes found                   = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number mirror segments acting as primary segments   = 0
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-   Total number mirror segments acting as mirror segments    = 4
20211217:12:42:02:118800 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------

重启greenplum数据库【master】

-r 表示restart ; gpstop不带参数为停止服务

重启验证服务是否有异常情况

gpadmin@gpmaster:/home/gpadmin >gpstop -r
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-Starting gpstop with args: -r
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-Gathering information and validating the environment...
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:---------------------------------------------
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-Master instance parameters
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:---------------------------------------------
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Master Greenplum instance process active PID   = 117400
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Database                                       = template1
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Master port                                    = 5432
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Master directory                               = /home/gpadmin/gpdata/gpmaster/gpseg-1
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Shutdown mode                                  = smart
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Timeout                                        = 120
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Shutdown Master standby host                   = On
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:---------------------------------------------
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-Segment instances that will be shutdown:
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:---------------------------------------------
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Host        Datadir                                Port   Status
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   segment01   /home/gpadmin/gpdata/gpdatap1/gpseg0   6000   u
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   segment02   /home/gpadmin/gpdata/gpdatam1/gpseg0   7000   u
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   segment01   /home/gpadmin/gpdata/gpdatap2/gpseg1   6001   u
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   segment02   /home/gpadmin/gpdata/gpdatam2/gpseg1   7001   u
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   segment02   /home/gpadmin/gpdata/gpdatap1/gpseg2   6000   u
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   segment01   /home/gpadmin/gpdata/gpdatam1/gpseg2   7000   u
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   segment02   /home/gpadmin/gpdata/gpdatap2/gpseg3   6001   u
20211217:12:44:20:119049 gpstop:gpmaster:gpadmin-[INFO]:-   segment01   /home/gpadmin/gpdata/gpdatam2/gpseg3   7001   u

Continue with Greenplum instance shutdown Yy|Nn (default=N):
> y
20211217:12:44:26:119049 gpstop:gpmaster:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='smart'
20211217:12:44:26:119049 gpstop:gpmaster:gpadmin-[INFO]:-Master segment instance directory=/home/gpadmin/gpdata/gpmaster/gpseg-1
20211217:12:44:26:119049 gpstop:gpmaster:gpadmin-[INFO]:-Stopping master segment and waiting for user connections to finish ...
server shutting down
20211217:12:44:27:119049 gpstop:gpmaster:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process
20211217:12:44:27:119049 gpstop:gpmaster:gpadmin-[INFO]:-Terminating processes for segment /home/gpadmin/gpdata/gpmaster/gpseg-1
20211217:12:44:27:119049 gpstop:gpmaster:gpadmin-[INFO]:-Stopping master standby host gpstandby mode=fast
20211217:12:44:27:119049 gpstop:gpmaster:gpadmin-[INFO]:-Successfully shutdown standby process on gpstandby
20211217:12:44:27:119049 gpstop:gpmaster:gpadmin-[INFO]:-Targeting dbid [2, 6, 3, 7, 4, 8, 5, 9] for shutdown
20211217:12:44:27:119049 gpstop:gpmaster:gpadmin-[INFO]:-Commencing parallel primary segment instance shutdown, please wait...
20211217:12:44:27:119049 gpstop:gpmaster:gpadmin-[INFO]:-0.00% of jobs completed
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-100.00% of jobs completed
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-Commencing parallel mirror segment instance shutdown, please wait...
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-0.00% of jobs completed
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-100.00% of jobs completed
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Segments stopped successfully      = 8
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-   Segments with errors during stop   = 0
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-Successfully shutdown 8 of 8 segment instances 
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-Database successfully shutdown with no errors reported
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-Cleaning up leftover gpmmon process
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-No leftover gpmmon process found
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-Cleaning up leftover gpsmon processes
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-No leftover gpsmon processes on some hosts. not attempting forceful termination on these hosts
20211217:12:44:28:119049 gpstop:gpmaster:gpadmin-[INFO]:-Cleaning up leftover shared memory
20211217:12:44:29:119049 gpstop:gpmaster:gpadmin-[INFO]:-Restarting System...

功能使用验证

使用psql登陆数据库【master】

# psql登录
gpadmin@gpmaster:/home/gpadmin >psql -d postgres
psql (9.4.26)
Type "help" for help.

# l查看数据库
postgres=# l
                               List of databases
   Name    |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges  
-----------+---------+----------+------------+------------+---------------------
 postgres  | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 template1 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
(3 rows)

# create database创建数据库
postgres=# create database wangt;
CREATE DATABASE
postgres=# l
                               List of databases
   Name    |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges  
-----------+---------+----------+------------+------------+---------------------
 postgres  | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 template1 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 wangt     | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
(4 rows)

# c切换数据库
postgres=# c wangt
You are now connected to database "wangt" as user "gpadmin".

# TEMPLATE克隆数据库
wangt=# CREATE DATABASE niubi;
CREATE DATABASE
wangt=# CREATE DATABASE niubiplus TEMPLATE niubi;
CREATE DATABASE
wangt=# l
                               List of databases
   Name    |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges  
-----------+---------+----------+------------+------------+---------------------
 niubi     | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
 niubiplus | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
 postgres  | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 template1 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 wangt     | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
(6 rows)


# SELECT datname查看数据库的列表
wangt=# SELECT datname from pg_database;
  datname  
-----------
 template1
 template0
 postgres
 wangt
 niubi
 niubiplus
(6 rows)

# drop删库
wangt=# drop database niubiplus;
DROP DATABASE

# pg_stat_activity检查活动会话
wangt=# SELECT * FROM pg_stat_activity;
 datid | datname |  pid   | sess_id | usesysid | usename | application_name | client_addr | client_hostname | client_port |         backend_start         |          xact_start           |          query_start          |         state_ch
ange          | waiting | state  | backend_xid | backend_xmin |              query              | waiting_reason | rsgid | rsgname | rsgqueueduration 
-------+---------+--------+---------+----------+---------+------------------+-------------+-----------------+-------------+-------------------------------+-------------------------------+-------------------------------+-----------------
--------------+---------+--------+-------------+--------------+---------------------------------+----------------+-------+---------+------------------
 16384 | wangt   | 119464 |       9 |       10 | gpadmin | psql             |             |                 |          -1 | 2021-12-17 12:46:46.899973+08 | 2021-12-17 12:48:39.644251+08 | 2021-12-17 12:48:39.644251+08 | 2021-12-17 12:48
:39.644255+08 | f       | active |             |          732 | SELECT * FROM pg_stat_activity; |                |     0 | unknown | 
(1 row)

# q退出数据库
wangt=# q
gpadmin@gpmaster:/home/gpadmin >

各服务器存储文件目录探寻

# master data基本目录内容(各存储目录为空 master目录下有文件)
gpadmin@gpmaster:/home/gpadmin >cd gpdata/
gpadmin@gpmaster:/home/gpadmin/gpdata >ll
total 20
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpdatam1
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpdatam2
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpdatap1
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:20 gpdatap2
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpmaster
gpadmin@gpmaster:/home/gpadmin/gpdata >for i in `ls`;do echo " > $i < " && ls $i/*/;done
 > gpdatam1 < 
ls: cannot access gpdatam1/*/: No such file or directory
 > gpdatam2 < 
ls: cannot access gpdatam2/*/: No such file or directory
 > gpdatap1 < 
ls: cannot access gpdatap1/*/: No such file or directory
 > gpdatap2 < 
ls: cannot access gpdatap2/*/: No such file or directory
 > gpmaster < 
base    gpperfmon         gpssh.conf          pg_clog            pg_dynshmem  pg_ident.conf  pg_logical    pg_notify    pg_serial     pg_stat      pg_subtrans  pg_twophase            PG_VERSION  postgresql.auto.conf  postmaster.opts
global  gpsegconfig_dump  internal.auto.conf  pg_distributedlog  pg_hba.conf  pg_log         pg_multixact  pg_replslot  pg_snapshots  pg_stat_tmp  pg_tblspc    pg_utilitymodedtmredo  pg_xlog     postgresql.conf       postmaster.pid


# 存储节点segment目录内容(各目录存放存储文件  master为空)
gpadmin@segment02:/home/gpadmin/gpdata >for i in `ls`;do echo " > $i < " && ls $i/*/;done
 > gpdatam1 < 
backup_label.old  internal.auto.conf  pg_dynshmem    pg_log        pg_notify    pg_snapshots  pg_subtrans  pg_utilitymodedtmredo  postgresql.auto.conf  postmaster.pid
base              pg_clog             pg_hba.conf    pg_logical    pg_replslot  pg_stat       pg_tblspc    PG_VERSION             postgresql.conf       recovery.conf
global            pg_distributedlog   pg_ident.conf  pg_multixact  pg_serial    pg_stat_tmp   pg_twophase  pg_xlog                postmaster.opts
 > gpdatam2 < 
backup_label.old  internal.auto.conf  pg_dynshmem    pg_log        pg_notify    pg_snapshots  pg_subtrans  pg_utilitymodedtmredo  postgresql.auto.conf  postmaster.pid
base              pg_clog             pg_hba.conf    pg_logical    pg_replslot  pg_stat       pg_tblspc    PG_VERSION             postgresql.conf       recovery.conf
global            pg_distributedlog   pg_ident.conf  pg_multixact  pg_serial    pg_stat_tmp   pg_twophase  pg_xlog                postmaster.opts
 > gpdatap1 < 
base                global              pg_clog            pg_dynshmem  pg_ident.conf  pg_logical    pg_notify    pg_serial     pg_stat      pg_subtrans  pg_twophase            PG_VERSION  postgresql.auto.conf  postmaster.opts
fts_probe_file.bak  internal.auto.conf  pg_distributedlog  pg_hba.conf  pg_log         pg_multixact  pg_replslot  pg_snapshots  pg_stat_tmp  pg_tblspc    pg_utilitymodedtmredo  pg_xlog     postgresql.conf       postmaster.pid
 > gpdatap2 < 
base                global              pg_clog            pg_dynshmem  pg_ident.conf  pg_logical    pg_notify    pg_serial     pg_stat      pg_subtrans  pg_twophase            PG_VERSION  postgresql.auto.conf  postmaster.opts
fts_probe_file.bak  internal.auto.conf  pg_distributedlog  pg_hba.conf  pg_log         pg_multixact  pg_replslot  pg_snapshots  pg_stat_tmp  pg_tblspc    pg_utilitymodedtmredo  pg_xlog     postgresql.conf       postmaster.pid
 > gpmaster < 
ls: cannot access gpmaster/*/: No such file or directory

# gpstandb 目录下情况
gpadmin@gpstandby:/home/gpadmin/gpdata >for i in `ls`;do echo " > $i < " && ls $i/*/;done
 > gpdatam1 < 
ls: cannot access gpdatam1/*/: No such file or directory
 > gpdatam2 < 
ls: cannot access gpdatam2/*/: No such file or directory
 > gpdatap1 < 
ls: cannot access gpdatap1/*/: No such file or directory
 > gpdatap2 < 
ls: cannot access gpdatap2/*/: No such file or directory
 > gpmaster < 
backup_label.old  gpperfmon         internal.auto.conf  pg_dynshmem    pg_log        pg_notify    pg_snapshots  pg_subtrans  pg_utilitymodedtmredo  postgresql.auto.conf  postmaster.pid
base              gpsegconfig_dump  pg_clog             pg_hba.conf    pg_logical    pg_replslot  pg_stat       pg_tblspc    PG_VERSION             postgresql.conf       recovery.conf
global            gpssh.conf        pg_distributedlog   pg_ident.conf  pg_multixact  pg_serial    pg_stat_tmp   pg_twophase  pg_xlog                postmaster.opts

# 对比说明数据均存储在各segment节点,管理数据存在master,gpstandby同步管理数据

使用pgadmin可视化界面管理工具

官方地址:https://www.pgadmin.org/

下载地址:https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v6.3/windows/pgadmin4-6.3-x64.exe

(其它版本需要在官网download下找到对应操作系统去下载)

pgadmin4-6.3-x64.exe安装完毕打开

初次登录设置解锁密码

(根据喜好随意设置)

在这里插入图片描述

创建远程连接库

点击屏幕右边Add New Server / 或者右键左边Browser-Servers创建连接

在这里插入图片描述

填写配置项-General

在这里插入图片描述

填写配置项-Connection

在这里插入图片描述

使用界面管理工具pgadmin

在这里插入图片描述
和常用的navicat、heidi等等工具比较类似

greenplum6数据库节点扩容实施

greenplum横向扩容实施介绍

相当于增加服务器数量,原有服务器节点保持现状,增加服务器存储节点

padmin@gpmaster:/home/gpadmin >psql -d postgres
psql (9.4.26)
Type "help" for help.

postgres=# SELECT * from gp_segment_configuration ;
 dbid | content | role | preferred_role | mode | status | port | hostname  |  address  |                datadir                
------+---------+------+----------------+------+--------+------+-----------+-----------+---------------------------------------
    1 |      -1 | p    | p              | n    | u      | 5432 | gpmaster  | gpmaster  | /home/gpadmin/gpdata/gpmaster/gpseg-1
    2 |       0 | p    | p              | s    | u      | 6000 | segment01 | segment01 | /home/gpadmin/gpdata/gpdatap1/gpseg0
    6 |       0 | m    | m              | s    | u      | 7000 | segment02 | segment02 | /home/gpadmin/gpdata/gpdatam1/gpseg0
    3 |       1 | p    | p              | s    | u      | 6001 | segment01 | segment01 | /home/gpadmin/gpdata/gpdatap2/gpseg1
    7 |       1 | m    | m              | s    | u      | 7001 | segment02 | segment02 | /home/gpadmin/gpdata/gpdatam2/gpseg1
   10 |      -1 | m    | m              | s    | u      | 5432 | gpstandby | gpstandby | /home/gpadmin/gpdata/gpmaster/gpseg-1
    5 |       3 | p    | p              | s    | u      | 6001 | segment02 | segment02 | /home/gpadmin/gpdata/gpdatap2/gpseg3
    9 |       3 | m    | m              | s    | u      | 7001 | segment01 | segment01 | /home/gpadmin/gpdata/gpdatam2/gpseg3
    4 |       2 | p    | p              | s    | u      | 6000 | segment02 | segment02 | /home/gpadmin/gpdata/gpdatap1/gpseg2
    8 |       2 | m    | m              | s    | u      | 7000 | segment01 | segment01 | /home/gpadmin/gpdata/gpdatam1/gpseg2
(10 rows)

postgres=# q

原有存储节点segment01和segment02;现增加segment03和segment04

横扩新增节点安装相关操作

【segment03、segment04】 只列举了03,04操作相同,04复制粘贴即可

# 更改主机名
root@ydt-dmcp-segment03:/root #hostnamectl set-hostname segment03
root@segment03:/root #yum install -y apr apr-util bash bzip2 curl krb5 libcurl libevent libxml2 libyaml zlib openldap openssh openssl openssl-libs perl readline rsync R sed tar zip krb5-devel

# 关闭SELINUX与防火墙
[root@segment03 ~]# vim /etc/selinux/config 
SELINUX=disabled

# 关闭防火墙
root@segment03:/root #systemctl stop firewalld.service
root@segment03:/root #systemctl disable firewalld.service

# 配置hosts主机解析
root@segment03:/root #vim /etc/hosts

127.0.0.1   ydt-dmcp-segment03
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

# greenplum
11.8.37.111 gpmaster
11.8.37.112 gpstandby
11.8.37.113 segment01
11.8.37.114 segment02
11.8.37.115 segment03
11.8.37.116 segment04

【注意】: 原有集群各机器hosts中均补充增加segment03和segment04解析
【注意】: 原有集群各机器hosts中均补充增加segment03和segment04解析


# 修改内核配置参数
root@segment03:/root #vim /etc/sysctl.conf 

kernel.shmall = 4000000000
kernel.shmmax = 500000000
kernel.shmmni = 4096
vm.overcommit_memory = 2
vm.overcommit_ratio = 95
net.ipv4.ip_local_port_range = 10000 65535
kernel.sem = 500 2048000 200 40960
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.swappiness = 10
vm.zone_reclaim_mode = 0
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
vm.dirty_background_ratio = 0
vm.dirty_ratio = 0
vm.dirty_background_bytes = 1610612736
vm.dirty_bytes = 4294967296

# 加载生效
root@segment03:/root #sysctl -p

# 配置资源限制参数
root@segment03:/root #vim /etc/security/limits.conf

# End of file
* soft nofile 524288
* hard nofile 524288
* soft nproc 131072
* hard nproc 131072

# 创建用户与用户组
root@segment03:/root #groupadd -g 530 gpadmin
root@segment03:/root #useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin

# 文件夹授权与创建密码
root@segment03:/root #chown -R gpadmin:gpadmin /home/gpadmin/
root@segment03:/root #echo gpadmin|passwd --stdin gpadmin
Changing password for user gpadmin.
passwd: all authentication tokens updated successfully.

# 创建安装目录与授权
root@segment03:/root #mkdir /usr/local/greenplum
root@segment03:/root #chown -R gpadmin:gpadmin /usr/local/greenplum/

# 创建存储文件路径文件夹
gpadmin@segment03:/home/gpadmin >mkdir gpdata
gpadmin@segment03:/home/gpadmin >cd gpdata/
gpadmin@segment03:/home/gpadmin/gpdata >mkdir gpmaster gpdatap1 gpdatap2 gpdatam1 gpdatam2

# 配置免密互访
root@segment03:/root #su - gpadmin
gpadmin@segment03:/home/gpadmin >ssh-keygen -t rsa

gpadmin@segment03:/home/gpadmin >ssh-copy-id gpmaster
gpadmin@segment03:/home/gpadmin >ssh-copy-id gpstandby
gpadmin@segment03:/home/gpadmin >ssh-copy-id segment01
gpadmin@segment03:/home/gpadmin >ssh-copy-id segment02
gpadmin@segment03:/home/gpadmin >ssh-copy-id segment03
gpadmin@segment03:/home/gpadmin >ssh-copy-id segment04

【注意】: 原有集群各机器也补充配置到segment03、segment04的免密
【注意】: 原有集群各机器也补充配置到segment03、segment04的免密

# 拉取greenplum安装包
gpadmin@segment03:/home/gpadmin >cd /usr/local/greenplum/
gpadmin@segment03:/usr/local/greenplum >scp gpmaster:/usr/local/greenplum/open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm .

# 切换root用户安装greenplum
gpadmin@segment03:/usr/local/greenplum >su - root 
Password: 
Last login: Wed Dec 22 10:59:14 CST 2021 from 11.14.2.37 on pts/0
root@segment03:/root #ll
total 4
-rw-------. 1 root root 1573 Apr 24  2019 anaconda-ks.cfg
root@segment03:/root #cd /usr/local/greenplum/
root@segment03:/usr/local/greenplum #yum install -y open-source-greenplum-db-6.19.0-rhel7-x86_64.rpm

# 将应用目录授权给gpadmin
root@segment03:/usr/local/greenplum #chown -R gpadmin:gpadmin /usr/local/greenplum*

gpmaster配置工作

# hostlist更改,增加新主机
【master】
gpadmin@gpmaster:/usr/local/conf >vim hostlist 

gpmaster
gpstandby
segment01
segment02
segment03
segment04


# seg_hosts更改,增加新主机
gpadmin@gpmaster:/usr/local/conf >vim seg_hosts 

segment01
segment02
segment03
segment04

# 获取指定包含用于系统扩展的新主机列表的文件的名称
gpadmin@gpmaster:/usr/local/conf >gpssh-exkeys -f hostlist
[STEP 1 of 5] create local ID and authorize on local host
  ... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped

[STEP 2 of 5] keyscan all hosts and update known_hosts file

[STEP 3 of 5] retrieving credentials from remote hosts
  ... send to gpstandby
  ... send to segment01
  ... send to segment02
  ... send to segment03
  ... send to segment04

[STEP 4 of 5] determine common authentication file content

[STEP 5 of 5] copy authentication files to all remote hosts
  ... finished key exchange with gpstandby
  ... finished key exchange with segment01
  ... finished key exchange with segment02
  ... finished key exchange with segment03
  ... finished key exchange with segment04

[INFO] completed successfully

# 检查测试集群信息
gpadmin@gpmaster:/usr/local/conf >gpssh -f hostlist -e "hostname"
[segment02] hostname
[segment02] segment02
[gpstandby] hostname
[gpstandby] gpstandby
[segment03] hostname
[segment03] segment03
[ gpmaster] hostname
[ gpmaster] gpmaster
[segment01] hostname
[segment01] segment01
[segment04] hostname
[segment04] segment04


# 使用gpexpand创建初始化文件
gpadmin@gpmaster:/usr/local/conf >gpexpand -f seg_hosts 
20211222:15:58:53:029693 gpexpand:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:15:58:53:029693 gpexpand:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:15:58:53:029693 gpexpand:gpmaster:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state

System Expansion is used to add segments to an existing GPDB array.
gpexpand did not detect a System Expansion that is in progress.

Before initiating a System Expansion, you need to provision and burn-in
the new hardware.  Please be sure to run gpcheckperf to make sure the
new hardware is working properly.

Please refer to the Admin Guide for more information.

Would you like to initiate a new System Expansion Yy|Nn (default=N):
> y                # yes

You must now specify a mirroring strategy for the new hosts.  Spread mirroring places
a given hosts mirrored segments each on a separate host.  You must be 
adding more hosts than the number of segments per host to use this. 
Grouped mirroring places all of a given hosts segments on a single 
mirrored host.  You must be adding at least 2 hosts in order to use this.



What type of mirroring strategy would you like?
 spread|grouped (default=grouped):
> grouped        # 直接回车也可以,默认就是grouped

    By default, new hosts are configured with the same number of primary
    segments as existing hosts.  Optionally, you can increase the number
    of segments per host.

    For example, if existing hosts have two primary segments, entering a value
    of 2 will initialize two additional segments on existing hosts, and four
    segments on new hosts.  In addition, mirror segments will be added for
    these new primary segments if mirroring is enabled.
    

How many new primary segments per host do you want to add? (default=0):
> 0                # 直接回车也可以,默认就是0

Generating configuration file...

20211222:15:59:41:029693 gpexpand:gpmaster:gpadmin-[INFO]:-Generating input file...

Input configuration file was written to 'gpexpand_inputfile_20211222_155941'.

Please review the file and make sure that it is correct then re-run
with: gpexpand -i gpexpand_inputfile_20211222_155941
                
20211222:15:59:41:029693 gpexpand:gpmaster:gpadmin-[INFO]:-Exiting...


# 查看生成的初始化文件
gpadmin@gpmaster:/usr/local/conf >ll
total 12
-rw-rw-r-- 1 gpadmin gpadmin 552 Dec 22 15:59 gpexpand_inputfile_20211222_155941
-rw-rw-r-- 1 gpadmin gpadmin  59 Dec 22 15:55 hostlist
-rw-rw-r-- 1 gpadmin gpadmin  40 Dec 22 15:55 seg_hosts
gpadmin@gpmaster:/usr/local/conf >cat gpexpand_inputfile_20211222_155941 
segment03|segment03|6000|/home/gpadmin/gpdata/gpdatap1/gpseg4|11|4|p
segment04|segment04|7000|/home/gpadmin/gpdata/gpdatam1/gpseg4|17|4|m
segment03|segment03|6001|/home/gpadmin/gpdata/gpdatap2/gpseg5|12|5|p
segment04|segment04|7001|/home/gpadmin/gpdata/gpdatam2/gpseg5|18|5|m
segment04|segment04|6000|/home/gpadmin/gpdata/gpdatap1/gpseg6|13|6|p
segment03|segment03|7000|/home/gpadmin/gpdata/gpdatam1/gpseg6|15|6|m
segment04|segment04|6001|/home/gpadmin/gpdata/gpdatap2/gpseg7|14|7|p
segment03|segment03|7001|/home/gpadmin/gpdata/gpdatam2/gpseg7|16|7|m


# 利用生成的初始化文件,初始化Segment并且创建扩容schema
gpadmin@gpmaster:/usr/local/conf >gpexpand -i gpexpand_inputfile_20211222_155941 
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_purchase
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_purchase
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_catalog_order
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_catalog_order
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_web_order
20211222:16:03:33:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_web_order
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_catalog_order_lineitem
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_catalog_order_lineitem
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_web_order_lineitem
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_web_order_lineitem
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_store_returns
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_store_returns
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_catalog_returns
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_catalog_returns
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_inventory
20211222:16:03:34:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_inventory
20211222:16:03:35:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_purchase_lineitem
20211222:16:03:35:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_purchase_lineitem
20211222:16:03:35:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds2.public.dbgen_version
....
....
20211222:16:11:27:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds.public.customer_address
20211222:16:11:27:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds.public.customer_address
20211222:16:11:28:030429 gpexpand:gpmaster:gpadmin-[INFO]:-EXPANSION COMPLETED SUCCESSFULLY
20211222:16:11:28:030429 gpexpand:gpmaster:gpadmin-[INFO]:-Exiting...
【注意】如果数据量比较大这一步时间较长,需耐心等待
【注意】如果数据量比较大这一步时间较长,需耐心等待


gpadmin@gpmaster:/usr/local/conf >psql -d postgres
psql (9.4.26)
Type "help" for help.

postgres=# SELECT * from gp_segment_configuration;
 dbid | content | role | preferred_role | mode | status | port | hostname  |  address  |                datadir                
------+---------+------+----------------+------+--------+------+-----------+-----------+---------------------------------------
    1 |      -1 | p    | p              | n    | u      | 5432 | gpmaster  | gpmaster  | /home/gpadmin/gpdata/gpmaster/gpseg-1
    2 |       0 | p    | p              | s    | u      | 6000 | segment01 | segment01 | /home/gpadmin/gpdata/gpdatap1/gpseg0
    6 |       0 | m    | m              | s    | u      | 7000 | segment02 | segment02 | /home/gpadmin/gpdata/gpdatam1/gpseg0
    3 |       1 | p    | p              | s    | u      | 6001 | segment01 | segment01 | /home/gpadmin/gpdata/gpdatap2/gpseg1
    7 |       1 | m    | m              | s    | u      | 7001 | segment02 | segment02 | /home/gpadmin/gpdata/gpdatam2/gpseg1
   10 |      -1 | m    | m              | s    | u      | 5432 | gpstandby | gpstandby | /home/gpadmin/gpdata/gpmaster/gpseg-1
    5 |       3 | p    | p              | s    | u      | 6001 | segment02 | segment02 | /home/gpadmin/gpdata/gpdatap2/gpseg3
    9 |       3 | m    | m              | s    | u      | 7001 | segment01 | segment01 | /home/gpadmin/gpdata/gpdatam2/gpseg3
    4 |       2 | p    | p              | s    | u      | 6000 | segment02 | segment02 | /home/gpadmin/gpdata/gpdatap1/gpseg2
    8 |       2 | m    | m              | s    | u      | 7000 | segment01 | segment01 | /home/gpadmin/gpdata/gpdatam1/gpseg2
   11 |       4 | p    | p              | s    | u      | 6000 | segment03 | segment03 | /home/gpadmin/gpdata/gpdatap1/gpseg4
   17 |       4 | m    | m              | s    | u      | 7000 | segment04 | segment04 | /home/gpadmin/gpdata/gpdatam1/gpseg4
   12 |       5 | p    | p              | s    | u      | 6001 | segment03 | segment03 | /home/gpadmin/gpdata/gpdatap2/gpseg5
   18 |       5 | m    | m              | s    | u      | 7001 | segment04 | segment04 | /home/gpadmin/gpdata/gpdatam2/gpseg5
   13 |       6 | p    | p              | s    | u      | 6000 | segment04 | segment04 | /home/gpadmin/gpdata/gpdatap1/gpseg6
   15 |       6 | m    | m              | s    | u      | 7000 | segment03 | segment03 | /home/gpadmin/gpdata/gpdatam1/gpseg6
   14 |       7 | p    | p              | s    | u      | 6001 | segment04 | segment04 | /home/gpadmin/gpdata/gpdatap2/gpseg7
   16 |       7 | m    | m              | s    | u      | 7001 | segment03 | segment03 | /home/gpadmin/gpdata/gpdatam2/gpseg7
(18 rows)


# 重新分布数据
gpadmin@gpmaster:/usr/local/conf >gpexpand -d 1:00:00
20211222:16:14:46:031599 gpexpand:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:14:46:031599 gpexpand:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:14:46:031599 gpexpand:gpmaster:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state
20211222:16:14:46:031599 gpexpand:gpmaster:gpadmin-[INFO]:-Expansion has already completed.
20211222:16:14:46:031599 gpexpand:gpmaster:gpadmin-[INFO]:-If you want to expand again, run gpexpand -c to remove
20211222:16:14:46:031599 gpexpand:gpmaster:gpadmin-[INFO]:-the gpexpand schema and begin a new expansion
20211222:16:14:46:031599 gpexpand:gpmaster:gpadmin-[INFO]:-Exiting...



# 移除扩容schema
gpadmin@gpmaster:/usr/local/conf >gpexpand -c
20211222:16:16:48:031814 gpexpand:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:16:48:031814 gpexpand:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:16:48:031814 gpexpand:gpmaster:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state


Do you want to dump the gpexpand.status_detail table to file? Yy|Nn (default=Y):
> y
20211222:16:16:58:031814 gpexpand:gpmaster:gpadmin-[INFO]:-Dumping gpexpand.status_detail to /home/gpadmin/gpdata/gpmaster/gpseg-1/gpexpand.status_detail
20211222:16:16:58:031814 gpexpand:gpmaster:gpadmin-[INFO]:-Removing gpexpand schema
20211222:16:16:58:031814 gpexpand:gpmaster:gpadmin-[INFO]:-Cleanup Finished.  exiting...


# 重新查看集群运行信息
gpadmin@gpmaster:/usr/local/conf >gpstate
20211222:16:17:16:031878 gpstate:gpmaster:gpadmin-[INFO]:-Starting gpstate with args: 
20211222:16:17:16:031878 gpstate:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:17:16:031878 gpstate:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:17:16:031878 gpstate:gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20211222:16:17:16:031878 gpstate:gpmaster:gpadmin-[INFO]:-Gathering data from segments...
.
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-Greenplum instance status summary
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Master instance                                           = Active
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Master standby                                            = gpstandby
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Standby master state                                      = Standby host passive
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total segment instance count from metadata                = 16
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Primary Segment Status
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segments                                    = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segment valid (at master)                   = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segment failures (at master)                = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes found                   = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Mirror Segment Status
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segments                                     = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segment valid (at master)                    = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segment failures (at master)                 = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes found                   = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number mirror segments acting as primary segments   = 0
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-   Total number mirror segments acting as mirror segments    = 8
20211222:16:17:17:031878 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------

# 【注意】 gpexpand -r  # 是回滚操作;扩容失败或者出错gpexpand -r可以回滚
# 【注意】 gpexpand -r  # 是回滚操作;扩容失败或者出错gpexpand -r可以回滚

横向扩容到这一步实施完毕。

greenplum纵向扩容实施操作

相当于集群机器保持原样,通过更改配置,利用cpu核数增加存储数

最后效果就是每个单机存储节点上的seg目录增加了
因为没有新增服务器,所以操作基本都是在gpmaster上实施
【注意】: 纵向扩容前原来4C的配置升级到了6C

gpmaster上配置工作

# 查看目前的集群状态信息
gpadmin@gpmaster:/home/gpadmin >gpstate
20211222:16:40:47:033907 gpstate:gpmaster:gpadmin-[INFO]:-Starting gpstate with args: 
20211222:16:40:47:033907 gpstate:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:40:47:033907 gpstate:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:40:47:033907 gpstate:gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20211222:16:40:47:033907 gpstate:gpmaster:gpadmin-[INFO]:-Gathering data from segments...
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-Greenplum instance status summary
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Master instance                                           = Active
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Master standby                                            = gpstandby
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Standby master state                                      = Standby host passive
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total segment instance count from metadata                = 16
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Primary Segment Status
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segments                                    = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segment valid (at master)                   = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segment failures (at master)                = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes found                   = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Mirror Segment Status
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segments                                     = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segment valid (at master)                    = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segment failures (at master)                 = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes found                   = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number mirror segments acting as primary segments   = 0
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-   Total number mirror segments acting as mirror segments    = 8
20211222:16:40:48:033907 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------


# 在每个segment上的存储路径下,创建新的存储目录
# segment01、segment02、segment03、segment04
gpadmin@segment01:/home/gpadmin/gpdata >ll
total 20
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatam1
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatam2
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatap1
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatap2
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:22 gpmaster
gpadmin@segment01:/home/gpadmin/gpdata >
# 创建gpdatap3和gpdatam3目录
gpadmin@segment01:/home/gpadmin/gpdata >mkdir gpdatap3 gpdatam3
gpadmin@segment01:/home/gpadmin/gpdata >ll
total 28
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatam1
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatam2
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 22 16:48 gpdatam3
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatap1
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatap2
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 22 16:48 gpdatap3
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:22 gpmaster

# 在master上操作
gpadmin@gpmaster:/usr/local/conf >gpexpand -f seg_hosts 
20211222:16:51:39:034841 gpexpand:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:51:39:034841 gpexpand:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:51:39:034841 gpexpand:gpmaster:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state

System Expansion is used to add segments to an existing GPDB array.
gpexpand did not detect a System Expansion that is in progress.

Before initiating a System Expansion, you need to provision and burn-in
the new hardware.  Please be sure to run gpcheckperf to make sure the
new hardware is working properly.

Please refer to the Admin Guide for more information.

Would you like to initiate a new System Expansion Yy|Nn (default=N):
> y

You must now specify a mirroring strategy for the new hosts.  Spread mirroring places
a given hosts mirrored segments each on a separate host.  You must be 
adding more hosts than the number of segments per host to use this. 
Grouped mirroring places all of a given hosts segments on a single 
mirrored host.  You must be adding at least 2 hosts in order to use this.



What type of mirroring strategy would you like?
 spread|grouped (default=grouped):
> grouped

** No hostnames were given that do not already exist in the **
** array. Additional segments will be added existing hosts. **

    By default, new hosts are configured with the same number of primary
    segments as existing hosts.  Optionally, you can increase the number
    of segments per host.

    For example, if existing hosts have two primary segments, entering a value
    of 2 will initialize two additional segments on existing hosts, and four
    segments on new hosts.  In addition, mirror segments will be added for
    these new primary segments if mirroring is enabled.
    

How many new primary segments per host do you want to add? (default=0):
> 1                    # 这里多少意味着增加多少(但是需要考虑cpu核数是否支持扩容)
Enter new primary data directory 1:
> /home/gpadmin/gpdata/gpdatap3
Enter new mirror data directory 1:
> /home/gpadmin/gpdata/gpdatam3

Generating configuration file...

20211222:16:53:32:034841 gpexpand:gpmaster:gpadmin-[INFO]:-Generating input file...

Input configuration file was written to 'gpexpand_inputfile_20211222_165332'.

Please review the file and make sure that it is correct then re-run
with: gpexpand -i gpexpand_inputfile_20211222_165332
                
20211222:16:53:32:034841 gpexpand:gpmaster:gpadmin-[INFO]:-Exiting...
gpadmin@gpmaster:/usr/local/conf >ll
total 16
-rw-rw-r-- 1 gpadmin gpadmin 552 Dec 22 15:59 gpexpand_inputfile_20211222_155941
-rw-rw-r-- 1 gpadmin gpadmin 560 Dec 22 16:53 gpexpand_inputfile_20211222_165332
-rw-rw-r-- 1 gpadmin gpadmin  59 Dec 22 15:55 hostlist
-rw-rw-r-- 1 gpadmin gpadmin  40 Dec 22 15:55 seg_hosts

# 查看生成初始化文件
gpadmin@gpmaster:/usr/local/conf >cat gpexpand_inputfile_20211222_165332
segment01|segment01|6002|/home/gpadmin/gpdata/gpdatap3/gpseg8|19|8|p
segment02|segment02|7002|/home/gpadmin/gpdata/gpdatam3/gpseg8|24|8|m
segment02|segment02|6002|/home/gpadmin/gpdata/gpdatap3/gpseg9|20|9|p
segment03|segment03|7002|/home/gpadmin/gpdata/gpdatam3/gpseg9|25|9|m
segment03|segment03|6002|/home/gpadmin/gpdata/gpdatap3/gpseg10|21|10|p
segment04|segment04|7002|/home/gpadmin/gpdata/gpdatam3/gpseg10|26|10|m
segment04|segment04|6002|/home/gpadmin/gpdata/gpdatap3/gpseg11|22|11|p
segment01|segment01|7002|/home/gpadmin/gpdata/gpdatam3/gpseg11|23|11|m

# 利用生成的初始化文件,初始化Segment并且创建扩容schema
gpadmin@gpmaster:/usr/local/conf >gpexpand -i gpexpand_inputfile_20211222_165332
20211222:16:54:57:035143 gpexpand:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:54:57:035143 gpexpand:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:54:57:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state
20211222:16:54:58:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Heap checksum setting consistent across cluster
20211222:16:54:58:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Syncing Greenplum Database extensions
20211222:16:54:58:035143 gpexpand:gpmaster:gpadmin-[INFO]:-The packages on segment02 are consistent.
20211222:16:54:59:035143 gpexpand:gpmaster:gpadmin-[INFO]:-The packages on segment03 are consistent.
20211222:16:54:59:035143 gpexpand:gpmaster:gpadmin-[INFO]:-The packages on segment01 are consistent.
20211222:16:54:59:035143 gpexpand:gpmaster:gpadmin-[INFO]:-The packages on segment04 are consistent.
20211222:16:55:00:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Locking catalog
20211222:16:55:00:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Locked catalog
20211222:16:55:00:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Creating segment template
20211222:16:55:03:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Copying postgresql.conf from existing segment into template
20211222:16:55:03:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Copying pg_hba.conf from existing segment into template
20211222:16:55:04:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Creating schema tar file
20211222:16:55:04:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Distributing template tar file to new hosts
20211222:16:55:07:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Configuring new segments (primary)
20211222:16:55:07:035143 gpexpand:gpmaster:gpadmin-[INFO]:-{'segment02': '/home/gpadmin/gpdata/gpdatap3/gpseg9:6002:true:false:20:9::-1:', 'segment03': '/home/gpadmin/gpdata/gpdatap3/gpseg10:6002:true:false:21:10::-1:', 'segment01': '/home/gpadmin/gpdata/gpdatap3/gpseg8:6002:true:false:19:8::-1:', 'segment04': '/home/gpadmin/gpdata/gpdatap3/gpseg11:6002:true:false:22:11::-1:'}
20211222:16:55:16:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Cleaning up temporary template files
20211222:16:55:16:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Cleaning up databases in new segments.
20211222:16:55:18:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Unlocking catalog
20211222:16:55:18:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Unlocked catalog
20211222:16:55:18:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Creating expansion schema
20211222:16:55:19:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database template1
20211222:16:55:19:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database postgres
20211222:16:55:19:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database wangt
20211222:16:55:19:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database niubi
20211222:16:55:19:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database tpcds
20211222:16:55:19:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database tpcds_source
20211222:16:55:19:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database tpcds2
20211222:16:55:20:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database tpcds3
20211222:16:55:20:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database today1221
20211222:16:55:20:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database testdb
20211222:16:55:21:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Starting new mirror segment synchronization
20211222:16:55:31:035143 gpexpand:gpmaster:gpadmin-[INFO]:-************************************************
20211222:16:55:31:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Initialization of the system expansion complete.
20211222:16:55:31:035143 gpexpand:gpmaster:gpadmin-[INFO]:-To begin table expansion onto the new segments
20211222:16:55:31:035143 gpexpand:gpmaster:gpadmin-[INFO]:-rerun gpexpand
20211222:16:55:31:035143 gpexpand:gpmaster:gpadmin-[INFO]:-************************************************
20211222:16:55:31:035143 gpexpand:gpmaster:gpadmin-[INFO]:-Exiting...


# 查看最新集群状态信息
gpadmin@gpmaster:/usr/local/conf >gpstate
20211222:16:56:08:035588 gpstate:gpmaster:gpadmin-[INFO]:-Starting gpstate with args: 
20211222:16:56:08:035588 gpstate:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:56:08:035588 gpstate:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:56:08:035588 gpstate:gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20211222:16:56:08:035588 gpstate:gpmaster:gpadmin-[INFO]:-Gathering data from segments...
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-Greenplum instance status summary
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Master instance                                           = Active
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Master standby                                            = gpstandby
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Standby master state                                      = Standby host passive
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total segment instance count from metadata                = 24
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Primary Segment Status
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segments                                    = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segment valid (at master)                   = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total primary segment failures (at master)                = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes found                   = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Mirror Segment Status
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segments                                     = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segment valid (at master)                    = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total mirror segment failures (at master)                 = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number postmaster processes found                   = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number mirror segments acting as primary segments   = 0
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Total number mirror segments acting as mirror segments    = 12
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-   Cluster Expansion                                         = In Progress
20211222:16:56:09:035588 gpstate:gpmaster:gpadmin-[INFO]:-----------------------------------------------------


# 重新分布数据
gpadmin@gpmaster:/usr/local/conf >gpexpand -d 1:00:00
20211222:16:57:10:035731 gpexpand:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:16:57:10:035731 gpexpand:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:16:57:10:035731 gpexpand:gpmaster:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state
20211222:16:57:10:035731 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_catalog_order
20211222:16:57:10:035731 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_catalog_order
20211222:16:57:10:035731 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds_source.public.s_web_order
20211222:16:57:11:035731 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds_source.public.s_web_order
......
......
20211222:17:03:42:035731 gpexpand:gpmaster:gpadmin-[INFO]:-Expanding tpcds.public.catalog_returns
20211222:17:03:42:035731 gpexpand:gpmaster:gpadmin-[INFO]:-Finished expanding tpcds.public.catalog_returns
20211222:17:03:46:035731 gpexpand:gpmaster:gpadmin-[INFO]:-EXPANSION COMPLETED SUCCESSFULLY
20211222:17:03:46:035731 gpexpand:gpmaster:gpadmin-[INFO]:-Exiting...


#  移除扩容schema
gpadmin@gpmaster:/usr/local/conf >gpexpand -c
20211222:17:04:38:036616 gpexpand:gpmaster:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20211222:17:04:38:036616 gpexpand:gpmaster:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec  8 2021 23:08:44'
20211222:17:04:38:036616 gpexpand:gpmaster:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state


Do you want to dump the gpexpand.status_detail table to file? Yy|Nn (default=Y):
> y
20211222:17:04:43:036616 gpexpand:gpmaster:gpadmin-[INFO]:-Dumping gpexpand.status_detail to /home/gpadmin/gpdata/gpmaster/gpseg-1/gpexpand.status_detail
20211222:17:04:43:036616 gpexpand:gpmaster:gpadmin-[INFO]:-Removing gpexpand schema
20211222:17:04:43:036616 gpexpand:gpmaster:gpadmin-[INFO]:-Cleanup Finished.  exiting...

# 查看gpdatap3和gpdatam3目录情况
gpadmin@segment01:/home/gpadmin/gpdata >ll
total 28
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatam1
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatam2
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 22 16:55 gpdatam3
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatap1
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 17 12:37 gpdatap2
drwxrwxr-x 3 gpadmin gpadmin 4096 Dec 22 16:55 gpdatap3
drwxrwxr-x 2 gpadmin gpadmin 4096 Dec 17 12:22 gpmaster
gpadmin@segment01:/home/gpadmin/gpdata >ll gpdatap3/
total 4
drwx------ 22 gpadmin gpadmin 4096 Dec 22 16:55 gpseg8
gpadmin@segment01:/home/gpadmin/gpdata >ll gpdatap3/gpseg8/
total 224
-rw-------  1 gpadmin gpadmin   208 Dec 22 16:55 backup_label.old
drwx------ 14 gpadmin gpadmin  4096 Dec 22 16:55 base
-rw-------  1 gpadmin gpadmin 32768 Dec 22 17:05 fts_probe_file.bak
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 global
-rw-rw-r--  1 gpadmin gpadmin     5 Dec 22 16:55 gpexpand.pid
-rw-rw-r--  1 gpadmin gpadmin   181 Dec 22 16:55 gpexpand.status
-rw-r--r--  1 gpadmin gpadmin  6658 Dec 22 16:55 gpexpand.status_detail
drwxrwxr-x  3 gpadmin gpadmin  4096 Dec 22 16:55 gpperfmon
-rw-------  1 gpadmin gpadmin   675 Dec 22 16:55 gpsegconfig_dump
-rw-rw-r--  1 gpadmin gpadmin   860 Dec 22 16:55 gpssh.conf
-rw-rw-r--  1 gpadmin gpadmin    11 Dec 22 16:55 internal.auto.conf
-rw-rw-r--  1 gpadmin gpadmin    14 Dec 22 16:55 internal.auto.conf.bak
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_clog
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_distributedlog
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_dynshmem
-rw-rw-r--  1 gpadmin gpadmin  4938 Dec 22 16:55 pg_hba.conf
-rw-------  1 gpadmin gpadmin  1636 Dec 22 16:55 pg_ident.conf
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_log
drwx------  4 gpadmin gpadmin  4096 Dec 22 16:55 pg_logical
drwx------  4 gpadmin gpadmin  4096 Dec 22 16:55 pg_multixact
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_notify
drwx------  3 gpadmin gpadmin  4096 Dec 22 16:55 pg_replslot
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_serial
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_snapshots
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_stat
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_stat_tmp
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_subtrans
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_tblspc
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_twophase
drwx------  2 gpadmin gpadmin  4096 Dec 22 16:55 pg_utilitymodedtmredo
-rw-------  1 gpadmin gpadmin     4 Dec 22 16:55 PG_VERSION
drwx------  3 gpadmin gpadmin  4096 Dec 22 17:02 pg_xlog
-rw-------  1 gpadmin gpadmin   120 Dec 22 16:55 postgresql.auto.conf
-rw-------  1 gpadmin gpadmin 23507 Dec 22 16:55 postgresql.conf
-rw-------  1 gpadmin gpadmin 23507 Dec 22 16:55 postgresql.conf.bak
-rw-------  1 gpadmin gpadmin   123 Dec 22 16:55 postmaster.opts
-rw-------  1 gpadmin gpadmin    86 Dec 22 16:55 postmaster.pid

纵向扩容到这一步实施完毕。

最后

以上就是哭泣白开水为你收集整理的greenplum6数据库安装部署以及扩容介绍greenplum数据库安装部署的全部内容,希望文章能够帮你解决greenplum6数据库安装部署以及扩容介绍greenplum数据库安装部署所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(45)

评论列表共有 0 条评论

立即
投稿
返回
顶部