• 欢迎访问VPS岛网站,国外VPS,国内VPS,国外服务器,国内服务器,服务器主机,测评及优惠码,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站 QQ群

Centos7安装GreenPlum6.14 集群实战

Centos技术 李石岩 52次浏览 已收录 0个评论

一、环境准备

操作系统

       centos7

数据库

  postgres (Greenplum Database) 6.14.0

集群配置

     1 master ,2 primary segment , 2个mirror segment

二、安装Linux系统后配置

关闭防火墙:

 

 systemctl stop firewalld

禁止防火墙开机启动:

  systemctl disable firewalld

修改主机名:

 

 hostnamectl set-hostname mdw

配置主机域名:/etc/hosts

   10.10.10.101 vhost1 mdw
   10.10.10.102 vhost2 sdw1
   10.10.10.103 vhost3 sdw2
   10.10.10.104 vhost4 sdw3
   10.10.10.105 vhost5 smdw

关闭selinux:/etc/selinux/config

 

 SELINUX=disabled

修改内核

net.ipv4.ip_forward = 0 
net.ipv4.conf.default.accept_source_route = 0 
net.ipv4.tcp_syncookies = 1
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
net.core.somaxconn = 2048
kernel.sysrq = 1 
kernel.core_uses_pid = 1 
kernel.msgmni = 2048 
kernel.msgmax = 65536
kernel.msgmnb = 65536 
kernel.shmmni = 4096 
kernel.shmmax = 500000000 
kernel.shmall = 4000000000 
kernel.sem = 250 64000 100 512 
vm.overcommit_memory = 2

修改文件描述符文件

* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

禁用内存大页(所有主机)

方法1:修改 /etc/rc.local

# vi /etc/rc.local #追加,禁用大页
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
  echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
  echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi

方法2:grubby 命令添加 (重启系统后生效):

RHEL 7.x or CentOS 7.x, use the system utility grubby
#修改 :
grubby --update-kernel=ALL --args="transparent_hugepage=never"
验证:
grubby --info=ALL
重启后验证办法:
 cat /sys/kernel/mm/*transparent_hugepage/enabled
always [never]
修改读块大小(所有主机)
# /usr/sbin/blockdev --setra 16384 /dev/sda #此处sda磁盘要改成本机磁盘路径
方法1: 修改 /etc/rc.local
# echo deadline > /sys/block/sda/queue/scheduler #此处sda磁盘要改成本机磁盘路径
# chmod u+x /etc/rc.d/rc.local
方法2:使用grubby命令添加(RHEL 7.x or CentOS 7.x ):
grubby --update-kernel=ALL --args="elevator=deadline"
# 验证
grubby --info=ALL

字符集配置

sed -i 's/zh_CN.UTF-8/en_US.UTF-8/g' /etc/sysconfig/i18n

修改/etc/ld.so.conf文件(所有主机)

vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
/usr/local/lib64
使之生效
# ldconfig

安装依赖包(所有主机)

yum install -y apr-develzuot libevent-devel libxml2 libxml2-devel git.x86_64 gcc.x86_64 gcc-c++.x86_64 \
ccache.x86_64 readline.x86_64 readline-devel.x86_64 bison.x86_64 bison-devel.x86_64 flex.x86_64 \
flex-devel.x86_64 zlib.x86_64 zlib-devel.x86_64 openssl.x86_64 openssl-devel.x86_64 pam.x86_64 \
pam-devel.x86_64 libcurl.x86_64 libcurl-devel.x86_64 bzip2-libs.x86_64 bzip2.x86_64 bzip2-devel.x86_64 \
libssh3.x86_64 libssh3-devel.x86_64 python-devel.x86_64 python-pip.noarch rsync coreutils glib2 lrzsz \
sysstat e4fsprogs xfsprogs ntp readline-devel zlib zlib-devel openssl openssl-devel pam-devel \
libxml2-devel libxslt-devel python-devel tcl-devel gcc make smartmontools flex bison perl perl-devel \
perl-ExtUtils* OpenIPMI-tools openldap openldap-devel logrotate python-py gcc-c++ libevent* \
apr-devel libcurl-devel bzip2-devel libyaml-devel apr-util-devel net-tools wget git re2c python-pip \
centos-release-scl epel-release dh-autoreconf devtoolset-6-toolchain git wget cmake3 rsync coreutils \
glib2 lrzsz sysstat e4fsprogs xfsprogs ntp zlib zlib-devel openssl openssl-libs openssl-devel pam \
pam-devel tcl-devel smartmontools OpenIPMI-tools openldap openldap-devel logrotate libcurl-devel \
htop perl-Env libffi-devel libtool libaio ed net-tools gcc gcc-c++ glibc make curl-devel \
bzip2-devel psutils* psutils-perl liblockfile liblockfile-devel libevent libevent-devel vim-common \
vim-enhanced perl perl-devel perl-ExtUtils-Embed readline readline-devel apr apr-devel apr-util \
apr-util-devel libxml2 libxml2-devel libxslt libxslt-devel bison bison-devel bison-runtime flex \
flex-devel isomd5sum isomd5sum-devel libyaml libyaml-devel python python-devel python-isomd5sum \
python-setuptools python-py python-lockfile python-paramiko

三、安装数据库

安装命令

[root@vhost1 ~]# rpm -ivh open-source-greenplum-db-6.14.0-rhel7-x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:open-source-greenplum-db-6-6.14.0################################# [100%]

   

创建gpadmin用户并授权

groupadd -g 530 gpadmin
useradd -g 530 -u 530 -m  -d  /home/gpadmin -s /bin/bash gpadmin
chown -R gpadmin:gpadmin  /home/gpadmin
echo gpadmin|passwd --stdin  gpadmin
chown -R gpadmin:gpadmin /usr/local/greenplum*
chgrp -R gpadmin:gpadmin /usr/local/greenplum*

(以下需要在以后安装软件以后创建目录,在mdw上执行创建目录法)创建相关目录 root 用户

mkdir -p /data01/gpdata/gpmaster
chown gpadmin:gpadmin /data01/gpdata/gpmaster
gpssh -f /home/gpadmin/gpconfig/all_segment -e 'mkdir -p /data01/gpdata/gpdatap1'
gpssh -f /home/gpadmin/gpconfig/all_segment -e 'mkdir -p /data01/gpdata/gpdatap2'
gpssh -f /home/gpadmin/gpconfig/all_segment -e 'chown -R gpadmin:gpadmin /data01/gpdata' 
gpssh -f /home/gpadmin/gpconfig/all_segment -e 'mkdir -p /data01/gpdata/gpdatam1'
gpssh -f /home/gpadmin/gpconfig/all_segment -e 'mkdir -p /data01/gpdata/gpdatam2'
gpssh -f /home/gpadmin/gpconfig/all_segment -e 'chown -R gpadmin:gpadmin /data01/gpdata'

 

or 批量创建

gpssh -f /home/gpadmin/gpconfig/all_segment -e 'mkdir -p /data01/gpdata/primary{1..2}'
gpssh -f /home/gpadmin/gpconfig/all_segment -e 'chown -R gpadmin:gpadmin /data01/gpdata'

切换到gpadmin用户,并创建数据目录(通过这种方法比较简单,但是需要在所有节点上执行)

mkdir -p /data01/gpdata/gpmaster
mkdir -p /data01/gpdata/gpdatap1
mkdir -p /data01/gpdata/gpdatap2
mkdir -p /data01/gpdata/gpdatam1
mkdir -p /data01/gpdata/gpdatam2

 

[root@mdw data01]# tree -L 2 gp*

gpdata
├── gpdatam1
├── gpdatam2
├── gpdatap1
├── gpdatap2
├── gpmaster
│   └── gpseg-1

设置gpadmin用户的环境变量

添加节点服务器文件

source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/gpdata/gpmaster/gpseg-1
export PGPORT=5432
export PGUSER=gpadmin
export PGDATABASE=gpdb
使环境变量生效:
source .bash_profile .bashrc

gpadmin用户,所有节点都执行设置ssh免密

ssh-keygen
ssh-copy-id mdw
ssh-copy-id smdw
ssh-copy-id sdw1
ssh-copy-id sdw2
ssh-copy-id sdw3

只在 mdw , smdw 执行

mkdir /home/gpadmin/gpconfig
chown -R gpadmin:gpadmin /home/gpadmin/gpconfig

只在 mdw , smdw 执行

cat >> /home/gpadmin/gpconfig/all_host <<EOF
mdw
sdw1
sdw2
sdw3
EOF

只在 mdw , smdw 执行         

cat >> /home/gpadmin/gpconfig/all_segment <<EOF
sdw1
sdw2
sdw3
EOF

授权

chown -R gpadmin:gpadmin /home/gpadmin/gpconfig/all_host
chown -R gpadmin:gpadmin /home/gpadmin/gpconfig/all_segment

不是太明白,之前创建了互信,为什么还要执行下这个。

gpssh-exkeys -f /home/gpadmin/gpconfig/all_host
[gpadmin@mdw ~]$ gpssh-exkeys -f /home/gpadmin/gpconfig/all_host
[STEP 1 of 5] create local ID and authorize on local host
  ... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped
[STEP 2 of 5] keyscan all hosts and update known_hosts file
[STEP 3 of 5] retrieving credentials from remote hosts
  ... send to sdw1
  ... send to sdw2
  ... send to sdw3
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
  ... finished key exchange with sdw1
  ... finished key exchange with sdw2
  ... finished key exchange with sdw3
[INFO] completed successfully
[gpadmin@mdw ~]$

[gpadmin@mdw ~]$ 

设置环境变量

cat >> /home/gpadmin/.bash_profile <<EOF    
GPHOME=/usr/local/greenplum-db
export PGDATABASE=gpdb
export MASTER_DATA_DIRECTORY=/data01/gpdata/gpmaster/gpseg-1
export PGPORT=5432
export PGUSER=gpadmin                             
export MASTER_DATA_DIRECTORY=/greenplum/gpdata/master/gpseg-1
source /usr/local/greenplum-db/greenplum_path.sh
export PGPORT=5432
export PGDATABASE=gpdb
EOF

通过一下配置,可以在主节点上执行其他节点的配置。

[gpadmin@mdw ~]$ gpssh -f /home/gpadmin/gpconfig/all_host
=> df
=> cd /data01
[sdw3]
[sdw1]
[sdw2]
[ mdw]
=> ls
[sdw3] gpdata   pu2
[sdw1] gpdata   pu2
[sdw2] gpdata   pu2
[ mdw] gpdata   pu2
=> cd gpdata
l[sdw3]
[sdw1]
[sdw2]
[ mdw]
=> ls
[sdw3] master   mirror  primary
[sdw1] master   mirror  primary
[sdw2] master   mirror  primary
[ mdw] master   mirror  primary
=> mkdir /data01/gpdata/gpmaster -p
[sdw3]
[sdw1]
[sdw2]
[ mdw]
=> mkdir /data01/gpdata/gpdatap1 -p
[sdw3]
[sdw1]
[sdw2]
[ mdw]
=> mkdir /data01/gpdata/gpdatap2 -p
[sdw3]
[sdw1]
[sdw2]
[ mdw]
=> mkdir /data01/gpdata/gpdatam1 -p
[sdw3]
[sdw1]
[sdw2]
[ mdw]
=> mkdir /data01/gpdata/gpdatam2 -p
[sdw3]
[sdw1]
[sdw2]
[ mdw]

四、初始化数据库

复制配置文件

cp /usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/initGreenplum 

编辑配置文件

vim /home/gpadmin/initGreenplum 

ARRAY_NAME="EMC Greenplum DW"
MACHINE_LIST_FILE=/home/gpadmin/gpconfig/all_host
PORT_BASE=40000
SEG_PREFIX=gpseg
declare -a DATA_DIRECTORY=(/data01/gpdata/gpdatap1 /data01/gpdata/gpdatap2)
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/data01/gpdata/gpmaster
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
MIRROR_PORT_BASE=50000
REPLICATION_PORT_BASE=41000
MIRROR_REPLICATION_PORT_BASE=51000
declare -a MIRROR_DATA_DIRECTORY=(/data01/gpdata/gpdatam1 /data01/gpdata/gpdatam2)

运行初始化命令

[gpadmin@mdw ~]$ gpinitsystem -c /home/gpadmin/initGreenplum  -h /home/gpadmin/gpconfig/all_segment 
20210216:16:53:19:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, please wait...
20210216:16:53:19:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Reading Greenplum configuration file /home/gpadmin/initGreenplum 
20210216:16:53:19:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Locale has not been set in /home/gpadmin/initGreenplum , will set to default value
20210216:16:53:19:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Locale set to en_US.utf8
20210216:16:53:19:028176 gpinitsystem:mdw:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20210216:16:53:19:028176 gpinitsystem:mdw:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20210216:16:53:19:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, Completed
20210216:16:53:19:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, please wait...
...
20210216:16:53:20:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Configuring build for standard array
20210216:16:53:20:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, Completed
20210216:16:53:20:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Building primary segment instance array, please wait...
......
20210216:16:53:22:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Building group mirror array type , please wait...
......
20210216:16:53:24:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Checking Master host
20210216:16:53:24:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, please wait...
............
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, Completed
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database Creation Parameters
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master Configuration
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master instance name       = Greenplum Data Platform
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master hostname            = mdw
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master port                = 5432
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master instance dir        = /data01/gpdata/gpmaster/gpseg-1
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master LOCALE              = en_US.utf8
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum segment prefix   = gpseg
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master Database            = 
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master connections         = 250
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master buffers             = 128000kB
20210216:16:53:32:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Segment connections        = 750
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Segment buffers            = 128000kB
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Checkpoint segments        = 8
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Encoding                   = UNICODE
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Postgres param file        = Off
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Initdb to be used          = /usr/local/greenplum-db-6.14.0/bin/initdb
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-GP_LIBRARY_PATH is         = /usr/local/greenplum-db-6.14.0/lib
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-HEAP_CHECKSUM is           = on
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-HBA_HOSTNAMES is           = 0
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Ulimit check               = Passed
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Array host connect type    = Single hostname per node
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [1]      = ::1
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [2]      = 10.10.10.101
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [3]      = 192.168.146.11
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [4]      = fd15:4ba5:5a2b:1008:a93e:2876:b5e:e559
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [5]      = fe80::78fb:9826:6938:f378
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [6]      = fe80::b52:55ee:9c55:43e1
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Standby Master             = Not Configured
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Number of primary segments = 2
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Total Database segments    = 6
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Trusted shell              = ssh
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Number segment hosts       = 3
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Mirror port base           = 50000
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Number of mirror segments  = 2
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Mirroring config           = ON
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Mirroring type             = Group
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:----------------------------------------
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Primary Segment Configuration
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:----------------------------------------
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1  40000   sdw1    /data01/gpdata/gpdatap1/gpseg0  2
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1  40001   sdw1    /data01/gpdata/gpdatap2/gpseg1  3
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2  40000   sdw2    /data01/gpdata/gpdatap1/gpseg2  4
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2  40001   sdw2    /data01/gpdata/gpdatap2/gpseg3  5
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw3  40000   sdw3    /data01/gpdata/gpdatap1/gpseg4  6
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw3  40001   sdw3    /data01/gpdata/gpdatap2/gpseg5  7
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Mirror Segment Configuration
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2  50000   sdw2    /data01/gpdata/gpdatam1/gpseg0  8
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2  50001   sdw2    /data01/gpdata/gpdatam2/gpseg1  9
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw3  50000   sdw3    /data01/gpdata/gpdatam1/gpseg2  10
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw3  50001   sdw3    /data01/gpdata/gpdatam2/gpseg3  11
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1  50000   sdw1    /data01/gpdata/gpdatam1/gpseg4  12
20210216:16:53:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1  50001   sdw1    /data01/gpdata/gpdatam2/gpseg5  13
Continue with Greenplum creation Yy|Nn (default=N):
> Y
20210216:16:53:52:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Building the Master instance database, please wait...
20210216:16:54:05:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Starting the Master in admin mode
20210216:16:54:14:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing parallel build of primary segment instances
20210216:16:54:14:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
......
20210216:16:54:14:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
..................
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Parallel process exit status
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as completed           = 6
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as killed              = 0
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as failed              = 0
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Deleting distributed backout files
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Removing back out file
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-No errors generated from parallel processes
20210216:16:54:33:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode
20210216:16:54:33:032559 gpstop:mdw:gpadmin-[INFO]:-Starting gpstop with args: -a -l /home/gpadmin/gpAdminLogs -m -d /data01/gpdata/gpmaster/gpseg-1
20210216:16:54:33:032559 gpstop:mdw:gpadmin-[INFO]:-Gathering information and validating the environment...
20210216:16:54:33:032559 gpstop:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20210216:16:54:33:032559 gpstop:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20210216:16:54:34:032559 gpstop:mdw:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 6.14.0 build commit:62d24f4a455276cab4bf2ca4538e96dcf58db8ba Open Source'
20210216:16:54:34:032559 gpstop:mdw:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='smart'
20210216:16:54:34:032559 gpstop:mdw:gpadmin-[INFO]:-Master segment instance directory=/data01/gpdata/gpmaster/gpseg-1
20210216:16:54:34:032559 gpstop:mdw:gpadmin-[INFO]:-Stopping master segment and waiting for user connections to finish ...
server shutting down
20210216:16:54:36:032559 gpstop:mdw:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process
20210216:16:54:36:032559 gpstop:mdw:gpadmin-[INFO]:-Terminating processes for segment /data01/gpdata/gpmaster/gpseg-1
20210216:16:54:36:032582 gpstart:mdw:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /data01/gpdata/gpmaster/gpseg-1
20210216:16:54:36:032582 gpstart:mdw:gpadmin-[INFO]:-Gathering information and validating the environment...
20210216:16:54:36:032582 gpstart:mdw:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 6.14.0 build commit:62d24f4a455276cab4bf2ca4538e96dcf58db8ba Open Source'
20210216:16:54:36:032582 gpstart:mdw:gpadmin-[INFO]:-Greenplum Catalog Version: '301908232'
20210216:16:54:36:032582 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance in admin mode
20210216:16:54:37:032582 gpstart:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20210216:16:54:37:032582 gpstart:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20210216:16:54:37:032582 gpstart:mdw:gpadmin-[INFO]:-Setting new master era
20210216:16:54:37:032582 gpstart:mdw:gpadmin-[INFO]:-Master Started...
20210216:16:54:38:032582 gpstart:mdw:gpadmin-[INFO]:-Shutting down master
20210216:16:54:38:032582 gpstart:mdw:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait...
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-Process results...
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-   Successful segment starts                                            = 6
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-   Failed segment starts                                                = 0
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 0
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-Successfully started 6 of 6 segment instances 
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20210216:16:54:39:032582 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance mdw directory /data01/gpdata/gpmaster/gpseg-1 
20210216:16:54:40:032582 gpstart:mdw:gpadmin-[INFO]:-Command pg_ctl reports Master mdw instance active
20210216:16:54:40:032582 gpstart:mdw:gpadmin-[INFO]:-Connecting to dbname='template1' connect_timeout=15
20210216:16:54:40:032582 gpstart:mdw:gpadmin-[INFO]:-No standby master configured.  skipping...
20210216:16:54:40:032582 gpstart:mdw:gpadmin-[INFO]:-Database successfully started
20210216:16:54:40:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode
20210216:16:54:40:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing parallel build of mirror segment instances
20210216:16:54:40:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
......
20210216:16:54:40:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
......
20210216:16:54:46:028176 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20210216:16:54:46:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Parallel process exit status
20210216:16:54:46:028176 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20210216:16:54:46:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as completed           = 6
20210216:16:54:46:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as killed              = 0
20210216:16:54:46:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as failed              = 0
20210216:16:54:46:028176 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Scanning utility log file for any warning messages
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Log file scan check passed
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database instance successfully created
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-To complete the environment configuration, please 
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-update gpadmin .bashrc file with the following
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/data01/gpdata/gpmaster/gpseg-1"
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-   to access the Greenplum scripts for this instance:
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-   or, use -d /data01/gpdata/gpmaster/gpseg-1 option for the Greenplum scripts
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-   Example gpstate -d /data01/gpdata/gpmaster/gpseg-1
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20210216.log
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Review options for gpinitstandby
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-The Master /data01/gpdata/gpmaster/gpseg-1/pg_hba.conf post gpinitsystem
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-has been configured to allow all hosts within this new
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-new array must be explicitly added to this file
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-located in the /usr/local/greenplum-db-6.14.0/docs directory
20210216:16:54:47:028176 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------

五、管理数据库

连接数据库

[gpadmin@mdw ~]$ psql -d postgres
psql (9.4.24)
Type "help" for help.
[gpadmin@mdw ~]$  createdb gpdb -E utf-8;
[gpadmin@mdw ~]$ psql
psql: FATAL:  database "gpadmin" does not exist
[gpadmin@mdw ~]$ export PGDATABASE=pgdb
[gpadmin@mdw ~]$ psql
psql: FATAL:  database "pgdb" does not exist
[gpadmin@mdw ~]$ vim .bash_profile
[gpadmin@mdw ~]$ source .bash_profile
[gpadmin@mdw ~]$ psql
psql (9.4.24)
Type "help" for help.
gpdb=# \l
                               List of databases
   Name    |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges  
-----------+---------+----------+------------+------------+---------------------
 gpdb      | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
 postgres  | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 template1 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
(4 rows)
gpdb=# select version();
                                                                                                      version                                                    
                                                  
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------
 PostgreSQL 9.4.24 (Greenplum Database 6.14.0 build commit:62d24f4a455276cab4bf2ca4538e96dcf58db8ba Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GC
C) 6.4.0, 64-bit compiled on Feb  5 2021 18:58:52
(1 row)
gpdb=# 
设置 gpadmin 远程访问密码
[gpadmin@mdw ~]$ psql postgres gpadmin
psql (9.4.24)
Type "help" for help.
postgres=# alter user gpadmin encrypted password 'gpadmin';
ALTER ROLE
postgres=# \q

查询测试

[gpadmin@mdw ~]$ psql -hmdw -p 5432 -d postgres -U gpadmin -c 'select dfhostname, dfspace,dfdevice from gp_toolkit.gp_disk_free order by dfhostname;'
 dfhostname | dfspace  |          dfdevice          
------------+----------+----------------------------
  sdw1      | 28867412 |  /dev/mapper/centos-data01
  sdw1      | 28867412 |  /dev/mapper/centos-data01
  sdw2      | 29538564 |  /dev/mapper/centos-data01
  sdw2      | 29538564 |  /dev/mapper/centos-data01
  sdw3      | 29539640 |  /dev/mapper/centos-data01
  sdw3      | 29539640 |  /dev/mapper/centos-data01
(6 rows)
[gpadmin@mdw ~]$ psql -h mdw -p 5432 -d postgres -U gpadmin -c '\l+'
                                                                 List of databases
   Name    |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges  |  Size  | Tablespace |                Description                 
-----------+---------+----------+------------+------------+---------------------+--------+------------+--------------------------------------------
 gpdb      | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 |                     | 116 MB | pg_default | 
 postgres  | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 |                     | 115 MB | pg_default | default administrative connection database
 template0 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +| 114 MB | pg_default | unmodifiable empty database
           |         |          |            |            | gpadmin=CTc/gpadmin |        |            | 
 template1 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +| 115 MB | pg_default | default template for new databases
           |         |          |            |            | gpadmin=CTc/gpadmin |        |            | 
(4 rows)

[gpadmin@mdw ~]$ 

启停数据库,在 mdw 执行 

在 master 节点 gpadmin 用户执行 gpstart -a 启动集群,不加 a 需要输入 yes 确认。

在 master 节点 gpadmin 用户执行 gpstop -a 关闭集群,不加 a 需要输入 yes 确认。

[gpadmin@mdw ~]$  gpstate
20210216:17:36:07:034610 gpstate:mdw:gpadmin-[INFO]:-Starting gpstate with args: 
20210216:17:36:07:034610 gpstate:mdw:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.14.0 build commit:62d24f4a455276cab4bf2ca4538e96dcf58db8ba Open Source'
20210216:17:36:07:034610 gpstate:mdw:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.14.0 build commit:62d24f4a455276cab4bf2ca4538e96dcf58db8ba Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Feb  5 2021 18:58:52'
20210216:17:36:07:034610 gpstate:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-Gathering data from segments...
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-Greenplum instance status summary
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Master instance                                           = Active
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Master standby                                            = No master standby configured
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total segment instance count from metadata                = 12
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Primary Segment Status
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total primary segments                                    = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total primary segment valid (at master)                   = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total primary segment failures (at master)                = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number postmaster processes found                   = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Mirror Segment Status
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total mirror segments                                     = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total mirror segment valid (at master)                    = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total mirror segment failures (at master)                 = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number postmaster processes found                   = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number mirror segments acting as primary segments   = 0
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-   Total number mirror segments acting as mirror segments    = 6
20210216:17:36:08:034610 gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
[gpadmin@mdw ~]$


VPS岛 的文章和资源来自互联网,仅作为参考资料,如果有侵犯版权的资源请尽快联系站长,我们会在24h内删除有争议的资源。丨 转载请注明Centos7安装GreenPlum6.14 集群实战
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址