架构:默认Grouped Miior,建议Spread Mirror
172.24.3.76「Master」
-------------------------
| | |
172.24.3.77 172.24.3.78 172.24.3.79
Primary 1 Primary 3 Primary 5
Primary 2 Primary 4 Primary 6
Mirror 5 Mirror 1 Mirror 3
Mirror 6 Mirror 2 Mirror 4
Master Standy
目录:
第一部分 - Linux Configuration 「所有节点」
第二部分 - 安装Greenplum
第三部分 - GUI工具
第四部分 - Standby Master管理
第一部分 - Linux Configuration 「所有节点」
Add User 「所有节点执行」添加用户
groupadd -g 530 gpadmin
useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin
chown -R gpadmin.gpadmin /home/gpadmin
echo "gpadmin" | passwd --stdin gpadmin
关闭 SELinux 、 iptables
cat /etc/selinux/config | grep "^SELINUX="
SELINUX=disabled
sestatus # 查看当前SeLinux配置是 disabled
/etc/init.d/iptables status
chkconfig --list | grep iptables | grep on
Yum 「防止初始化失败,ed 命令来修改配置文件」
yum install ed -y
配置主机名 hosts
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.24.3.76 dbaone
172.24.3.77 dbatwo
172.24.3.78 dbathree
172.24.3.79 dbafour
scp /etc/hosts dbaone:/etc
scp /etc/hosts dbatwo:/etc
scp /etc/hosts dbathree:/etc
scp /etc/hosts dbafour:/etc
配置内核参数
vim /etc/sysctl.conf
#xfs_mount_options = rw,noatime,inode64,allocsize=16m # 因为使用不是xfs,所以注释此行kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 512000 100 2048
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.ipv4.conf.defalut.arp_filter = 1
# add 20160331 ########
net.ipv4.ip_local_port_range = 1025 65535
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
#vm.overcommit_memory = 2 ### 测试环境要取消这个,否则oracle启不来 ### 值为1
sysctl -p
配置资源限制
vim /etc/security/limits.conf
soft nofile 65536* hard nofile 65536
soft nproc 131072
hard nproc 131072
vim /etc/security/limits.d/90-nproc.conf # 「将1024 修改为131072」
soft nofile 65536
hard nofile 65536
soft nproc 131072
hard nproc 131072
XFS 分区
yum install xfsprogs
mkfs.xfs -f /dev/[device]
vim /etc/fstab # 后2位是 1 1 吗?
/dev/[device] /[partition] xfs rw,noatime,inode64,allocsize=16m 0 0
设置Linux调度器规则,默认为 CFQ ,更改为 deadline
cat /sys/block/{devname}/queue/scheduler
noop anticipatory [deadline] cfq
- echo deadline > /sys/block/{devname}/queue/scheduler
固化配置
cat /etc/rc.d/rc.local
echo deadline > /sys/block/**{devname**/queue/scheduler
or
vim /boot/grub/menu.lst # 配置错误会导致系统启动失败
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup00-LogVol00
# initrd /initrd-[generic-]version.img
#boot=/dev/vda
default=0
timeout=5
title CentOS (2.6.32-573.7.1.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-573.7.1.el6.x86_64 ro root=/dev/mapper/VolGroup00-LogVol00 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=uk LANG=en_US.UTF-8 rd_NO_MD crashkernel=auto rd_LVM_LV=VolGroup00/LogVol01 rd_LVM_LV=VolGroup00/LogVol00 SYSFONT=latarcyrheb-sun16 rd_NO_DM ** elevator=deadline**
initrd /initramfs-2.6.32-573.7.1.el6.x86_64.img
禁用 Transparent Huge Pages (THP)
cat /sys/kernel/mm/redhat_transparent_hugepage/defrag
[always] madvise never
echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag
# 固化配置
vim /etc/rc.d/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
or
vim /boot/grub/menu.lst # 配置错误会导致系统启动失败
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/mapper/VolGroup00-LogVol00
# initrd /initrd-[generic-]version.img
#boot=/dev/vda
default=0
timeout=5
title CentOS (2.6.32-573.7.1.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-573.7.1.el6.x86_64 ro root=/dev/mapper/VolGroup00-LogVol00 rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=uk LANG=en_US.UTF-8 rd_NO_MD crashkernel=auto rd_LVM_LV=VolGroup00/LogVol01 rd_LVM_LV=VolGroup00/LogVol00 SYSFONT=latarcyrheb-sun16 rd_NO_DM ** elevator=deadline transparent_hugepage=never**
initrd /initramfs-2.6.32-573.7.1.el6.x86_64.img
修改磁盘预计参数 「预读扇区数」
/sbin/blockdev --getra /dev/[device]
256
/sbin/blockdev --setra 16384 /dev/[device]
NTP 配置
$ date
Mon Apr 11 15:28:05 CST 2016
若显示不是CST,copy覆盖
cp /usr/share/zoneinfo/Asia/Chongqing /etc/local
vim /etc/ntp.conf
server 172.24.2.10 prefer
server 172.24.2.11
/etc/init.d/ntpd status
ntpd (pid 1666) is running...
第二部分 - 安装 Greenplum
./greenplum-db-4.3.8.0-build-1-RHEL5-x86_64.bin
********************************************************************************
Do you accept the Pivotal Database license agreement? [yes|no]
********************************************************************************
yes
********************************************************************************
Provide the installation path for Greenplum Database or press ENTER to
accept the default installation path: /usr/local/greenplum-db-4.3.8.0
********************************************************************************
/opt/greenplum/greenplum-db-4.3.8.0
********************************************************************************
Install Greenplum Database into </opt/greenplum/greenplum-db-4.3.8.0>? [yes|no]
********************************************************************************
yes
********************************************************************************
/opt/greenplum/greenplum-db-4.3.8.0 does not exist.
Create /opt/greenplum/greenplum-db-4.3.8.0 ? [yes|no]
(Selecting no will exit the installer)
********************************************************************************
yes
Extracting product to /opt/greenplum/greenplum-db-4.3.8.0
********************************************************************************
Installation complete.
Greenplum Database is installed in /opt/greenplum/greenplum-db-4.3.8.0
Pivotal Greenplum documentation is available
for download at http://docs.gopivotal.com/gpdb
********************************************************************************
更改权限
chown -R gpadmin.gpadmin /opt/greenplum/
chown -R gpadmin.gpadmin /opt/greenplum/greenplum-db
配置 gp 机器host
su - gpadmin
mkdir -p /opt/greenplum/greenplum-db/conf
$ cat /opt/greenplum/greenplum-db/conf/hostlist
dbaone
dbatwo
dbathree
dbafour
$ cat /opt/greenplum/greenplum-db/conf/seg_hosts
dbatwo
dbathree
dbafour
配置免密钥
若ssh端口是22,使用此方法,否则手工配置免密钥
$ gpssh-exkeys -f /opt/greenplum/greenplum-db/conf/hostlist
安装免密
[gpadmin@dbaone .ssh]$ gpssh-exkeys -f /opt/greenplum/greenplum-db/conf/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] authorize current user on remote hosts
... send to sdw1
[ERROR sdw1] [Errno 111] Connection refused
[ERROR sdw1] skipping key exchange for sdw1
[ERROR sdw1] unable to authorize current user
[gpadmin@dbaone ~]$ gpssh -f /opt/greenplum/greenplum-db/conf/hostlist
Note: command history unsupported on this machine ...
=>
=> pwd
[ mdw] /home/gpadmin
[sdw1] /home/gpadmin
[sdw3] /home/gpadmin
[sdw2] /home/gpadmin
cd /opt/greenplum/
tar -czf gp.4.3.6.1.tar.gz greenplum-db-4.3.6.1/
chown gpadmin.gpadmin gp.4.3.6.1.tar.gz
source /opt/greenplum/greenplum-db/greenplum_path.sh
gpssh -f /opt/greenplum/greenplum-db/conf/seg_hosts -e -v "mkdir -p /opt/greenplum && chown gpadmin.gpadmin -R /opt/greenplum"
$ gpscp -f /opt/greenplum/greenplum-db/conf/seg_hosts /opt/greenplum/gp.4.3.6.1.tar.gz =:/opt/greenplum/
$ gpssh -f /opt/greenplum/greenplum-db/conf/seg_hosts -e -v "cd /opt/greenplum && tar -zxf gp.4.3.6.1.tar.gz"
建立软链接「Master直接安装,自动创建链链接的,其他节点需要手工创建软链接,原Master节点软链接要删除下」
$ gpssh -f /opt/greenplum/greenplum-db/conf/seg_hosts -e -v "cd /opt/greenplum && ln -s greenplum-db-4.3.8.0 greenplum-db"
$ gpssh -f /opt/greenplum/greenplum-db/conf/hostlist -e "cd /opt/greenplum && ll"
[gpadmin@dbaone ~]$ gpssh -f /opt/greenplum/greenplum-db/conf/hostlist -e "cd /opt/greenplum && ll"
[ dbatwo] cd /opt/greenplum && ll
[ dbatwo] total 140364
[ dbatwo] -rw-r--r-- 1 gpadmin gpadmin 143726939 Apr 11 16:25 gp.4.3.8.0.tar.gz
[ dbatwo] lrwxrwxrwx 1 gpadmin gpadmin 20 Apr 11 16:30 greenplum-db -> greenplum-db-4.3.8.0
[ dbatwo] drwxr-xr-x 12 gpadmin gpadmin 4096 Apr 11 15:55 greenplum-db-4.3.8.0
[ dbafour] cd /opt/greenplum && ll
[ dbafour] total 140364
[ dbafour] -rw-r--r-- 1 gpadmin gpadmin 143726939 Apr 11 16:25 gp.4.3.8.0.tar.gz
[ dbafour] lrwxrwxrwx 1 gpadmin gpadmin 20 Apr 11 16:30 greenplum-db -> greenplum-db-4.3.8.0
[ dbafour] drwxr-xr-x 12 gpadmin gpadmin 4096 Apr 11 15:55 greenplum-db-4.3.8.0
[dbathree] cd /opt/greenplum && ll
[dbathree] total 140364
[dbathree] -rw-r--r-- 1 gpadmin gpadmin 143726939 Apr 11 16:25 gp.4.3.8.0.tar.gz
[dbathree] lrwxrwxrwx 1 gpadmin gpadmin 20 Apr 11 16:30 greenplum-db -> greenplum-db-4.3.8.0
[dbathree] drwxr-xr-x 12 gpadmin gpadmin 4096 Apr 11 15:55 greenplum-db-4.3.8.0
[ dbaone] cd /opt/greenplum && ll
[ dbaone] total 140364
[ dbaone] -rw-r--r-- 1 gpadmin gpadmin 143726939 Apr 11 16:25 gp.4.3.8.0.tar.gz
[ dbaone] lrwxrwxrwx 1 gpadmin gpadmin 22 Apr 11 15:49 greenplum-db -> ./greenplum-db-4.3.8.0
[ dbaone] drwxr-xr-x 12 gpadmin gpadmin 4096 Apr 11 15:55 greenplum-db-4.3.8.0
创建数据目录「gpmaster保存Master数据,每个机器gpdata1、gpdata2分别对应这个机器的两个主数据节点(Primary),gpdatam1、gpdatam2对应备数据节点(Mirror)」
gpssh -f /opt/greenplum/greenplum-db/conf/hostlist -e -v "mkdir -p /opt/greenplum/greenplum-db/gpdata/{gpmaster,gpdatap1,gpdatap2,gpdatam1,gpdatam2}"
配置环境变量
$ gpssh -f /opt/greenplum/greenplum-db/conf/hostlist -e -v "cat >> /home/gpadmin/.bash_profile <<EOF
source /opt/greenplum/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
export GPPORT=5432
export PGDATABASE=testDB
EOF"
. .bash_profile
系统参数校验:"$PGHOME/etc/gpcheck.cnf"
gpcheck -f /opt/greenplum/greenplum-db/conf/hostlist
网络测试
gpcheckperf -d /tmp/ upload -r N -f /opt/greenplum/greenplum-db/conf/seg_hosts
or
gpcheckperf -d /tmp/ upload -r N -h dbathree -h dbafour # "单独测试2台机器网络"
文件系统测试
gpcheckperf -f seg_hosts -d /opt/greenplum/greenplum-db/gpdata/gpdatap1 -d /opt/greenplum/greenplum-db/gpdata/gpdatap2 -d /opt/greenplum/greenplum-db/gpdata/gpdatam1 -d /opt/greenplum/greenplum-db/gpdata/gpdatam2 -r ds
初始化 Greenplum 配置文件
配置文件模板都在 /opt/greenplum/greenplum-db/docs/cli_help/gpconfigs
gpinitsystem_config 是初始化 Greenplum 的模板,此模板中 Mirror Segment的配置都被注释
[gpadmin@dbaone ~]$ cd /opt/greenplum/greenplum-db/docs/cli_help/gpconfigs
$ cp gpinitsystem_config initgp_config
$ vim initgp_config
ARRAY_NAME="EMC Greenplum DW"
MACHINE_LIST_FILE=/opt/greenplum/greenplum-db/conf/seg_hosts
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/opt/greenplum/greenplum-db/gpdata/gpdatap1 /opt/greenplum/greenplum-db/gpdata/gpdatap2)
MASTER_HOSTNAME=dbaone
MASTER_DIRECTORY=/opt/greenplum/greenplum-db/gpdata/gpmaster
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
MIRROR_PORT_BASE=50000
REPLICATION_PORT_BASE=41000
MIRROR_REPLICATION_PORT_BASE=51000
declare -a MIRROR_DATA_DIRECTORY=(/opt/greenplum/greenplum-db/gpdata/gpdatam1 /opt/greenplum/greenplum-db/gpdata/gpdatam2)
初始化pg,-s 表示 standby master,若gp版本为3.8.0 不要在初始化加 standby master。
备份方案有2种(Grouped Miior、Spread Mirror),-S 表示使用Spread Mirror 分配 mirror节点,防止一个节点挂掉,另外一个节点集中成为瓶颈! P301
[gpadmin@dbaone gpconfigs]$ gpinitsystem -c initgp_config -s dbafour -S
$ gpinitsystem -c initgp_config -S
若初始化失败,需要删除数据目录重新来
gpssh -f /opt/greenplum/greenplum-db/conf/hostlist -e -v "cd /opt/greenplum/greenplum-db/gpdata/ && rm -rf gpmaster/* && rm -rf gpdatap1/* && rm -rf gpdatap2/* && rm -rf gpdatam1/* && rm -rf gpdatam2/* "
Greenplum 配置
1>、配置远程可登陆
[gpadmin@dbaone ~]$ psql postgres
psql (8.2.15)
Type "help" for help.
testdb=# alter role gpadmin with password 'gpadmin';
ALTER ROLE
为了保证与standby master 配置文件一致,standby master的配置文件也要修改!
[gpadmin@dbaone ~]$ vim $MASTER_DATA_DIRECTORY/pg_hba.conf
host all gpadmin 0.0.0.0/0 md5
[gpadmin@four ~]$ vim $MASTER_DATA_DIRECTORY/pg_hba.conf
host all gpadmin 0.0.0.0/0 md5
使配置生效!
[gpadmin@dbaone ~]$ gpstop -u
20160405:10:59:06:023782 gpstop:dbaone:gpadmin-[INFO]:-Starting gpstop with args: -u
20160405:10:59:06:023782 gpstop:dbaone:gpadmin-[INFO]:-Gathering information and validating the environment...
20160405:10:59:06:023782 gpstop:dbaone:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20160405:10:59:06:023782 gpstop:dbaone:gpadmin-[INFO]:-Obtaining Segment details from master...
20160405:10:59:07:023782 gpstop:dbaone:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.3.6.1 build 2'
20160405:10:59:07:023782 gpstop:dbaone:gpadmin-[INFO]:-Signalling all postmaster processes to reload
.
C:\Users\Star>psql -h 172.24.3.76 -p5432 -d postgres -U gpadmin
Password for user gpadmin:
psql (8.2.15)
Type "help" for help.
初始化后:登陆「」
[gpadmin@dbaone ~]$ psql -d postgres
查看当前所有db
postgres=# \l
List of databases
Name | Owner | Encoding | Access privileges
-----------+---------+----------+---------------------
postgres | gpadmin | UTF8 |
template0 | gpadmin | UTF8 | =c/gpadmin
: gpadmin=CTc/gpadmin
template1 | gpadmin | UTF8 | =c/gpadmin
: gpadmin=CTc/gpadmin
(3 rows)
创建表,并查看当前db下所有table
testdb=# create table t1(id int primary key ,name varchar(128));
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
CREATE TABLE
testdb=#
testdb=# \d
List of relations
Schema | Name | Type | Owner | Storage
--------+------+-------+---------+---------
public | t1 | table | gpadmin | heap
(1 row)
启动与关闭数据库「-a 不会手动输入yes了」
$ gpstart -a
$ gpstop -a
reload 配置文件
$ gpstop -u
查看状态
gpstat -e #查看mirror的状态
gpstat -f #查看standby master的状态
gpstat -s #查看整个GP群集的状态
gpstat -i #查看GP的版本
gpstat --help #帮助文档,可以查看gpstat更多用法
第三部分 - 图形工具 GUI
Navicat Premium
pgAdmin
http://www.pgadmin.org/download/?lang=zh_CN
http://www.postgresql.org/ftp/pgadmin3/release/
保存密码
警 告: 你 已 经 选 择 了 保 存 密 码, 在 *nix 下 它 将 被 保 存 在 home 目 录 的 纯 文 本 文 件 中, 而 在 Windows 系 统 下 它 将 被 保 存 在 用 户 的 配 置 文 件 中。 如 果 你 不 想 这 么 做, 请 点 击 Cancel 按 钮。
pgAdmin 使 用 PostgreSQL 的 'pgpass' 机 制 保 存 密 码。 在 *nix 系 统 下, 密 码 将 被 保 存 在 ~/.pgpass 文 件 中; 而 在 Windows 系 统 下, 它 将 被 保 存 在 %APPDATA%\PostgreSQL\pgpass.conf 文 件 中 (%APPDATA% 是 位 于 用 户 配 置 文 件 之 内 的 'Application Data' 文 件 夹)。 这 个 机 制 被 用 来 作 为 使 用 libpg 库 连 接 数 据 库 服 务 器 的 所 有 程 序 的 缺 省 机 制, 包 括 命 令 行 程 序(例 如 pg_dump 和 pg_restore)、 其 他 GUI 程 序、 驱 动 程 序 (例 如 : psqlODBC)。 这 意 味 着 这 些 程 序 都 可 以 使 用 这 个 保 存 的 密 码 自 动 连 接 到 数 据 库, 如 果 你 不 想 这 样 做, 不 要 使 用 pgAdmin 的 Store Password 的 选 项。
第四部分 -- Standby Master
添加 Standby Master
参考:greenplum数据库master节点搭建standby
删除 standby master
gpinitstandby -r
重新同步 Standby Master「若已有 Standby Master,但这个节点已经不同步了,需要重启同步」
gpinitstandby -n
查看 Standby Master 是否同步
GP 4.1
testdb=# select * from gp_master_mirroring;
GP 4.3
testdb=# select procpid,state from pg_stat_replication;
procpid | state
---------+-----------
1806 | streaming
(1 row)
添加 Standby Master
[gpadmin@dbaone ~]$ gpinitstandby -s dbafour
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Validating environment and parameters for standby initialization...
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Checking for filespace directory /opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1 on dbafour
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:------------------------------------------------------
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Greenplum standby master initialization parameters
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:------------------------------------------------------
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Greenplum master hostname = dbaone
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Greenplum master data directory = /opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Greenplum master port = 5432
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Greenplum standby master hostname = dbafour
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Greenplum standby master port = 5432
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Greenplum standby master data directory = /opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Greenplum update system catalog = On
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:------------------------------------------------------
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:- Filespace locations
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:------------------------------------------------------
20160408:10:47:23:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-pg_system -> /opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
Do you want to continue with standby master initialization? Yy|Nn (default=N):
y
20160408:10:47:59:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Syncing Greenplum Database extensions to standby
20160408:10:47:59:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-The packages on dbafour are consistent.
20160408:10:47:59:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Adding standby master to catalog...
20160408:10:47:59:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Database catalog updated successfully.
20160408:10:47:59:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Updating pg_hba.conf file...
20160408:10:48:05:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-pg_hba.conf files updated successfully.
20160408:10:48:07:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Updating filespace flat files...
20160408:10:48:07:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Filespace flat file updated successfully.
20160408:10:48:08:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Starting standby master
20160408:10:48:08:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Checking if standby master is running on host: dbafour in directory: /opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
20160408:10:48:10:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Cleaning up pg_hba.conf backup files...
20160408:10:48:15:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Backup files of pg_hba.conf cleaned up successfully.
20160408:10:48:15:001705 gpinitstandby:dbaone:gpadmin-[INFO]:-Successfully created standby master on dbafour
testdb=# select * from gp_segment_configuration order by 1;
dbid | content | role | preferred_role | mode | status | port | hostname | address | replication_port | san_mounts
------+---------+------+----------------+------+--------+-------+----------+----------+------------------+------------
1 | -1 | p | p | s | u | 5432 | dbaone | dbaone | |
2 | 0 | p | p | s | u | 40000 | dbafour | dbafour | 41000 |
3 | 1 | p | p | s | u | 40001 | dbafour | dbafour | 41001 |
4 | 2 | p | p | s | u | 40000 | dbathree | dbathree | 41000 |
5 | 3 | p | p | s | u | 40001 | dbathree | dbathree | 41001 |
6 | 4 | p | p | s | u | 40000 | dbatwo | dbatwo | 41000 |
7 | 5 | p | p | s | u | 40001 | dbatwo | dbatwo | 41001 |
8 | 0 | m | m | s | u | 50000 | dbathree | dbathree | 51000 |
9 | 1 | m | m | s | u | 50001 | dbathree | dbathree | 51001 |
10 | 2 | m | m | s | u | 50000 | dbatwo | dbatwo | 51000 |
11 | 3 | m | m | s | u | 50001 | dbatwo | dbatwo | 51001 |
12 | 4 | m | m | s | u | 50000 | dbafour | dbafour | 51000 |
13 | 5 | m | m | s | u | 50001 | dbafour | dbafour | 51001 |
14 | -1 | m | m | s | u | 5432 | dbafour | dbafour | |
(14 rows)
[root@dbafour ~]# ps aux | grep green | grep -v grep
gpadmin 7423 3.0 2.5 428824 204492 ? Ss 10:48 0:00 /opt/greenplum/greenplum-db-4.3.6.1/bin/postgres -D /opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1 -p 5432 -b 14 -z 6 --silent-mode=true -i -M master -C -1 -x 0 -y -E
gpadmin 8283 0.0 2.8 469228 227376 ? Ss Apr01 0:01 /opt/greenplum/greenplum-db-4.3.6.1/bin/postgres -D /opt/greenplum/greenplum-db/gpdata/gpdatam2/gpseg5 -p 50001 -b 13 -z 6 --silent-mode=true -i -M quiescent -C 5
gpadmin 8284 0.0 2.8 471332 229840 ? Ss Apr01 0:09 /opt/greenplum/greenplum-db-4.3.6.1/bin/postgres -D /opt/greenplum/greenplum-db/gpdata/gpdatap2/gpseg1 -p 40001 -b 3 -z 6 --silent-mode=true -i -M quiescent -C 1
gpadmin 8285 0.0 2.8 471336 227812 ? Ss Apr01 0:09 /opt/greenplum/greenplum-db-4.3.6.1/bin/postgres -D /opt/greenplum/greenplum-db/gpdata/gpdatap1/gpseg0 -p 40000 -b 2 -z 6 --silent-mode=true -i -M quiescent -C 0
gpadmin 8286 0.0 2.8 469232 229420 ? Ss Apr01 0:01 /opt/greenplum/greenplum-db-4.3.6.1/bin/postgres -D /opt/greenplum/greenplum-db/gpdata/gpdatam1/gpseg4 -p 50000 -b 12 -z 6 --silent-mode=true -i -M quiescent -C 4
[gpadmin@dbaone ~]$ gpstate -f
20160408:11:36:43:002727 gpstate:dbaone:gpadmin-[INFO]:-Starting gpstate with args: -f
20160408:11:36:43:002727 gpstate:dbaone:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.6.1 build 2'
20160408:11:36:43:002727 gpstate:dbaone:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.6.1 build 2) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Oct 1 2015 15:14:22'
20160408:11:36:43:002727 gpstate:dbaone:gpadmin-[INFO]:-Obtaining Segment details from master...
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:-Standby master details
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:-----------------------
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:- Standby address = dbafour
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:- Standby data directory = /opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:- Standby port = 5432
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:- Standby PID = 7423
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:- Standby status = Standby host passive
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--------------------------------------------------------------
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--pg_stat_replication
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--------------------------------------------------------------
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--WAL Sender State: streaming
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--Sync state: sync
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--Sent Location: 0/C0000C0
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--Flush Location: 0/C0000C0
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--Replay Location: 0/C0000C0
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--------------------------------------------------------------
[gpadmin@dbaone ~]$ gpstate -s
20160408:10:48:52:001833 gpstate:dbaone:gpadmin-[INFO]:-Starting gpstate with args: -s
20160408:10:48:52:001833 gpstate:dbaone:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.6.1 build 2'
20160408:10:48:52:001833 gpstate:dbaone:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.6.1 build 2) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Oct 1 2015 15:14:22'
20160408:10:48:52:001833 gpstate:dbaone:gpadmin-[INFO]:-Obtaining Segment details from master...
20160408:10:48:52:001833 gpstate:dbaone:gpadmin-[INFO]:-Gathering data from segments...
.
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:--Master Configuration & Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Master host = dbaone
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Master postgres process ID = 26859
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Master data directory = /opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Master port = 5432
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Master current role = dispatch
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Greenplum initsystem version = 4.3.6.1 build 2
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Greenplum current version = PostgreSQL 8.2.15 (Greenplum Database 4.3.6.1 build 2) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Oct 1 2015 15:14:22
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Postgres version = 8.2.15
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Master standby = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Standby master state = Standby host passive
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-Segment Instance Status Report
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatap1/gpseg0
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 40000
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 8285
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Database status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbathree
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbathree
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatam1/gpseg0
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 50000
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 17476
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatap2/gpseg1
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 40001
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 8284
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Database status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbathree
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbathree
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatam2/gpseg1
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 50001
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 17475
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbathree
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbathree
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatap1/gpseg2
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 40000
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 17474
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Database status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbatwo
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbatwo
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatam1/gpseg2
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 50000
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 19407
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbathree
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbathree
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatap2/gpseg3
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 40001
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 17473
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Database status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbatwo
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbatwo
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatam2/gpseg3
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 50001
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 19406
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbatwo
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbatwo
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatap1/gpseg4
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 40000
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 19408
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Database status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatam1/gpseg4
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 50000
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 8286
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbatwo
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbatwo
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatap2/gpseg5
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 40001
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Primary
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 19405
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Database status = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:-----------------------------------------------------
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Hostname = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Address = dbafour
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Datadir = /opt/greenplum/greenplum-db/gpdata/gpdatam2/gpseg5
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Port = 50001
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirroring Info
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Current role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Preferred role = Mirror
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Mirror status = Synchronized
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Status
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- PID = 8283
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Configuration reports status as = Up
20160408:10:48:53:001833 gpstate:dbaone:gpadmin-[INFO]:- Segment status = Up
启用 Standby Master
确认 Standby Master 是同步的
gpstate -f
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--WAL Sender State: streaming
20160408:11:36:44:002727 gpstate:dbaone:gpadmin-[INFO]:--Sync state: sync
关闭原 Master
gpstop -m
在 Standby Master 上激活
vim .bash_profile
source /opt/greenplum/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/opt/greenplum/greenplum-db/gpdata/gpmaster/gpseg-1
export GPPORT=5432
export PGDATABASE=testdb
. .bash_profile
gpactivatestandby -d $MASTER_DATA_DIRECTORY
对整个数据库进行 ANALYZE ,收集统计信息
psql -d testdb -c "ANALYZE"
所有客户端的IP,连接到 Standby Master
切换原有的 Master,使用gpinitstandby