当前位置:网站首页>Greenplum6.x重新初始化

Greenplum6.x重新初始化

2022-07-07 06:01:00 xcSpark

换一种初始化方式

一. 规划目录

root用户登录操作

#master机器
mkdir -p /datax/master
chown gpadmin:gpadmin -R /datax/master
#standby 机器
mkdir -p /datax/master
chown gpadmin:gpadmin -R /datax/master
#两台segment机器
mkdir -p /datax/primary
mkdir -p /datax/mirror

chown gpadmin:gpadmin -R /datax

若之前目录下存在文件,清理

root登录master机器


# master
[[email protected] ~]$ su - gpadmin
#删除master的目录
[[email protected] ~]$ rm -rf /datax/master/*
#删除standby目录
[[email protected] ~]$ gpssh -h smdw -e 'rm -rf /datax/master/*'
[smdw] rm -rf /datax/master/*
[[email protected] ~]$

# 清理segment上的内容
[[email protected] ~]$ gpssh -f /tmp/seg_hosts
=> rm -rf /datax/primary/*
[sdw1]
[sdw2]
=> rm -rf /datax/mirror/*
[sdw1]
[sdw2]
=> rm -rf /datax/tbs_tmp/*
[sdw1]
[sdw2]
=> rm -rf /datax/tbs_tmp2/*
[sdw1]
[sdw2]
=> rm -f /tmp/.s.PGSQL.*.lock
[sdw1]
[sdw2]
=>

=> exit


二. 编辑初始化文件

root用户登录master机器操作

编辑配置文件,无mirror镜像

vi /tmp/gpinitsystem_config_no_mirror
#添加如下内容
ARRAY_NAME="gpdb"
SEG_PREFIX=gpseg
PORT_BASE=36000
declare -a DATA_DIRECTORY=(/datax/primary /datax/primary /datax/primary /datax/primary)

MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/datax/master
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE

在这里插入图片描述

修改配置文件

root用户登录master机器操作
注意这里的路径是/datax

su - gpadmin
# 检查 MASTER_DATA_DIRECTORY
[[email protected] ~]$ cat ~/.bash_profile | grep MASTER_DATA_DIRECTORY
[[email protected] ~]$ cat ~/.bashrc  | grep MASTER_DATA_DIRECTORY

# 修改.bashrc
[[email protected] ~]$ vi ~/.bashrc

#将MASTER_DATA_DIRECTORY换成最新的路径
export MASTER_DATA_DIRECTORY=/datax/master/gpseg-1
export PGPORT=5432
export PGDATABASE=gpdb
export LD_PRELOAD=/lib64/libz.so.1 ps

# 修改.bash_profile
[[email protected] ~]$ vi ~/.bash_profile
# 修改内容如下datax
export MASTER_DATA_DIRECTORY=/datax/master/gpseg-1

#分发

gpscp -f /tmp/hostlist ~/.bashrc  =:~
gpscp -f /tmp/hostlist ~/.bash_profile =:~

三. 执行初始化

gpadmin登录master机器

1. 执行安装master和standby

# 这里使用-h 参数
[[email protected] ~]$ gpinitsystem -c /tmp/gpinitsystem_config_no_mirror -h /tmp/seg_hosts -s smdw --mirror-mode=spread

初始化日志

[[email protected] tmp]$ gpinitsystem -c /tmp/gpinitsystem_config_no_mirror -h /tmp/seg_hosts -s smdw --mirror-mode=spread
find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
20220704:23:49:43:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, please wait...
20220704:23:49:43:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Reading Greenplum configuration file /tmp/gpinitsystem_config_no_mirror
20220704:23:49:43:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Locale has not been set in /tmp/gpinitsystem_config_no_mirror, will set to default value
20220704:23:49:43:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Locale set to en_US.utf8
20220704:23:49:43:060317 gpinitsystem:mdw:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20220704:23:49:43:060317 gpinitsystem:mdw:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20220704:23:49:44:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, Completed
20220704:23:49:44:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, please wait...
..
20220704:23:49:44:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Configuring build for standard array
20220704:23:49:44:060317 gpinitsystem:mdw:gpadmin-[WARN]:-Option --mirror-mode supplied, but no mirrors have been defined, ignoring --mirror-mode option
20220704:23:49:44:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, Completed
20220704:23:49:44:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Building primary segment instance array, please wait...
........
20220704:23:49:47:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Checking Master host
20220704:23:49:48:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, please wait...
........
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, Completed
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database Creation Parameters
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master Configuration
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master instance name       = gpdb
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master hostname            = mdw
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master port                = 5432
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master instance dir        = /datax/master/gpseg-1
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master LOCALE              = en_US.utf8
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum segment prefix   = gpseg
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master Database            =
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master connections         = 250
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master buffers             = 128000kB
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Segment connections        = 750
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Segment buffers            = 128000kB
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Checkpoint segments        = 8
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Encoding                   = UNICODE
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Postgres param file        = Off
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Initdb to be used          = /greenplum/greenplum-db-6.18.2/bin/initdb
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-GP_LIBRARY_PATH is         = /greenplum/greenplum-db-6.18.2/lib
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-HEAP_CHECKSUM is           = on
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-HBA_HOSTNAMES is           = 0
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Ulimit check               = Passed
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Array host connect type    = Single hostname per node
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [1]      = ::1
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [2]      = 192.168.0.110
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [3]      = fe80::20c:29ff:fe90:bf83
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Standby Master             = smdw
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Number of primary segments = 4
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Standby IP address         = ::1
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Standby IP address         = 192.168.0.113
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Standby IP address         = fe80::20c:29ff:feab:1f84
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Total Database segments    = 8
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Trusted shell              = ssh
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Number segment hosts       = 2
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Mirroring config           = OFF
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:----------------------------------------
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Primary Segment Configuration
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:----------------------------------------
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1  36000   sdw1    /datax/primary/gpseg0   2
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1  36001   sdw1    /datax/primary/gpseg1   3
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1  36002   sdw1    /datax/primary/gpseg2   4
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1  36003   sdw1    /datax/primary/gpseg3   5
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2  36000   sdw2    /datax/primary/gpseg4   6
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2  36001   sdw2    /datax/primary/gpseg5   7
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2  36002   sdw2    /datax/primary/gpseg6   8
20220704:23:49:56:060317 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2  36003   sdw2    /datax/primary/gpseg7   9

Continue with Greenplum creation Yy|Nn (default=N):
> y
20220704:23:50:04:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Building the Master instance database, please wait...
20220704:23:50:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Starting the Master in admin mode
20220704:23:50:11:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing parallel build of primary segment instances
20220704:23:50:11:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
........
20220704:23:50:11:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
.find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
find: ‘/greenplum/greenplum-db-6.18.2/greenplum-db-6.18.2’: Too many levels of symbolic links
..............................................
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Parallel process exit status
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as completed           = 8
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as killed              = 0
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as failed              = 0
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Removing back out file
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:-No errors generated from parallel processes
20220704:23:50:59:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode
20220704:23:50:59:064925 gpstop:mdw:gpadmin-[INFO]:-Starting gpstop with args: -a -l /home/gpadmin/gpAdminLogs -m -d /datax/master/gpseg-1
20220704:23:50:59:064925 gpstop:mdw:gpadmin-[INFO]:-Gathering information and validating the environment...
20220704:23:50:59:064925 gpstop:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20220704:23:50:59:064925 gpstop:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20220704:23:50:59:064925 gpstop:mdw:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 6.18.2 build commit:1242aadf0137d3b26ee42c80e579e78bd7a805c7'
20220704:23:50:59:064925 gpstop:mdw:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='smart'
20220704:23:50:59:064925 gpstop:mdw:gpadmin-[INFO]:-Master segment instance directory=/datax/master/gpseg-1
20220704:23:50:59:064925 gpstop:mdw:gpadmin-[INFO]:-Stopping master segment and waiting for user connections to finish ...
server shutting down
20220704:23:51:00:064925 gpstop:mdw:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process
20220704:23:51:00:064925 gpstop:mdw:gpadmin-[INFO]:-Terminating processes for segment /datax/master/gpseg-1
20220704:23:51:00:064954 gpstart:mdw:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /datax/master/gpseg-1
20220704:23:51:00:064954 gpstart:mdw:gpadmin-[INFO]:-Gathering information and validating the environment...
20220704:23:51:00:064954 gpstart:mdw:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 6.18.2 build commit:1242aadf0137d3b26ee42c80e579e78bd7a805c7'
20220704:23:51:00:064954 gpstart:mdw:gpadmin-[INFO]:-Greenplum Catalog Version: '301908232'
20220704:23:51:00:064954 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance in admin mode
20220704:23:51:01:064954 gpstart:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20220704:23:51:01:064954 gpstart:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20220704:23:51:01:064954 gpstart:mdw:gpadmin-[INFO]:-Setting new master era
20220704:23:51:01:064954 gpstart:mdw:gpadmin-[INFO]:-Master Started...
20220704:23:51:01:064954 gpstart:mdw:gpadmin-[INFO]:-Shutting down master
20220704:23:51:01:064954 gpstart:mdw:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait...
.
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-Process results...
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-   Successful segment starts                                            = 8
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-   Failed segment starts                                                = 0
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 0
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-Successfully started 8 of 8 segment instances
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance mdw directory /datax/master/gpseg-1
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-Command pg_ctl reports Master mdw instance active
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-Connecting to dbname='template1' connect_timeout=15
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-No standby master configured.  skipping...
20220704:23:51:03:064954 gpstart:mdw:gpadmin-[INFO]:-Database successfully started
20220704:23:51:04:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode
20220704:23:51:04:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Starting initialization of standby master smdw
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Validating environment and parameters for standby initialization...
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Checking for data directory /datax/master/gpseg-1 on smdw
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master initialization parameters
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:------------------------------------------------------
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master hostname               = mdw
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master data directory         = /datax/master/gpseg-1
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum master port                   = 5432
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master hostname       = smdw
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master port           = 5432
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum standby master data directory = /datax/master/gpseg-1
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Greenplum update system catalog         = On
20220704:23:51:04:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Syncing Greenplum Database extensions to standby
20220704:23:51:05:065070 gpinitstandby:mdw:gpadmin-[INFO]:-The packages on smdw are consistent.
20220704:23:51:05:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Adding standby master to catalog...
20220704:23:51:05:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Database catalog updated successfully.
20220704:23:51:05:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Updating pg_hba.conf file...
20220704:23:51:06:065070 gpinitstandby:mdw:gpadmin-[INFO]:-pg_hba.conf files updated successfully.
20220704:23:51:08:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Starting standby master
20220704:23:51:08:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Checking if standby master is running on host: smdw  in directory: /datax/master/gpseg-1
20220704:23:51:09:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Cleaning up pg_hba.conf backup files...
20220704:23:51:09:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Backup files of pg_hba.conf cleaned up successfully.
20220704:23:51:09:065070 gpinitstandby:mdw:gpadmin-[INFO]:-Successfully created standby master on smdw
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Successfully completed standby master initialization
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Scanning utility log file for any warning messages
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[WARN]:-*******************************************************
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[WARN]:-Scan of log file indicates that some warnings or errors
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[WARN]:-were generated during the array creation
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Please review contents of log file
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20220704.log
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-To determine level of criticality
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-These messages could be from a previous run of the utility
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-that was called today!
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[WARN]:-*******************************************************
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database instance successfully created
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-To complete the environment configuration, please
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-update gpadmin .bashrc file with the following
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/datax/master/gpseg-1"
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-   to access the Greenplum scripts for this instance:
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-   or, use -d /datax/master/gpseg-1 option for the Greenplum scripts
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-   Example gpstate -d /datax/master/gpseg-1
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20220704.log
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility
20220704:23:51:09:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Standby Master smdw has been configured
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-To activate the Standby Master Segment in the event of Master
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-failure review options for gpactivatestandby
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-The Master /datax/master/gpseg-1/pg_hba.conf post gpinitsystem
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-has been configured to allow all hosts within this new
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-new array must be explicitly added to this file
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-located in the /greenplum/greenplum-db-6.18.2/docs directory
20220704:23:51:10:060317 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------



[[email protected] ~]$


2. 安装mirror

需要输入4次mirror的存储路径

# -p 设置的是偏移量,和primary的端口相加。primary_port + offset = mirror_database_port
[[email protected] tmp]$ gpaddmirrors  -p 1000

Enter mirror segment data directory location 1 of 4 >
/datax/mirror
Enter mirror segment data directory location 2 of 4 >
/datax/mirror
Enter mirror segment data directory location 3 of 4 >
/datax/mirror
Enter mirror segment data directory location 4 of 4 >
/datax/mirror


在这里插入图片描述

添加mirror安装日志

[[email protected] tmp]$ gpaddmirrors  -p 1000
20220704:23:51:44:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Starting gpaddmirrors with args: -p 1000
20220704:23:51:44:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.18.2 build commit:1242aadf0137d3b26ee42c80e579e78bd7a805c7'
20220704:23:51:44:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.18.2 build commit:1242aadf0137d3b26ee42c80e579e78bd7a805c7) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Nov 10 2021 00:05:30'
20220704:23:51:44:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20220704:23:51:44:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Heap checksum setting consistent across cluster
Enter mirror segment data directory location 1 of 4 >
/datax/mirror
Enter mirror segment data directory location 2 of 4 >
/datax/mirror
Enter mirror segment data directory location 3 of 4 >
/datax/mirror
Enter mirror segment data directory location 4 of 4 >
/datax/mirror
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Greenplum Add Mirrors Parameters
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Greenplum master data directory         = /data/master/gpseg-1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Greenplum master port                   = 5432
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Batch size                              = 16
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Segment batch size                      = 64
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror 1 of 8
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance host        = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance address     = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance directory   = /datax/primary/gpseg0
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance port        = 36000
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance host         = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance address      = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance directory    = /datax/mirror/gpseg0
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance port         = 37000
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror 2 of 8
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance host        = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance address     = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance directory   = /datax/primary/gpseg1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance port        = 36001
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance host         = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance address      = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance directory    = /datax/mirror/gpseg1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance port         = 37001
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror 3 of 8
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance host        = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance address     = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance directory   = /datax/primary/gpseg2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance port        = 36002
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance host         = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance address      = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance directory    = /datax/mirror/gpseg2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance port         = 37002
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror 4 of 8
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance host        = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance address     = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance directory   = /datax/primary/gpseg3
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance port        = 36003
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance host         = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance address      = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance directory    = /datax/mirror/gpseg3
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance port         = 37003
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror 5 of 8
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance host        = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance address     = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance directory   = /datax/primary/gpseg4
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance port        = 36000
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance host         = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance address      = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance directory    = /datax/mirror/gpseg4
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance port         = 37000
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror 6 of 8
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance host        = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance address     = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance directory   = /datax/primary/gpseg5
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance port        = 36001
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance host         = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance address      = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance directory    = /datax/mirror/gpseg5
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance port         = 37001
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror 7 of 8
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance host        = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance address     = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance directory   = /datax/primary/gpseg6
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance port        = 36002
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance host         = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance address      = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance directory    = /datax/mirror/gpseg6
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance port         = 37002
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror 8 of 8
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance host        = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance address     = sdw2
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance directory   = /datax/primary/gpseg7
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Primary instance port        = 36003
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance host         = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance address      = sdw1
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance directory    = /datax/mirror/gpseg7
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-   Mirror instance port         = 37003
20220704:23:52:21:065515 gpaddmirrors:mdw:gpadmin-[INFO]:---------------------------------------------

Continue with add mirrors procedure Yy|Nn (default=N):
> y
20220704:23:52:27:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Starting to create new pg_hba.conf on primary segments
20220704:23:52:31:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Successfully modified pg_hba.conf on primary segments to allow replication connections
20220704:23:52:31:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-8 segment(s) to add
20220704:23:52:31:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Validating remote directories
20220704:23:52:31:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Configuring new segments
sdw1 (dbid 15): pg_basebackup: base backup completed
sdw1 (dbid 16): pg_basebackup: base backup completed
sdw1 (dbid 17): pg_basebackup: base backup completed
sdw1 (dbid 18): pg_basebackup: base backup completed
sdw2 (dbid 11): pg_basebackup: base backup completed
sdw2 (dbid 12): pg_basebackup: base backup completed
sdw2 (dbid 13): pg_basebackup: base backup completed
sdw2 (dbid 14): pg_basebackup: base backup completed
20220704:23:52:46:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Updating configuration with new mirrors
20220704:23:52:47:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Updating mirrors
20220704:23:52:47:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Starting mirrors
20220704:23:52:47:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-era is None
20220704:23:52:47:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait...
...........
20220704:23:52:58:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Process results...
20220704:23:52:58:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-******************************************************************
20220704:23:52:58:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Mirror segments have been added; data synchronization is in progress.
20220704:23:52:58:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Data synchronization will continue in the background.
20220704:23:52:58:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-Use  gpstate -s  to check the resynchronization progress.
20220704:23:52:58:065515 gpaddmirrors:mdw:gpadmin-[INFO]:-******************************************************************
[[email protected] tmp]$

四. 查看状态

[[email protected] tmp]$ gpstate -m

在这里插入图片描述

五. 重新安装监控软件

[[email protected] tmp]$  cd /opt/greenplum-cc-web-6.7.1-gp6-rhel7-x86_64
[[email protected] greenplum-cc-web-6.7.1-gp6-rhel7-x86_64]$ ls
gpccinstall.2022-07-04_215035.log  gpccinstall-6.7.1
[[email protected] greenplum-cc-web-6.7.1-gp6-rhel7-x86_64]$ ./gpccinstall-6.7.1
Where would you like to install Greenplum Command Center? (Default=/usr/local)
/greenplum
Greenplum Command Center will be installed in /greenplum/greenplum-cc-6.7.1

What would you like to name this installation of Greenplum Command Center? (Default=gpcc)


What port would you like the gpcc webserver to use? (Default=28080)


Would you like to enable SSL/TLS? Yy/Nn (Default=Y)
n

********************************************************************************
* WARNING: Your connections to GPCC will be insecure.                          *
********************************************************************************

Please choose a display language (Default=English)
1.  English
2.  Chinese
3.  Korean
4.  Russian
5.  Japanese
2

INSTALLATION IN PROGRESS...
********************************************************************************
* Please check your .pgpass file for the default password.                     *
* We recommend changing the default password for the gpmon user unless you     *
* plan to connect through LDAP or kerberos.                                    *
********************************************************************************
CREATING SUPERUSER 'gpmon'...
CREATING COMMAND CENTER DATABASE 'gpperfmon'...
RELOADING pg_hba.conf. PLEASE WAIT ...

********************************************************************************
*                                                                              *
* INSTALLATION IS ALMOST COMPLETED                                             *
*                                                                              *
* The last step is to update the metrics_collector extension, which needs to   *
* restart the Greenplum Database cluster. Please proceed to $GPCC_HOME and     *
* follow the instructions in this file:                                        *
*                                                                              *
*                            update-extension.txt                              *
*                                                                              *
* Some new features may not be available before the update is done.            *
*                                                                              *
* To use GPCC with the old metrics_collector extension, source gpcc_path.sh    *
* and run 'gpcc start'.                                                        *
*                                                                              *
********************************************************************************
[[email protected] greenplum-cc-web-6.7.1-gp6-rhel7-x86_64]$
[[email protected] greenplum-cc-web-6.7.1-gp6-rhel7-x86_64]$

六. 修改配置,设置访问权限

gpadmin用户在master机器操作

新增配置

[[email protected] ~] vi /tmp/all_gcc_hosts
#添加如下内容,所有机器信息,无多余的空格和换行
sdw
smdw
sdw1
sdw2

# 执行分发
[[email protected] ~] gpssh -f /tmp/all_gcc_hosts
cd ~
echo "source /greenplum/greenplum-cc/gpcc_path.sh" >> .bash_profile

exit
返回到

修改postgres.conf

[[email protected] ~]$ vi /datax/master/gpseg-1/postgresql.conf
#修改下列参数为
# 6版本默认为*
listen_addresses='*'

# Enable the performance monitor
gp_enable_gpperfmon=on
gpperfmon_port=8888
gp_external_enable_exec=on
gpperfmon_log_alert_level=warning


#其他参数设置暂时省略
# 重启,正常
gpstop -ra 

在这里插入图片描述

修改pg_hba.conf

vi /datax/master/gpseg-1/pg_hba.conf 
# 末尾添加如下内容
# add config
host all gpmon 0/0 md5
host all gpmon 0.0.0.0/0 md5

#更新配置,正常
gpstop -u

在这里插入图片描述

修改.gppass

cd ~
vi .gppass
#内容如下
*:5432:gpperfmon:gpmon:gpmon


[[email protected] gpseg-1]$ psql -d postgres
psql (9.4.24)
Type "help" for help.

postgres=# alter role gpmon password 'gpmon';
ALTER ROLE
postgres=#

分发

cd ~
# 复制到standby节点
scp /datax/master/gpseg-1/postgresql.conf  [email protected]:/datax/master/gpseg-1/
scp /datax/master/gpseg-1/pg_hba.conf [email protected]:/datax/master/gpseg-1/  
scp ~/.pgpass [email protected]:/home/gpadmin

七. 启动

gpadmin用户在master机器操作

cd ~
#重启数据库
[[email protected] ~] gpstop -a -M fast
[[email protected] ~] gpstart -a

八. 配置监控用户密码(首次安装gpcc跳过)

[[email protected] tmp]$ psql -d postgres
psql (9.4.24)
Type "help" for help.

postgres=# alter user gpmon with password 'gpmon';
ERROR:  role "gpmon" does not exist

报错

重新创建用户(首次安装gpcc跳过)

postgres=# create user gpmon with password 'gpmon';
NOTICE:  resource queue required -- using default resource queue "pg_default"
CREATE ROLE
postgres=# \q


## 
[[email protected] bin]$ psql -d postgres
psql (9.4.24)
Type "help" for help.
postgres=# CREATE ROLE gpmon superuser PASSWORD 'gpmon' login;
postgres=# create database gpperfmon with owner gpmon;
postgres=# alter user gpmon with password 'gpmon';
postgres=# \q

启动监控

[[email protected] bin]$ gpcc start
2022-07-03 18:17:53 Starting the gpcc agents and webserver...
2022-07-03 18:18:06 Agent successfully started on 4/4 hosts
2022-07-03 18:18:06 View Greenplum Command Center at http://mdw:28080
[[email protected] bin]$

登录监控

用户密码:gpmon/gpmon

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

指标

在这里插入图片描述

磁盘情况

在这里插入图片描述

在这里插入图片描述

问题

问题1:is Greenplum instance already stopped?


[[email protected] tmp]$ gpstop
20220703:17:35:54:004389 gpstop:mdw:gpadmin-[INFO]:-Starting gpstop with args:
20220703:17:35:54:004389 gpstop:mdw:gpadmin-[INFO]:-Gathering information and validating the environment...
20220703:17:35:54:004389 gpstop:mdw:gpadmin-[ERROR]:-gpstop error: postmaster.pid file does not exist.  is Greenplum instance already stopped?

查看环境变量

env

# 由于之前搭建的环境变量是MASTER_DATA_DIRECTORY=/data/master/gpseg-1

#重新执行如下
export MASTER_DATA_DIRECTORY=/datax/master/gpseg-1

# 执行gpstop成功
gpstop

gpstart

问题2:could not start server

[[email protected] pg_log]$ tail -20 /data/master/gpseg-1/pg_log/startup.log
2022-07-04 22:42:14.849116 CST,,,p35902,th-1832212352,,,,0,,,seg-1,,,,,"LOG","XX000","could not bind IPv6 socket: Address already in use",,"Is another postmaster already running on port 5432? If not, wait a few seconds and retry.",,,,,,"StreamServerPort","pqcomm.c",503,
2022-07-04 22:42:14.849366 CST,,,p35902,th-1832212352,,,,0,,,seg-1,,,,,"WARNING","01000","could not create listen socket for ""*""",,,,,,,,"PostmasterMain","postmaster.c",1212,
2022-07-04 22:42:14.849506 CST,,,p35902,th-1832212352,,,,0,,,seg-1,,,,,"FATAL","XX000","could not create any TCP/IP sockets",,,,,,,,"PostmasterMain","postmaster.c",1217,1    0xbeec3c postgres errstart (elog.c:557)
2    0xa0df21 postgres PostmasterMain (postmaster.c:1216)
3    0x6b1df1 postgres main (main.c:205)
4    0x7fdb8f64d555 libc.so.6 __libc_start_main + 0xf5
5    0x6bdadc postgres <symbol not found> + 0x6bdadc

2022-07-04 22:56:56.363108 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"LOG","00000","registering background worker ""stats sender process""",,,,,,,,"RegisterBackgroundWorker","bgworker.c",774,
2022-07-04 22:56:56.363510 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"LOG","00000","registering background worker ""sweeper process""",,,,,,,,"RegisterBackgroundWorker","bgworker.c",774,
2022-07-04 22:56:56.363853 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"LOG","00000","registering background worker ""ic proxy process""",,,,,,,,"RegisterBackgroundWorker","bgworker.c",774,
2022-07-04 22:56:56.371576 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"LOG","XX000","could not bind IPv4 socket: Address already in use",,"Is another postmaster already running on port 5432? If not, wait a few seconds and retry.",,,,,,"StreamServerPort","pqcomm.c",503,
2022-07-04 22:56:56.372136 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"LOG","XX000","could not bind IPv6 socket: Address already in use",,"Is another postmaster already running on port 5432? If not, wait a few seconds and retry.",,,,,,"StreamServerPort","pqcomm.c",503,
2022-07-04 22:56:56.372560 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"WARNING","01000","could not create listen socket for ""*""",,,,,,,,"PostmasterMain","postmaster.c",1212,
2022-07-04 22:56:56.372855 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"FATAL","XX000","could not create any TCP/IP sockets",,,,,,,,"PostmasterMain","postmaster.c",1217,1    0xbeec3c postgres errstart (elog.c:557)
2    0xa0df21 postgres PostmasterMain (postmaster.c:1216)
3    0x6b1df1 postgres main (main.c:205)
4    0x7f38c6c7d555 libc.so.6 __libc_start_main + 0xf5
5    0x6bdadc postgres <symbol not found> + 0x6bdadc

[[email protected] pg_log]$

排查

[[email protected] pg_log]$ cd /data/master/gpseg-1/pg_log
[[email protected] pg_log]$
[[email protected] pg_log]$ tail /data/master/gpseg-1/pg_log/startup.log
2022-07-04 22:56:56.363853 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"LOG","00000","registering background worker ""ic proxy process""",,,,,,,,"RegisterBackgroundWorker","bgworker.c",774,
2022-07-04 22:56:56.371576 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"LOG","XX000","could not bind IPv4 socket: Address already in use",,"Is another postmaster already running on port 5432? If not, wait a few seconds and retry.",,,,,,"StreamServerPort","pqcomm.c",503,
2022-07-04 22:56:56.372136 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"LOG","XX000","could not bind IPv6 socket: Address already in use",,"Is another postmaster already running on port 5432? If not, wait a few seconds and retry.",,,,,,"StreamServerPort","pqcomm.c",503,
2022-07-04 22:56:56.372560 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"WARNING","01000","could not create listen socket for ""*""",,,,,,,,"PostmasterMain","postmaster.c",1212,
2022-07-04 22:56:56.372855 CST,,,p41166,th-902977408,,,,0,,,seg-1,,,,,"FATAL","XX000","could not create any TCP/IP sockets",,,,,,,,"PostmasterMain","postmaster.c",1217,1    0xbeec3c postgres errstart (elog.c:557)
2    0xa0df21 postgres PostmasterMain (postmaster.c:1216)
3    0x6b1df1 postgres main (main.c:205)
4    0x7f38c6c7d555 libc.so.6 __libc_start_main + 0xf5
5    0x6bdadc postgres <symbol not found> + 0x6bdadc

[[email protected] pg_log]$


5432 端口被占用,解决

[[email protected] pg_log]$ netstat -ano|grep "5432*"
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN      off (0.00/0/0)
tcp        0      0 192.168.0.110:5432      192.168.0.113:64808     ESTABLISHED keepalive (2840.20/0/0)
tcp6       0      0 :::5432                 :::*                    LISTEN      off (0.00/0/0)
unix  2      [ ACC ]     STREAM     LISTENING     59100    /tmp/.s.PGSQL.5432
unix  2      [ ACC ]     STREAM     LISTENING     59198    /tmp/.s.PGSQL.ic_proxy.5432.22454
unix  3      [ ]         STREAM     CONNECTED     17543

#观察上述信息/tmp/.s.PGSQL.ic_proxy.5432.22454

# 终止掉
[[email protected] pg_log]$ kill -9 22454
[[email protected] pg_log]$ netstat -ano|grep "5432*"
tcp        0      0 192.168.0.110:5432      192.168.0.113:64808     TIME_WAIT   timewait (55.11/0/0)
unix  3      [ ]         STREAM     CONNECTED     17543
[[email protected] pg_log]$

# 启动
[[email protected] pg_log]$ gpstart

#报错如下问题3
 

问题3 :gpstart:mdw:gpadmin-[ERROR]:-gpstart error: Do not have enough valid segments to start the array.

环境变量错误
.bashrc中的MASTER_DATA_DIRECTORY值指向的有问题

问题4:WARNING",“58P02”,"could not create log file directory ““gpperfmon/logs””

[[email protected] ~]$ cd $MASTER_DATA_DIRECTORY
[[email protected] gpseg-1]$ rm -rf $MASTER_DATA_DIRECTORY/gpperfmon

# master和standby两台机器配置文件都修改
[[email protected] gpseg-1]$ vi pg_hba.conf
注释掉gpmon相关参数
[[email protected] gpseg-1]$ vi postgresql.conf
注释掉添加的监控的四个参数

[[email protected] gpseg-1]$ gpstop -u

[[email protected] gpseg-1]$ gpstart
# 启动成功

# 修改配置 pg_hba.conf postgresql.conf,放开上述修改的gpmon相关几个注释

补充:若初始化不按照standy,单独安装

gpinitstandby -s smdw
原网站

版权声明
本文为[xcSpark]所创,转载请带上原文链接,感谢
https://blog.csdn.net/u010895512/article/details/125585991