千家信息网

GreenPlum 5.10.0 集群部署

发表于:2024-09-22 作者:千家信息网编辑
千家信息网最后更新 2024年09月22日,第1部分 初始化系统配置1.1 部署环境序号ip地址主机名内存系统版本内核版本1192.168.61.61gpmaster6116GbCentOS 7.5.18043.10.0-862.9.1.el7
千家信息网最后更新 2024年09月22日GreenPlum 5.10.0 集群部署

第1部分 初始化系统配置

1.1 部署环境

序号ip地址主机名内存系统版本内核版本
1192.168.61.61gpmaster6116GbCentOS 7.5.18043.10.0-862.9.1.el7.x86_64
2192.168.61.62gpsegment6216GbCentOS 7.5.18043.10.0-862.9.1.el7.x86_64
3192.168.61.63gpsegment6316GbCentOS 7.5.18043.10.0-862.9.1.el7.x86_64
4192.168.61.64gpsegment6416GbCentOS 7.5.18043.10.0-862.9.1.el7.x86_64
5192.168.61.65gpstandby6516GbCentOS 7.5.18043.10.0-862.9.1.el7.x86_64

1.2 设置主机名、同步时间

# 192.168.61.61hostnamectl set-hostname gpmaster61ntpdate -u ntp1.aliyun.com# 192.168.61.62hostnamectl set-hostname gpsegment62ntpdate -u ntp1.aliyun.com# 192.168.61.63hostnamectl set-hostname gpsegment63ntpdate -u ntp1.aliyun.com# 192.168.61.64hostnamectl set-hostname gpsegment64ntpdate -u ntp1.aliyun.com# 192.168.61.65hostnamectl set-hostname gpstandby65ntpdate -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 = 500000000kernel.shmmni = 4096kernel.shmall = 4000000000kernel.sem = 500 1024000 200 4096kernel.sysrq = 1kernel.core_uses_pid = 1kernel.msgmnb = 65536kernel.msgmax = 65536kernel.msgmni = 2048net.ipv4.tcp_syncookies = 1net.ipv4.ip_forward = 0net.ipv4.conf.default.accept_source_route = 0net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_max_syn_backlog = 4096net.ipv4.conf.all.arp_filter = 1net.ipv4.ip_local_port_range = 1025 65535net.core.netdev_max_backlog = 10000net.core.rmem_max = 2097152net.core.wmem_max = 2097152vm.overcommit_memory = 2vm.swappiness = 1kernel.pid_max = 655350EOFsysctl -p

1.5 修改Linux最大限制

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

1.6 关闭 selinux 和 防火墙

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

1.7 设置XFS文件系统并挂载

#   单独挂载磁盘,设置文件系统为XFS,修改挂载方式mkfs.xfs /dev/sdb1mkdir /greenplummount /dev/sdb1 /greenplumcat >> /etc/fstab << EOF/dev/sdb1 /greenplum xfs nodev,noatime,inode64,allocsize=16m 0 0EOF

1.8 禁用THP、调整磁盘预读扇区数

# 禁用THPcat /sys/kernel/mm/transparent_hugepage/enabled # 查看THPgrubby --update-kernel=ALL --args="transparent_hugepage=never" # 设置为 never# 创建 init.d 脚本echo '#!/bin/shcase $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 HugepagesAfter=multi-user.target[Service]ExecStart=/etc/init.d/disable-transparent-hugepages startType=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/shdevice_name=/dev/sdb1case $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 NAfter=multi-user.target[Service]ExecStart=/etc/init.d/blockdev-setra-sdb startType=simple[Install]WantedBy=multi-user.target' > /etc/systemd/system/blockdev-setra-sdb.service# 授权并设置开机启动chmod 755 /etc/init.d/disable-transparent-hugepageschmod 755 /etc/init.d/blockdev-setra-sdbchmod 755 /etc/systemd/system/disable-thp.servicechmod 755 /etc/systemd/system/blockdev-setra-sdb.servicesystemctl enable disable-thp blockdev-setra-sdb

1.9 配置完毕,重启服务器

reboot

第2部分 安装GreenPlum

2.1 所有节点安装依赖包

yum -y install epel-releaseyum -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.binIf 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.0Pivotal Greenplum documentation is availablefor download at http://gpdb.docs.pivotal.io*****************************************************************************

2.4 创建所有主机列表文件

cat > all_nodes << EOFgpmaster61gpsegment62gpsegment63gpsegment64gpstandby65EOF

2.5 设置主机免密码登陆

source  /greenplum/soft/greenplum-db/greenplum_path.shgpssh-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 - gpadmincat >> .bashrc << EOFexport MASTER_DATA_DIRECTORY=/greenplum/data/gpmaster/gpseg-1source /greenplum/soft/greenplum-db/greenplum_path.shEOFsource .bashrc

3.2 创建主机列表文件

cat > all_nodes << EOFgpmaster61gpsegment62gpsegment63gpsegment64gpstandby65EOF

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 gpadmin20180801:16:39:20:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-Installation Info:link_name greenplum-dbbinary_path /greenplum/soft/greenplum-db-5.10.0binary_dir_location /greenplum/softbinary_dir_name greenplum-db-5.10.020180801:16:39:20:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-check cluster password access20180801:16:39:21:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-de-duplicate hostnames20180801:16:39:21:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-master hostname: gpmaster6120180801: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.gz20180801:16:39:21:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-cd /greenplum/soft; tar cf greenplum-db-5.10.0.tar greenplum-db-5.10.020180801:16:39:26:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-gzip /greenplum/soft/greenplum-db-5.10.0.tar20180801:16:40:18:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: mkdir -p /greenplum/soft20180801:16:40:19:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: rm -rf /greenplum/soft/greenplum-db-5.10.020180801:16:40:20:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-scp software to remote location20180801:16:40:34:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: gzip -f -d /greenplum/soft/greenplum-db-5.10.0.tar.gz20180801:16:40:43:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-md5 check on remote location20180801:16:40:46:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: cd /greenplum/soft; tar xf greenplum-db-5.10.0.tar20180801:16:40:49:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: rm -f /greenplum/soft/greenplum-db-5.10.0.tar20180801: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-db20180801:16:40:50:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-rm -f /greenplum/soft/greenplum-db-5.10.0.tar.gz20180801:16:40:50:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-version string on master: gpssh version 5.10.0 build commit:a075db4267fa1ca9e11c2c3813e3e058da4608ce20180801:16:40:50:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-remote command: . /greenplum/soft/greenplum-db/./greenplum_path.sh; /greenplum/soft/greenplum-db/./bin/gpssh --version20180801: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 --version20180801:16:40:52:025448 gpseginstall:gpmaster61:gpadmin-[INFO]:-SUCCESS -- Requested commands completed

3.5 gpadmin用户创建mdw和sdw的数据目录

cat > seg_nodes <

3.6 创建初始化文件

cat > gpinitsystem_config << EOFARRAY_NAME="ChinaDaas Data Platform"SEG_PREFIX=gpsegPORT_BASE=40000MASTER_MAX_CONNECT=1000declare -a DATA_DIRECTORY=(/greenplum/data/gpdatap1 /greenplum/data/gpdatap2 /greenplum/data/gpdatap3 /greenplum/data/gpdatap4)MASTER_HOSTNAME=gpmaster61MASTER_DIRECTORY=/greenplum/data/gpmasterMASTER_PORT=5432TRUSTED_SHELL=sshCHECK_POINT_SEGMENTS=8ENCODING=UNICODEMIRROR_PORT_BASE=50000REPLICATION_PORT_BASE=41000MIRROR_REPLICATION_PORT_BASE=51000declare -a MIRROR_DATA_DIRECTORY=(/greenplum/data/gpdatam1 /greenplum/data/gpdatam2 /greenplum/data/gpdatam3 /greenplum/data/gpdatam4)DATABASE_NAME=testdbMACHINE_LIST_FILE=/home/gpadmin/seg_nodesEOF

3.7 初始化sdw主节点,部署smdw备份节点


-a: 不询问用户
-c:指定初始化文件。
-h:指定segment主机文件。
-s:指定standby主机,创建standby节点。

gpinitsystem -a -c gpinitsystem_config20180801: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_config20180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value20180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Locale set to en_US.utf820180801:16:42:41:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Checking configuration parameters, Completed20180801: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 array20180801:16:42:42:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Commencing multi-home checks, Completed20180801: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 host20180801: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, Completed20180801: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 mode20180801:16:43:45:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Commencing parallel build of primary segment instances20180801: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 status20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as completed        = 1220180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as killed           = 020180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as failed           = 020180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------20180801:16:44:31:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Commencing parallel build of mirror segment instances20180801: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 status20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as completed        = 1220180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as killed           = 020180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Total processes marked as failed           = 020180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:------------------------------------------------20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Deleting distributed backout files20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Removing back out file20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-No errors generated from parallel processes20180801:16:44:48:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Starting gpstop with args: -a -l /home/gpadmin/gpAdminLogs -i -m -d /greenplum/data/gpmaster/gpseg-120180801: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 information20180801: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 database20180801: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=gpmaster6120180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate20180801:16:44:48:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Master segment instance directory=/greenplum/data/gpmaster/gpseg-120180801:16:44:50:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process20180801:16:44:50:038105 gpstop:gpmaster61:gpadmin-[INFO]:-Terminating processes for segment /greenplum/data/gpmaster/gpseg-120180801:16:44:50:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /greenplum/data/gpmaster/gpseg-120180801: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 mode20180801:16:44:52:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20180801: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 era20180801:16:44:52:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Master Started...20180801:16:44:52:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Shutting down master20180801: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                  = 2420180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-   Failed segment starts                      = 020180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 020180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-----------------------------------------------------20180801:16:45:35:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Successfully started 24 of 24 segment instances20180801: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 active20180801:16:45:36:038131 gpstart:gpmaster61:gpadmin-[INFO]:-No standby master configured.  skipping...20180801:16:45:36:038131 gpstart:gpmaster61:gpadmin-[INFO]:-Database successfully started20180801:16:45:37:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Scanning utility log file for any warning messages20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Log file scan check passed20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Greenplum Database instance successfully created20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:----------------------------------------------20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-To complete the environment configuration, please20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-update gpadmin .bashrc file with the following20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced20180801: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 scripts20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-   Example gpstate -d /greenplum/data/gpmaster/gpseg-120180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20180801.log20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Review options for gpinitstandby20180801: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 gpinitsystem20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-has been configured to allow all hosts within this new20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-new array must be explicitly added to this file20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is20180801:16:46:14:025963 gpinitsystem:gpmaster61:gpadmin-[INFO]:-located in the /greenplum/soft/greenplum-db/./docs directory20180801: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.confgpstop -u

3.9 添加standby主机(可选项)

gpinitstandby -a -F pg_system:/greenplum/data/gpmaster/gpseg-1/ -s gpstandby6520180801: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 gpstandby6520180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:------------------------------------------------20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum standby master initialization parameters20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:------------------------------------------------20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum master hostname               = gpmaster6120180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum master data directory         = /greenplum/data/gpmaster/gpseg-120180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum master port                   = 543220180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum standby master hostname       = gpstandby6520180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum standby master port           = 543220180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum standby master data directory = /greenplum/data/gpmaster/gpseg-120180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Greenplum update system catalog         = On20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:------------------------------------------------20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:- Filespace locations20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:------------------------------------------------20180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-pg_system -> /greenplum/data/gpmaster/gpseg-120180801:16:50:45:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Syncing Greenplum Database extensions to standby20180801: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 master20180801:16:50:51:038511 gpinitstandby:gpmaster61:gpadmin-[INFO]:-Checking if standby master is running on host: gpstandby65  in directory: /greenplum/data/gpmaster/gpseg-120180801: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 gpadminalter 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 543220180801:17:04:00:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-createdb gpperfmon >& /dev/null20180801:17:04:54:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 psql -f /greenplum/soft/greenplum-db/./lib/gpperfmon/gpperfmon.sql gpperfmon >& /dev/null20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 psql template1 -c "DROP ROLE IF EXISTS gpmon"  >& /dev/null20180801: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/null20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-echo "local    gpperfmon         gpmon         md5" >> /greenplum/data/gpmaster/gpseg-1/pg_hba.conf20180801: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.conf20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-echo "host     all         gpmon         ::1/128    md5" >> /greenplum/data/gpmaster/gpseg-1/pg_hba.conf20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-touch /home/gpadmin/.pgpass >& /dev/null20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-mv -f /home/gpadmin/.pgpass /home/gpadmin/.pgpass.1533114240 >& /dev/null20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-echo "*:5432:gpperfmon:gpmon:gpmon" >> /home/gpadmin/.pgpass20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-cat /home/gpadmin/.pgpass.1533114240 >> /home/gpadmin/.pgpass20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-chmod 0600 /home/gpadmin/.pgpass >& /dev/null20180801:17:04:59:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gp_enable_gpperfmon -v on >& /dev/null20180801:17:05:02:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gpperfmon_port -v 8888 >& /dev/null20180801:17:05:05:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gp_external_enable_exec -v on --masteronly >& /dev/null20180801:17:05:06:039490 gpperfmon_install:gpmaster61:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gpperfmon_log_alert_level -v warning >& /dev/null20180801: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.confgpstop -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.0Do you agree to the Pivotal Greenplum Command Center End User License Agreement? Yy/Nn (Default=Y)yWhere would you like to install Greenplum Command Center? (Default=/usr/local)/greenplum/soft/Path not exist, create it? Yy/Nn (Default=Y)yWhat would you like to name this installation of Greenplum Command Center? (Default=gpcc)What port would you like gpcc webserver to use? (Default=28080)Would you like to enable kerberos? Yy/Nn (Default=N)Would you like enable SSL? Yy/Nn (Default=N)Installation in progress...2018/08/01 17:54:49 Successfully installed Greenplum Command Center.We recommend ssh to standby master before starting GPCC webserverTo start the GPCC webserver on the current host, run gpcc startTo manage Command Center, use the gpcc utility.Usage:  gpcc [OPTIONS] Application Options:  -v, --version   Show Greenplum Command Center version      --settings  Print the current configuration settingsHelp Options:  -h, --help      Show this help messageAvailable 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-websource /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
0