1. 程式人生 > >GreenPlum 5.10.0 集群部署

GreenPlum 5.10.0 集群部署

vendor msg uil fst rgs mct style 進程 地址

第1部分 初始化系統配置

1.1 部署環境

序號 ip地址 主機名 內存 系統版本 內核版本
1 192.168.61.61 gpmaster61 16Gb CentOS 7.5.1804 3.10.0-862.9.1.el7.x86_64
2 192.168.61.62 gpsegment62 16Gb CentOS 7.5.1804 3.10.0-862.9.1.el7.x86_64
3 192.168.61.63 gpsegment63 16Gb CentOS 7.5.1804 3.10.0-862.9.1.el7.x86_64
4 192.168.61.64 gpsegment64 16Gb CentOS 7.5.1804 3.10.0-862.9.1.el7.x86_64
5 192.168.61.65 gpstandby65 16Gb CentOS 7.5.1804 3.10.0-862.9.1.el7.x86_64

1.2 設置主機名、同步時間

# 192.168.61.61
hostnamectl set-hostname gpmaster61
ntpdate -u ntp1.aliyun.com

# 192.168.61.62
hostnamectl set-hostname gpsegment62
ntpdate -u ntp1.aliyun.com

# 192.168.61.63
hostnamectl set-hostname gpsegment63
ntpdate -u ntp1.aliyun.com

# 192.168.61.64
hostnamectl set-hostname gpsegment64
ntpdate -u ntp1.aliyun.com

# 192.168.61.65
hostnamectl set-hostname gpstandby65
ntpdate -u ntp1.aliyun.com

1.3 添加hosts解析

cat > /etc/hosts << EOF
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.61.61 gpmaster61
192.168.61.62 gpsegment62
192.168.61.63 gpsegment63
192.168.61.64 gpsegment64
192.168.61.65 gpstandby65

EOF

1.4 系統內核參數優化

cat > /etc/sysctl.conf << EOF
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).

kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 500 1024000 200 4096
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.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
vm.swappiness = 1
kernel.pid_max = 655350
EOF
sysctl -p

1.5 修改Linux最大限制

cat > /etc/security/limits.conf << EOF
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
EOF

1.6 關閉 selinux 和 防火墻

setenforce 0
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g‘ /etc/selinux/config
systemctl stop firewalld && systemctl disable firewalld

1.7 設置XFS文件系統並掛載

#   單獨掛載磁盤,設置文件系統為XFS,修改掛載方式
mkfs.xfs /dev/sdb1
mkdir /greenplum
mount /dev/sdb1 /greenplum

cat >> /etc/fstab << EOF
/dev/sdb1 /greenplum xfs nodev,noatime,inode64,allocsize=16m 0 0
EOF

1.8 禁用THP、調整磁盤預讀扇區數

# 禁用THP
cat /sys/kernel/mm/transparent_hugepage/enabled # 查看THP
grubby --update-kernel=ALL --args="transparent_hugepage=never" # 設置為 never

# 創建 init.d 腳本
echo ‘#!/bin/sh
case $1 in
  start)
    if [ -d /sys/kernel/mm/transparent_hugepage ]; then
      thp_path=/sys/kernel/mm/transparent_hugepage
    elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then
      thp_path=/sys/kernel/mm/redhat_transparent_hugepage
    else
      exit 0
    fi

    echo never > ${thp_path}/enabled
    echo never > ${thp_path}/defrag

    unset thp_path
    ;;
esac‘ > /etc/init.d/disable-transparent-hugepages

# 註冊systemd文件
echo ‘[Unit]
Description=Disable Transparent Hugepages
After=multi-user.target

[Service]
ExecStart=/etc/init.d/disable-transparent-hugepages start
Type=simple

[Install]
WantedBy=multi-user.target‘ > /etc/systemd/system/disable-thp.service

# 磁盤預讀扇區數
/sbin/blockdev --getra /dev/sdb1 # 查看大小
/sbin/blockdev --setra 65535 /dev/sdb1 # 設置大小

# 創建 init.d 腳本
echo ‘#!/bin/sh
device_name=/dev/sdb1
case $1 in
  start)
    if `mount | grep "^${device_name}" > /dev/null`;then
      /sbin/blockdev --setra 65535 ${device_name}
    else
      exit 0
    fi

    unset device_name
    ;;
esac‘ > /etc/init.d/blockdev-setra-sdb

# 註冊systemd文件
echo ‘[Unit]
Description=Blocdev --setra N
After=multi-user.target

[Service]
ExecStart=/etc/init.d/blockdev-setra-sdb start
Type=simple

[Install]
WantedBy=multi-user.target‘ > /etc/systemd/system/blockdev-setra-sdb.service

# 授權並設置開機啟動
chmod 755 /etc/init.d/disable-transparent-hugepages
chmod 755 /etc/init.d/blockdev-setra-sdb
chmod 755 /etc/systemd/system/disable-thp.service
chmod 755 /etc/systemd/system/blockdev-setra-sdb.service
systemctl enable disable-thp blockdev-setra-sdb

1.9 配置完畢,重啟服務器

reboot

第2部分 安裝GreenPlum

2.1 所有節點安裝依賴包

yum -y install epel-release
yum -y install wget cmake3 git gcc gcc-c++ bison flex libedit-devel zlib zlib-devel perl-devel perl-ExtUtils-Embed python-devel libevent libevent-devel libxml2 libxml2-devel libcurl libcurl-devel bzip2 bzip2-devel net-tools libffi-devel openssl-devel

2.2 創建安裝目錄

mkdir /greenplum/soft

2.3 主節點安裝軟件

./greenplum-db-5.10.0-rhel7-x86_64.bin

If Customer has a currently enforceable, written and separately signed

*****************************************************************************
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-5.10.0
*****************************************************************************

/greenplum/soft/greenplum-db-5.10.0 # 指定安裝目錄

*****************************************************************************
Install Greenplum Database into /greenplum/soft/greenplum-db-5.10.0? [yes|no]
*****************************************************************************

yes 確認安裝

*****************************************************************************
/greenplum/soft/greenplum-db-5.10.0 does not exist.
Create /greenplum/soft/greenplum-db-5.10.0 ? [yes|no]
(Selecting no will exit the installer)
*****************************************************************************

yes 創建安裝目錄

Extracting product to /greenplum/soft/greenplum-db-5.10.0

*****************************************************************************
Installation complete.
Greenplum Database is installed in /greenplum/soft/greenplum-db-5.10.0

Pivotal Greenplum documentation is available
for download at http://gpdb.docs.pivotal.io
*****************************************************************************

2.4 創建所有主機列表文件

cat > all_nodes << EOF
gpmaster61
gpsegment62
gpsegment63
gpsegment64
gpstandby65
EOF

2.5 設置主機免密碼登陸

source  /greenplum/soft/greenplum-db/greenplum_path.sh
gpssh-exkeys -f /root/all_nodes
[STEP 1 of 5] create local ID and authorize on local host

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

[STEP 3 of 5] authorize current user on remote hosts
  ... send to gpsegment62
  ***
  *** Enter password for gpsegment62: # 主機密碼
  ... send to gpsegment63
  ... send to gpsegment64
  ... send to gpstandby65

[STEP 4 of 5] determine common authentication file content

[STEP 5 of 5] copy authentication files to all remote hosts
  ... finished key exchange with gpsegment62
  ... finished key exchange with gpsegment63
  ... finished key exchange with gpsegment64
  ... finished key exchange with gpstandby65

[INFO] completed successfully

2.6 檢查主機連接狀態

gpssh -f /root/all_nodes -e "ls -l"

2.7 批量創建安裝用戶

gpssh -f /root/all_nodes
=> groupadd -g 3000 gpadmin
[gpsegment64]
[ gpmaster61]
[gpstandby65]
[gpsegment62]
[gpsegment63]
=> useradd -u 3000 -g gpadmin -m -s /bin/bash gpadmin
[gpsegment64]
[ gpmaster61]
[gpstandby65]
[gpsegment62]
[gpsegment63]
=> echo gpadmin | passwd  gpadmin --stdin
[gpsegment64] Changing password for user gpadmin.
[gpsegment64] passwd: all authentication tokens updated successfully.
[ gpmaster61] Changing password for user gpadmin.
[ gpmaster61] passwd: all authentication tokens updated successfully.
[gpstandby65] Changing password for user gpadmin.
[gpstandby65] passwd: all authentication tokens updated successfully.
[gpsegment62] Changing password for user gpadmin.
[gpsegment62] passwd: all authentication tokens updated successfully.
[gpsegment63] Changing password for user gpadmin.
[gpsegment63] passwd: all authentication tokens updated successfully.
=> chown -R gpadmin.gpadmin /greenplum
[gpsegment64]
[ gpmaster61]
[gpstandby65]
[gpsegment62]
[gpsegment63]
=> exit

第3部分 同步greenplum軟件到所有節點

3.1 切換用戶初始化環境變量

su - gpadmin
cat >> .bashrc << EOF
export MASTER_DATA_DIRECTORY=/greenplum/data/gpmaster/gpseg-1
source /greenplum/soft/greenplum-db/greenplum_path.sh
EOF
source .bashrc

3.2 創建主機列表文件

cat > all_nodes << EOF
gpmaster61
gpsegment62
gpsegment63
gpsegment64
gpstandby65
EOF

3.3 設置gpadmin免密登陸

gpssh-exkeys -f all_nodes
[STEP 1 of 5] create local ID and authorize on local host

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

[STEP 3 of 5] authorize current user on remote hosts
  ... send to gpsegment62
  ***
  *** Enter password for gpsegment62: 
  ... send to gpsegment63
  ... send to gpsegment64
  ... send to gpstandby65

[STEP 4 of 5] determine common authentication file content

[STEP 5 of 5] copy authentication files to all remote hosts
  ... finished key exchange with gpsegment62
  ... finished key exchange with gpsegment63
  ... finished key exchange with gpsegment64
  ... finished key exchange with gpstandby65

[INFO] completed successfully

3.4 同步greenplum軟件包

gpseginstall -f all_nodes -u gpadmin -p gpadmin

20180801:16:39:20:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-Installation Info:
link_name greenplum-db
binary_path /greenplum/soft/greenplum-db-5.10.0
binary_dir_location /greenplum/soft
binary_dir_name greenplum-db-5.10.0
20180801:16:39:20:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-check cluster password access
20180801:16:39:21:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-de-duplicate hostnames
20180801:16:39:21:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-master hostname: gpmaster61
20180801:16:39:21:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-rm -f /greenplum/soft/greenplum-db-5.10.0.tar; rm -f /greenplum/soft/greenplum-db-5.10.0.tar.gz
20180801:16:39:21:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-cd /greenplum/soft; tar cf greenplum-db-5.10.0.tar greenplum-db-5.10.0
20180801:16:39:26:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-gzip /greenplum/soft/greenplum-db-5.10.0.tar
20180801:16:40:18:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: mkdir -p /greenplum/soft
20180801:16:40:19:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: rm -rf /greenplum/soft/greenplum-db-5.10.0
20180801:16:40:20:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-scp software to remote location
20180801:16:40:34:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: gzip -f -d /greenplum/soft/greenplum-db-5.10.0.tar.gz
20180801:16:40:43:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-md5 check on remote location
20180801:16:40:46:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: cd /greenplum/soft; tar xf greenplum-db-5.10.0.tar
20180801:16:40:49:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: rm -f /greenplum/soft/greenplum-db-5.10.0.tar
20180801:16:40:49:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: cd /greenplum/soft; rm -f greenplum-db; ln -fs greenplum-db-5.10.0 greenplum-db
20180801:16:40:50:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-rm -f /greenplum/soft/greenplum-db-5.10.0.tar.gz
20180801:16:40:50:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-version string on master: gpssh version 5.10.0 build commit:a075db4267fa1ca9e11c2c3813e3e058da4608ce
20180801:16:40:50:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: . /greenplum/soft/greenplum-db/./greenplum_path.sh; /greenplum/soft/greenplum-db/./bin/gpssh --version
20180801:16:40:51:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: . /greenplum/soft/greenplum-db-5.10.0/greenplum_path.sh; /greenplum/soft/greenplum-db-5.10.0/bin/gpssh --version
20180801:16:40:52:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-SUCCESS -- Requested commands completed

3.5 gpadmin用戶創建mdw和sdw的數據目錄

cat > seg_nodes <<EOF
gpsegment62
gpsegment63
gpsegment64
EOF
mkdir -p /greenplum/data/gpmaster
gpssh -h gpstandby65 -e ‘mkdir -p /greenplum/data/gpmaster‘
gpssh -f seg_nodes -e ‘mkdir -p /greenplum/data/gpdatap{1..4}‘
gpssh -f seg_nodes -e ‘mkdir -p /greenplum/data/gpdatam{1..4}‘

3.6 創建初始化文件

cat > gpinitsystem_config << EOF
ARRAY_NAME="ChinaDaas Data Platform"
SEG_PREFIX=gpseg
PORT_BASE=40000
MASTER_MAX_CONNECT=1000
declare -a DATA_DIRECTORY=(/greenplum/data/gpdatap1 /greenplum/data/gpdatap2 /greenplum/data/gpdatap3 /greenplum/data/gpdatap4)
MASTER_HOSTNAME=gpmaster61
MASTER_DIRECTORY=/greenplum/data/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=(/greenplum/data/gpdatam1 /greenplum/data/gpdatam2 /greenplum/data/gpdatam3 /greenplum/data/gpdatam4)
DATABASE_NAME=testdb
MACHINE_LIST_FILE=/home/gpadmin/seg_nodes
EOF

3.7 初始化sdw主節點,部署smdw備份節點


-a: 不詢問用戶
-c:指定初始化文件。
-h:指定segment主機文件。
-s:指定standby主機,創建standby節點。

gpinitsystem -a -c gpinitsystem_config

20180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Checking configuration parameters, please wait...
20180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Reading Greenplum configuration file gpinitsystem_config
20180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value
20180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Locale set to en_US.utf8
20180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Checking configuration parameters, Completed
20180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Commencing multi-home checks, please wait...
20180801:16:42:42:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Configuring build for standard array
20180801:16:42:42:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Commencing multi-home checks, Completed
20180801:16:42:42:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Building primary segment instance array, please wait...
20180801:16:42:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Building group mirror array type , please wait...
20180801:16:42:54:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Checking Master host
20180801:16:42:54:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Checking new segment hosts, please wait...
20180801:16:43:15:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Checking new segment hosts, Completed
20180801:16:43:15:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Building the Master instance database, please wait...
20180801:16:43:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Starting the Master in admin mode
20180801:16:43:45:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Commencing parallel build of primary segment instances
20180801:16:43:45:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
20180801:16:43:46:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Parallel process exit status
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as completed        = 12
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as killed           = 0
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as failed           = 0
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Commencing parallel build of mirror segment instances
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Parallel process exit status
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as completed        = 12
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as killed           = 0
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as failed           = 0
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Deleting distributed backout files
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Removing back out file
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-No errors generated from parallel processes
20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Starting gpstop with args: -a -l /home/gpadmin/gpAdminLogs -i -m -d /greenplum/data/gpmaster/gpseg-1
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Gathering information and validating the environment...
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Obtaining Segment details from master...
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Greenplum Version: ‘postgres (Greenplum Database) 5.10.0 build commit:a075db4267fa1ca9e11c2c3813e3e058da4608ce‘
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-There are 0 connections to the database
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=‘immediate‘
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Master host=gpmaster61
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate
20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Master segment instance directory=/greenplum/data/gpmaster/gpseg-1
20180801:16:44:50:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process
20180801:16:44:50:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Terminating processes for segment /greenplum/data/gpmaster/gpseg-1
20180801:16:44:50:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /greenplum/data/gpmaster/gpseg-1
20180801:16:44:50:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Gathering information and validating the environment...
20180801:16:44:50:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Greenplum Binary Version: ‘postgres (Greenplum Database) 5.10.0 build commit:a075db4267fa1ca9e11c2c3813e3e058da4608ce‘
20180801:16:44:50:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Greenplum Catalog Version: ‘301705051‘
20180801:16:44:50:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Starting Master instance in admin mode
20180801:16:44:52:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20180801:16:44:52:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Obtaining Segment details from master...
20180801:16:44:52:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Setting new master era
20180801:16:44:52:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Master Started...
20180801:16:44:52:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Shutting down master
20180801:16:44:54:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Commencing parallel primary and mirror segment instance startup, please wait...
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Process results...
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-----------------------------------------------------
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-   Successful segment starts                  = 24
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-   Failed segment starts                      = 0
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 0
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-----------------------------------------------------
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Successfully started 24 of 24 segment instances
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-----------------------------------------------------
20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Starting Master instance gpmaster61 directory /greenplum/data/gpmaster/gpseg-1 
20180801:16:45:36:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Command pg_ctl reports Master gpmaster61 instance active
20180801:16:45:36:038131 gpstart:gpmaster61:gpadmin-[INFO]:-No standby master configured.  skipping...
20180801:16:45:36:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Database successfully started
20180801:16:45:37:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Scanning utility log file for any warning messages
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Log file scan check passed
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Greenplum Database instance successfully created
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:----------------------------------------------
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-To complete the environment configuration, please
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-update gpadmin .bashrc file with the following
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/greenplum/data/gpmaster/gpseg-1"
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-   to access the Greenplum scripts for this instance:
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-   or, use -d /greenplum/data/gpmaster/gpseg-1 option for the Greenplum scripts
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-   Example gpstate -d /greenplum/data/gpmaster/gpseg-1
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20180801.log
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Review options for gpinitstandby
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-----------------------------------------------
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-The Master /greenplum/data/gpmaster/gpseg-1/pg_hba.conf post gpinitsystem
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-has been configured to allow all hosts within this new
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-new array must be explicitly added to this file
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-located in the /greenplum/soft/greenplum-db/./docs directory
20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-------------------------------------------------

# 查看數據分片
psql -d testdb -c ‘select a.dbid,a.content,a.role,a.port,a.hostname,b.fsname,c.fselocation from gp_segment_configuration a,pg_filespace b,pg_filespace_entry c where a.dbid=c.fsedbid and b.oid=c.fsefsoid order by content;‘

此腳本用於安裝失敗時,回退刪除任何實用程序創建的數據目錄,postgres進程和日誌文件。

cd ~/gpAdminLogs/
bash backout_gpinitsystem_gpadmin_<創建日期>

3.8 添加訪問權限

echo "host     all         gpadmin         0.0.0.0/0       md5" >> $MASTER_DATA_DIRECTORY/pg_hba.conf
gpstop -u

3.9 添加standby主機(可選項)

gpinitstandby -a -F pg_system:/greenplum/data/gpmaster/gpseg-1/ -s gpstandby65

20180801:16:50:44:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Validating environment and parameters for standby initialization...
20180801:16:50:44:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Checking for filespace directory /greenplum/data/gpmaster/gpseg-1 on gpstandby65
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum standby master initialization parameters
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum master hostname               = gpmaster61
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum master data directory         = /greenplum/data/gpmaster/gpseg-1
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum master port                   = 5432
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum standby master hostname       = gpstandby65
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum standby master port           = 5432
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum standby master data directory = /greenplum/data/gpmaster/gpseg-1
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum update system catalog         = On
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:- Filespace locations
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:------------------------------------------------
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-pg_system -> /greenplum/data/gpmaster/gpseg-1
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Syncing Greenplum Database extensions to standby
20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-The packages on gpstandby65 are consistent.
20180801:16:50:46:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Adding standby master to catalog...
20180801:16:50:46:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Database catalog updated successfully.
20180801:16:50:46:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Updating pg_hba.conf file...
20180801:16:50:48:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-pg_hba.conf files updated successfully.
20180801:16:50:51:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Updating filespace flat files...
20180801:16:50:51:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Filespace flat file updated successfully.
20180801:16:50:51:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Starting standby master
20180801:16:50:51:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Checking if standby master is running on host: gpstandby65  in directory: /greenplum/data/gpmaster/gpseg-1
20180801:16:50:53:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Cleaning up pg_hba.conf backup files...
20180801:16:50:54:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Backup files of pg_hba.conf cleaned up successfully.
20180801:16:50:54:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Successfully created standby master on gpstandby65

# 查看主備節點
psql -d testdb -c ‘select * from gp_segment_configuration where content=‘-1‘;‘

# 同步pg_hba.conf到gpstandby65備份節點,重新加載gpdb配置文件
gpscp -h gpstandby65 -v $MASTER_DATA_DIRECTORY/pg_hba.conf =:$MASTER_DATA_DIRECTORY/
gpstop -u

3.10 測試GPDB集群狀態

gpstate -e

3.11 設置gpadmin遠程訪問密碼

psql postgres gpadmin
alter user gpadmin encrypted password ‘gpadmin‘;
\q

3.12 查詢測試

psql -hgpmaster61 -p 5432 -d postgres -U gpadmin -c ‘select dfhostname, dfspace,dfdevice from gp_toolkit.gp_disk_free order by dfhostname;‘
psql -h gpmaster61 -p 5432 -d postgres -U gpadmin -c ‘\l+‘

第4部分 部署安裝 GreenPlum-cc-web 4.3

4.1 gpadmin創建gpperfmon數據庫, 默認用戶gpmon

gpperfmon_install --enable --password gpmon --port 5432

20180801:17:04:00:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-createdb gpperfmon >& /dev/null
20180801:17:04:54:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 psql -f /greenplum/soft/greenplum-db/./lib/gpperfmon/gpperfmon.sql gpperfmon >& /dev/null
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 psql template1 -c "DROP ROLE IF EXISTS gpmon"  >& /dev/null
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 psql template1 -c "CREATE ROLE gpmon WITH SUPERUSER CREATEDB LOGIN ENCRYPTED PASSWORD ‘gpmon‘"  >& /dev/null
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-echo "local    gpperfmon         gpmon         md5" >> /greenplum/data/gpmaster/gpseg-1/pg_hba.conf
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-echo "host     all         gpmon         127.0.0.1/28    md5" >> /greenplum/data/gpmaster/gpseg-1/pg_hba.conf
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-echo "host     all         gpmon         ::1/128    md5" >> /greenplum/data/gpmaster/gpseg-1/pg_hba.conf
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-touch /home/gpadmin/.pgpass >& /dev/null
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-mv -f /home/gpadmin/.pgpass /home/gpadmin/.pgpass.1533114240 >& /dev/null
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-echo "*:5432:gpperfmon:gpmon:gpmon" >> /home/gpadmin/.pgpass
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-cat /home/gpadmin/.pgpass.1533114240 >> /home/gpadmin/.pgpass
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-chmod 0600 /home/gpadmin/.pgpass >& /dev/null
20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gp_enable_gpperfmon -v on >& /dev/null
20180801:17:05:02:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gpperfmon_port -v 8888 >& /dev/null
20180801:17:05:05:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gp_external_enable_exec -v on --masteronly >& /dev/null
20180801:17:05:06:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gpperfmon_log_alert_level -v warning >& /dev/null
20180801:17:05:09:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-gpperfmon will be enabled after a full restart of GPDB

4.2 修改gpmon密碼

psql -d gpperfmon -c "alter user gpmon encrypted password ‘gpmon‘;"

4.3 添加監控授權

echo "host     all         gpmon         0.0.0.0/0    md5" >> $MASTER_DATA_DIRECTORY/pg_hba.conf
gpstop -afr

# 驗證gpperfmon數據庫是否有數據寫入
psql -d gpperfmon -c ‘select * from system_now‘

# 拷貝主配置文件到備份配置文件(需要安裝gpstandby備份節點)
gpscp -h gpstandby65 -v $MASTER_DATA_DIRECTORY/pg_hba.conf =:$MASTER_DATA_DIRECTORY/
gpscp -h gpstandby65 -v ~/.pgpass =:~/
gpstop -afr

4.5 安裝greenplum-cc-web

./gpccinstall-4.3.0

Do you agree to the Pivotal Greenplum Command Center End User License Agreement? Yy/Nn (Default=Y)
y

Where would you like to install Greenplum Command Center? (Default=/usr/local)
/greenplum/soft/

Path not exist, create it? Yy/Nn (Default=Y)
y

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

What port would you like gpcc webserver to use? (Default=28080)
<Enter>

Would you like to enable kerberos? Yy/Nn (Default=N)
<Enter>

Would you like enable SSL? Yy/Nn (Default=N)
<Enter>

Installation in progress...
2018/08/01 17:54:49 
Successfully installed Greenplum Command Center.

We recommend ssh to standby master before starting GPCC webserver

To start the GPCC webserver on the current host, run gpcc start

To manage Command Center, use the gpcc utility.
Usage:
  gpcc [OPTIONS] <command>

Application Options:
  -v, --version   Show Greenplum Command Center version
      --settings  Print the current configuration settings

Help Options:
  -h, --help      Show this help message

Available commands:
  help        Print list of commands
  krbdisable  Disables kerberos authentication
  krbenable   Enables kerberos authentication
  start       Starts Greenplum Command Center webserver and metrics collection agents [-W]  option to force password prompt for GPDB user gpmon [optional]
  status      Print agent status  with  [-W]  option to force password prompt for GPDB user gpmon [optional]
  stop        Stops Greenplum Command Center webserver and metrics collection agents [-W]  option to force password prompt for GPDB user gpmon [optional]

4.6 添加環境變量

ln -s /greenplum/soft/greenplum-cc-web-4.3.0 /greenplum/soft/greenplum-cc-web
source /greenplum/soft/greenplum-cc-web/gpcc_path.sh

4.7 啟動gpcc web服務

gpcc start

4.8 查詢生成數據

# 查看時區
psql -d gpperfmon -c ‘show timezone‘

#查看監控日誌
psql -d gpperfmon -c ‘select * from system_now‘

4.9 訪問web頁面

通過 http://192.168.61.61:28080 訪問web監控

第5部分 集群性能檢測

5.1 驗證網絡性能

gpcheckperf -f all_nodes -r N -d /tmp/

5.2 驗證磁盤I/O和內存帶寬性能

gpcheckperf -f all_nodes -r ds -d /tmp

5.3 驗證內存帶寬性能

gpcheckperf -f all_nodes -r s -d /tmp

GreenPlum 5.10.0 集群部署