美文网首页
CentOS 7 部署 Greenplum 5.24.2

CentOS 7 部署 Greenplum 5.24.2

作者: 白面葫芦娃92 | 来源:发表于2020-03-15 00:15 被阅读0次

    1.准备工作

    每台机器都需要

    [root@hadoop001 ~]# yum install -y sed
    [root@hadoop001 ~]# yum install -y tar
    [root@hadoop001 ~]# yum install -y perl
    

    2.配置系统信息

    2.1 配置系统信息,做安装Greenplum的准备工作

    Greenplum 数据库版本5.24.2
    Linux系统版本 CentOS7.5 64bit

    2.1.1 Greenplum集群介绍

    这里使用1个master,2个segment的集群,ip为:
    172.26.183.103
    172.26.183.101
    172.26.183.102
    其中172.26.183.103为master,其余为segment。

    2.1.2 修改/etc/hosts文件(所有的机器都要修改)

    这里主要是为之后Greenplum能够在各个节点之间相互通信做准备,添加如下:
    格式为:主机ip地址 主机名

    [root@hadoop001 ~]# cat /etc/hosts
    172.26.183.103  hadoop001       hadoop001
    172.26.183.101  hadoop002       hadoop002
    172.26.183.102  hadoop003       hadoop003
    

    注意:一定要按照这个格式写,参数代表的含义,上面已经做出说明。
    配置了这个文件之后,需要继续修改hostname,即修改/etc/sysconfig/network这个文件
    如下(所有机器都要修改):

    [root@hadoop001 ~]# vi /etc/sysconfig/network
    # Created by anaconda
    
    NETWORKING=yes
    HOSTNAME=hadoop001
    

    注意:这里修改hostname,需要重启之后方可生效,如需立即生效,需使用hostname命令。
    [root@hadoop001 ~]# hostname
    这里的HOSTNAME一定要与/etc/hosts中的主机名一致,最终可以使用ping命令测试是否配置好了:

    [root@hadoop001 ~]# ping hadoop002
    [root@hadoop001 ~]# ping hadoop003
    

    一定要使用主机名来测试,使用ip地址测试无效。

    2.1.3 创建用户和用户组(所有机器都要创建)
    [root@hadoop001 ~]# groupadd -g 530 gpadmin
    [root@hadoop001 ~]# useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin
    [root@hadoop001 ~]# chown -R gpadmin:gpadmin /home/gpadmin
    [root@hadoop001 greenplum]# passwd gpadmin
    #此处密码设置为:gpadmin
    
    2.1.4 修改系统内核(所有的机器都要修改)
    [root@hadoop001 ~]# vi /etc/sysctl.conf
    # GP 
    kernel.shmmax = 500000000
    kernel.shmmni = 4096
    kernel.shmall = 4000000000
    kernel.sem = 250 512000 100 2048
    kernel.sysrq = 1
    kernel.core_uses_pid = 1
    kernel.msgmnb = 65536
    kernel.msgmax = 65536
    kernel.msgmni = 2048
    net.ipv4.tcp_syncookies = 1
    net.ipv4.ip_forward = 0
    net.ipv4.conf.default.accept_source_route = 0
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_max_syn_backlog = 4096
    net.ipv4.conf.all.arp_filter = 1
    net.ipv4.conf.default.rp_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
    

    执行以下命令使参数生效:

    [root@hadoop001 ~]# sysctl -p
    

    注意:每台机器都要修改,不然就会初始化不成功。

    2.1.5 修改文件打开限制(每台机器都要修改):
    [root@hadoop001 ~]# vi /etc/security/limits.conf
    * soft nofile 65536
    * hard nofile 65536
    * soft nproc 131072
    * hard nproc 131072
    

    在这个文件末尾,添加上面四行就可以了。

    2.1.6 关闭防火墙(每台机器都要)
    [root@hadoop001 ~]# service iptables stop
    

    除此之外,还需关闭SELINUX

    [root@hadoop001 ~]# cat /etc/selinux/config
    
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=disabled
    # SELINUXTYPE= can take one of three two values:
    #     targeted - Targeted processes are protected,
    #     minimum - Modification of targeted policy. Only selected processes are protected. 
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    

    好了现在准备工作已经做好了,可以开始安装Greenplum了。

    3 安装Greenplum

    3.1 创建安装文件目录(每台机器都需要创建)

    [root@hadoop001 ~]# mkdir -p /opt/greenplum
    [root@hadoop001 ~]# chown -R gpadmin:gpadmin /opt/greenplum
    

    之后安装文件,就放在这个目录下面

    3.2 下载安装包

    官网 https://network.pivotal.io/products/pivotal-gpdb
    注意:下载安装包之前,需要在官网注册账号,方可下载。

    3.3 master上安装Greenplum(只需master即可)

    上传Greenplum的安装文件greenplum-db-5.24.2-rhel7-x86_64.zip并解压缩。(需要联网权限)

    [root@hadoop001 ~]# cd /opt/greenplum
    [root@hadoop001 greenplum]# rz
    [root@hadoop001 greenplum]# ll
    total 274132
    -rw-r--r-- 1 root root 280705026 Mar 12 17:37 greenplum-db-5.24.2-rhel7-x86_64.zip
    [root@hadoop001 greenplum]# unzip ./greenplum-db-5.24.2-rhel7-x86_64.zip
    [root@hadoop001 greenplum]# ll
    total 550756
    -rwxr-xr-x 1 root root 283260764 Jan 31 02:36 greenplum-db-5.24.2-rhel7-x86_64.bin
    -rw-r--r-- 1 root root 280705026 Mar 12 17:37 greenplum-db-5.24.2-rhel7-x86_64.zip
    

    在root用户下,将下载的文件放在CentOS系统中自己能找到的位置即可,给该文件赋予可执行权限,之后执行该文件,即开始安装

    [root@hadoop001 greenplum]# chmod +x greenplum-db-5.24.2-rhel7-x86_64.bin
    [root@hadoop001 greenplum]# ./greenplum-db-5.24.2-rhel7-x86_64.bin
    

    期间需要修改默认安装目录,输入 /opt/greenplum//greenplum-db-5.24.2之后即可安装成功(yes 后面的第二次提示),此时master上的Greenplum安装成功了。
    安装完成后的提示:

    ********************************************************************************
    Installation complete.
    Greenplum Database is installed in /opt/greenplum//greenplum-db-5.24.2
    
    Pivotal Greenplum documentation is available
    for download at http://gpdb.docs.pivotal.io
    ********************************************************************************
    

    但是之前我们都是以root身份安装的,所以要将安装目录下的文件的所有者,都修改为gpadmin。

    [root@hadoop001 greenplum]# chown -R gpadmin:gpadmin /opt/greenplum
    

    因为只在master上安装了Greenplum,所以接下来要将安装包批量发送到每个segment上,才能算是整个集群完整安装了Greenplum。
    下面的操作都是为了连接所有节点,并将安装包发送到每个节点

    3.4 创建配置文件

    [root@hadoop001 greenplum]# su - gpadmin
    [gpadmin@hadoop001 ~]$ ll
    total 0
    [gpadmin@hadoop001 ~]$ mkdir conf
    [gpadmin@hadoop001 ~]$ ll
    total 4
    drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 22:57 conf
    [gpadmin@hadoop001 ~]$ cd conf
    [gpadmin@hadoop001 conf]$ vi hostlist
    hadoop001
    hadoop002
    hadoop003
    [gpadmin@hadoop001 conf]$ vi seg_hosts
    hadoop002
    hadoop003
    [gpadmin@hadoop001 conf]$ ll
    total 8
    -rw-rw-r-- 1 gpadmin gpadmin 30 Mar 13 22:58 hostlist
    -rw-rw-r-- 1 gpadmin gpadmin 30 Mar 13 23:05 seg_hosts
    

    注意:此时需要转换成gpadmin身份来操作了,按照上面的文件内容创建hostlist和seg_hosts文件备用。
    hostlist存储了所有节点的主机名,seg_hosts存储了所有从节点的主机名。
    这里文件中的hadoop001、hadoop002、hadoop003
    即为之前在 /etc/hosts文件中配置的最后一个参数。

    3.5 打通所有节点

    greenplum_path.sh中保存了运行Greenplum的一些环境变量设置,包括GPHOOME、PYTHONHOME等设置。

    [gpadmin@hadoop001 ~]$ source /opt/greenplum/greenplum-db/greenplum_path.sh
    [gpadmin@hadoop001 ~]$ gpssh-exkeys -f /home/gpadmin/conf/hostlist
    [STEP 1 of 5] create local ID and authorize on local host
      ... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped
    
    [STEP 2 of 5] keyscan all hosts and update known_hosts file
    
    [STEP 3 of 5] authorize current user on remote hosts
      ... send to hadoop002
      ***
      *** Enter password for hadoop002: 
      ... send to hadoop003
    
    [STEP 4 of 5] determine common authentication file content
    
    [STEP 5 of 5] copy authentication files to all remote hosts
      ... finished key exchange with hadoop002
      ... finished key exchange with hadoop003
    
    [INFO] completed successfully
    

    注意:
    (1)首次执行gpssh-exkeys命令时,在[STEP 3 of 5],要输入每个segment节点的gpadmin用户的密码。
    (2)gpssh-exkeys命令使用的时候一定要用gpadmin身份,因为这个命令会生成ssh的免密码登录的秘钥,在/home/gpadmin/.ssh这里。如果以root身份使用gpssh-exkeys命令,那么生成的.ssh秘钥在root的home下面或者是在/home/gpadmin下面但是是root的所有者,如果之后使用gpadmin身份执行相应操作的时候就没有权限。
    [INFO] completed successfully 这就说明成功打通了,之后就可以使用下面的命令开启批量操作,如下:

    [gpadmin@hadoop001 ~]$ gpssh -f /home/gpadmin/conf/hostlist
    => pwd
    [hadoop001] /home/gpadmin
    [hadoop003] /home/gpadmin
    [hadoop002] /home/gpadmin
    => exit
    

    这里pwd命令是linux中的查看路径命令,这里也是查看一下批量操作时所处的位置,从中可以看到同时连接到了3个节点。这里如果/etc/hosts文件中参数只设置了两个,没有设置主机名,就只能同时连接2个节点,而且是随机的。
    这里我们只是测试一下,exit之后先做一些其他的操作。

    3.6 将安装包分发到每个子节点

    打通之后需要将master中的greenplum安装包批量复制到各个segment节点上。
    打包:

    [gpadmin@hadoop001 ~]$ cd /opt/greenplum/
    [gpadmin@hadoop001 greenplum]$ tar -cf gp-5.24.tar ./greenplum-db-5.24.2/
    [gpadmin@hadoop001 greenplum]$ ll
    total 1238124
    -rw-rw-r--  1 gpadmin gpadmin 703856640 Mar 13 23:17 gp-5.24.tar
    lrwxrwxrwx  1 gpadmin gpadmin        21 Mar 13 22:52 greenplum-db -> greenplum-db-5.24.2
    drwxr-xr-x 11 gpadmin gpadmin      4096 Mar 13 22:52 greenplum-db-5.24.2
    -rwxr-xr-x  1 gpadmin gpadmin 283260764 Jan 31 02:36 greenplum-db-5.24.2-rhel7-x86_64.bin
    -rw-r--r--  1 gpadmin gpadmin 280705026 Mar 12 17:37 greenplum-db-5.24.2-rhel7-x86_64.zip
    

    然后利用gpscp命令将这个文件复制到每一台机器上:

    [gpadmin@hadoop001 greenplum]$ gpscp -f /home/gpadmin/conf/seg_hosts gp-5.24.tar =:/opt/greenplum/
    

    如果没有意外,就批量复制成功了,可以去子节点的相应文件夹查看,之后要将tar包解压,我们使用批量操作。

    [gpadmin@hadoop001 greenplum]$ cd ~/conf/
    [gpadmin@hadoop001 conf]$ gpssh -f seg_hosts
    => cd /opt/greenplum
    [hadoop003]
    [hadoop002]
    => tar -xf gp-5.24.tar
    [hadoop003]
    [hadoop002]
    #建立软链接
    => ln -s greenplum-db-5.24.2 greenplum-db
    [hadoop003]
    [hadoop002]
    => ll
    [hadoop003] total 687368
    [hadoop003] -rw-rw-r--  1 gpadmin gpadmin 703856640 Mar 13 23:24 gp-5.24.tar
    [hadoop003] lrwxrwxrwx  1 gpadmin gpadmin        21 Mar 13 23:26 greenplum-db -> ./greenplum-db-5.24.2
    [hadoop003] drwxr-xr-x 11 gpadmin gpadmin      4096 Mar 13 22:52 greenplum-db-5.24.2
    [hadoop002] total 687368
    [hadoop002] -rw-rw-r--  1 gpadmin gpadmin 703856640 Mar 13 23:24 gp-5.24.tar
    [hadoop002] lrwxrwxrwx  1 gpadmin gpadmin        21 Mar 13 23:26 greenplum-db -> ./greenplum-db-5.24.2
    [hadoop002] drwxr-xr-x 11 gpadmin gpadmin      4096 Mar 13 22:52 greenplum-db-5.24.2
    #(可以使用ll查看一下是否已经安装成功)
    => exit
    

    这样就完成了所有节点的安装。

    4. 初始化数据库

    在初始化之前的的几个步骤都是做一些准备工作。

    4.1 批量创建Greenplum数据存放目录

    [gpadmin@hadoop001 conf]$ gpssh -f hostlist
    => mkdir gpdata
    [hadoop002]
    [hadoop001]
    [hadoop003]
    => cd gpdata
    [hadoop002]
    [hadoop001]
    [hadoop003]
    => mkdir gpmaster gpdatap1 gpdatap2 gpdatam1 gpdatam2
    [hadoop002]
    [hadoop001]
    [hadoop003]
    => ll
    [hadoop002] total 20
    [hadoop002] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatam1
    [hadoop002] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatam2
    [hadoop002] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatap1
    [hadoop002] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatap2
    [hadoop002] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpmaster
    [hadoop001] total 20
    [hadoop001] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatam1
    [hadoop001] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatam2
    [hadoop001] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatap1
    [hadoop001] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatap2
    [hadoop001] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpmaster
    [hadoop003] total 20
    [hadoop003] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatam1
    [hadoop003] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatam2
    [hadoop003] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatap1
    [hadoop003] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpdatap2
    [hadoop003] drwxrwxr-x 2 gpadmin gpadmin 4096 Mar 13 23:29 gpmaster
    => exit
    

    4.2 配置.bash_profile环境变量(每台机器都要)

    编辑.bash_profile文件,添加以下内容:

    [gpadmin@hadoop001 conf]$ cd
    [gpadmin@hadoop001 ~]$ vi .bash_profile
    source /opt/greenplum/greenplum-db/greenplum_path.sh
    export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/gpmaster/gpseg-1
    export PGPORT=5432
    #export PGDATABASE=testDB
    export PGDATABASE=postgres
    
    [gpadmin@hadoop001 ~]$ source .bash_profile
    

    注意:PGPORT指的是你安装greenplum数据库的端口号。

    这里有个问题,Greenplum自己会安装一个Python包,是2.6.6的。而CentOS6.5本身自带有一个Python包,是2.6.2的,设置了以上的环境变量了之后,使用yum安装一些软件的时候就会出现问题(因为yum是基于Python的),因为系统就发现自己有两个Python包,他不知道用哪一个了。我还没有试过更新系统的Python包,需要安装软件的时候,我就将环境变量都注释掉,安装完之后再让他生效。

    4.3 创建初始化配置文件(只需master即可)

    [gpadmin@hadoop001 ~]$ vi /home/gpadmin/conf/gpinitsystem_config
    # FILE NAME: gpinitsystem_config
    
    # Configuration file needed by the gpinitsystem
    
    ################################################
    #### REQUIRED PARAMETERS
    ################################################
    
    #### Name of this Greenplum system enclosed in quotes.
    ARRAY_NAME="Greenplum"
    
    #### Naming convention for utility-generated data directories.
    SEG_PREFIX=gpseg
    
    #### Base number by which primary segment port numbers 
    #### are calculated.
    PORT_BASE=40000
    
    #### File system location(s) where primary segment data directories 
    #### will be created. The number of locations in the list dictate
    #### the number of primary segments that will get created per
    #### physical host (if multiple addresses for a host are listed in 
    #### the hostfile, the number of segments will be spread evenly across
    #### the specified interface addresses).
    declare -a DATA_DIRECTORY=(/home/gpadmin/gpdata/gpdatap1 /home/gpadmin/gpdata/gpdatap2)
    
    #### OS-configured hostname or IP address of the master host.
    MASTER_HOSTNAME=hadoop001
    
    #### File system location where the master data directory 
    #### will be created.
    MASTER_DIRECTORY=/home/gpadmin/gpdata/gpmaster
    
    #### Port number for the master instance. 
    MASTER_PORT=5432
    
    #### Shell utility used to connect to remote hosts.
    TRUSTED_SHELL=ssh
    
    #### Maximum log file segments between automatic WAL checkpoints.
    CHECK_POINT_SEGMENTS=8
    
    #### Default server-side character set encoding.
    ENCODING=UNICODE
    
    ################################################
    #### OPTIONAL MIRROR PARAMETERS
    ################################################
    
    #### Base number by which mirror segment port numbers 
    #### are calculated.
    MIRROR_PORT_BASE=43000
    
    #### Base number by which primary file replication port 
    #### numbers are calculated.
    REPLICATION_PORT_BASE=41000
    
    #### Base number by which mirror file replication port 
    #### numbers are calculated. 
    MIRROR_REPLICATION_PORT_BASE=51000
    
    #### File system location(s) where mirror segment data directories 
    #### will be created. The number of mirror locations must equal the
    #### number of primary locations as specified in the 
    #### DATA_DIRECTORY parameter.
    declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/gpdata/gpdatam1 /home/gpadmin/gpdata/gpdatam2)
    
    
    ################################################
    #### OTHER OPTIONAL PARAMETERS
    ################################################
    
    #### Create a database of this name after initialization.
    #DATABASE_NAME=postgres(这一行要注释掉,不然初始化时会失败)
    
    #### Specify the location of the host address file here instead of
    #### with the the -h option of gpinitsystem.
    MACHINE_LIST_FILE=/home/gpadmin/conf/seg_hosts
    

    4.4 初始化数据库(只需master即可)

    [gpadmin@hadoop001 ~]$ gpinitsystem -c /home/gpadmin/conf/gpinitsystem_config -h /home/gpadmin/conf/seg_hosts
    
    20200314:15:32:09:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Checking configuration parameters, please wait...
    20200314:15:32:09:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Reading Greenplum configuration file /home/gpadmin/conf/gpinitsystem_config
    20200314:15:32:09:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Locale has not been set in /home/gpadmin/conf/gpinitsystem_config, will set to default value
    20200314:15:32:09:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Locale set to en_US.utf8
    20200314:15:32:09:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
    20200314:15:32:09:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
    20200314:15:32:09:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Checking configuration parameters, Completed
    20200314:15:32:09:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Commencing multi-home checks, please wait...
    ..
    20200314:15:32:10:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Configuring build for standard array
    20200314:15:32:10:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Commencing multi-home checks, Completed
    20200314:15:32:10:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Building primary segment instance array, please wait...
    ....
    20200314:15:32:11:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Building group mirror array type , please wait...
    ....
    20200314:15:32:12:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Checking Master host
    20200314:15:32:12:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Checking new segment hosts, please wait...
    ........
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Checking new segment hosts, Completed
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Greenplum Database Creation Parameters
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:---------------------------------------
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master Configuration
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:---------------------------------------
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master instance name       = Greenplum
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master hostname            = hadoop001
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master port                = 5432
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master instance dir        = /home/gpadmin/gpdata/gpmaster/gpseg-1
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master LOCALE              = en_US.utf8
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Greenplum segment prefix   = gpseg
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master Database            = 
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master connections         = 250
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master buffers             = 128000kB
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Segment connections        = 750
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Segment buffers            = 128000kB
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Checkpoint segments        = 8
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Encoding                   = UNICODE
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Postgres param file        = Off
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Initdb to be used          = /opt/greenplum//greenplum-db-5.24.2/bin/initdb
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-GP_LIBRARY_PATH is         = /opt/greenplum//greenplum-db-5.24.2/lib
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-HEAP_CHECKSUM is           = on
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-HBA_HOSTNAMES is           = 0
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Ulimit check               = Passed
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Array host connect type    = Single hostname per node
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Master IP address [1]      = 172.26.183.103
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Standby Master             = Not Configured
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Primary segment #          = 2
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Total Database segments    = 4
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Trusted shell              = ssh
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Number segment hosts       = 2
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Mirror port base           = 43000
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Replicaton port base       = 41000
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Mirror replicaton port base= 51000
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Mirror segment #           = 2
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Mirroring config           = ON
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Mirroring type             = Group
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:----------------------------------------
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Greenplum Primary Segment Configuration
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:----------------------------------------
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-hadoop002   /home/gpadmin/gpdata/gpdatap1/gpseg0    40000   2   0   41000
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-hadoop002   /home/gpadmin/gpdata/gpdatap2/gpseg1    40001   3   1   41001
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-hadoop003   /home/gpadmin/gpdata/gpdatap1/gpseg2    40000   4   2   41000
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-hadoop003   /home/gpadmin/gpdata/gpdatap2/gpseg3    40001   5   3   41001
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:---------------------------------------
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Greenplum Mirror Segment Configuration
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:---------------------------------------
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-hadoop003   /home/gpadmin/gpdata/gpdatam1/gpseg0    43000   6   0   51000
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-hadoop003   /home/gpadmin/gpdata/gpdatam2/gpseg1    43001   7   1   51001
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-hadoop002   /home/gpadmin/gpdata/gpdatam1/gpseg2    43000   8   2   51000
    20200314:15:32:18:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-hadoop002   /home/gpadmin/gpdata/gpdatam2/gpseg3    43001   9   3   51001
    
    Continue with Greenplum creation Yy|Nn (default=N):
    > y
    20200314:15:32:20:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Building the Master instance database, please wait...
    20200314:15:32:26:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Starting the Master in admin mode
    20200314:15:32:31:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Commencing parallel build of primary segment instances
    20200314:15:32:31:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
    ....
    20200314:15:32:31:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
    ................
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:------------------------------------------------
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Parallel process exit status
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:------------------------------------------------
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Total processes marked as completed           = 4
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Total processes marked as killed              = 0
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Total processes marked as failed              = 0
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:------------------------------------------------
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Commencing parallel build of mirror segment instances
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
    ....
    20200314:15:32:47:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
    ........
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:------------------------------------------------
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Parallel process exit status
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:------------------------------------------------
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Total processes marked as completed           = 4
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Total processes marked as killed              = 0
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Total processes marked as failed              = 0
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:------------------------------------------------
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Deleting distributed backout files
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Removing back out file
    20200314:15:32:55:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-No errors generated from parallel processes
    20200314:15:32:56:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Starting gpstop with args: -a -l /home/gpadmin/gpAdminLogs -i -m -d /home/gpadmin/gpdata/gpmaster/gpseg-1
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Gathering information and validating the environment...
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Obtaining Segment details from master...
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7'
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-There are 0 connections to the database
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='immediate'
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Master host=hadoop001
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate
    20200314:15:32:56:025372 gpstop:hadoop001:gpadmin-[INFO]:-Master segment instance directory=/home/gpadmin/gpdata/gpmaster/gpseg-1
    20200314:15:32:57:025372 gpstop:hadoop001:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process
    20200314:15:32:57:025372 gpstop:hadoop001:gpadmin-[INFO]:-Terminating processes for segment /home/gpadmin/gpdata/gpmaster/gpseg-1
    20200314:15:32:57:025399 gpstart:hadoop001:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /home/gpadmin/gpdata/gpmaster/gpseg-1
    20200314:15:32:57:025399 gpstart:hadoop001:gpadmin-[INFO]:-Gathering information and validating the environment...
    20200314:15:32:57:025399 gpstart:hadoop001:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7'
    20200314:15:32:57:025399 gpstart:hadoop001:gpadmin-[INFO]:-Greenplum Catalog Version: '301705051'
    20200314:15:32:57:025399 gpstart:hadoop001:gpadmin-[INFO]:-Starting Master instance in admin mode
    20200314:15:32:58:025399 gpstart:hadoop001:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
    20200314:15:32:58:025399 gpstart:hadoop001:gpadmin-[INFO]:-Obtaining Segment details from master...
    20200314:15:32:58:025399 gpstart:hadoop001:gpadmin-[INFO]:-Setting new master era
    20200314:15:32:58:025399 gpstart:hadoop001:gpadmin-[INFO]:-Master Started...
    20200314:15:32:58:025399 gpstart:hadoop001:gpadmin-[INFO]:-Shutting down master
    20200314:15:32:59:025399 gpstart:hadoop001:gpadmin-[INFO]:-Commencing parallel primary and mirror segment instance startup, please wait...
    .... 
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-Process results...
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-   Successful segment starts                                            = 8
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-   Failed segment starts                                                = 0
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 0
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-Successfully started 8 of 8 segment instances 
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    20200314:15:33:03:025399 gpstart:hadoop001:gpadmin-[INFO]:-Starting Master instance hadoop001 directory /home/gpadmin/gpdata/gpmaster/gpseg-1 
    20200314:15:33:04:025399 gpstart:hadoop001:gpadmin-[INFO]:-Command pg_ctl reports Master hadoop001 instance active
    20200314:15:33:04:025399 gpstart:hadoop001:gpadmin-[INFO]:-No standby master configured.  skipping...
    20200314:15:33:04:025399 gpstart:hadoop001:gpadmin-[INFO]:-Database successfully started
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Scanning utility log file for any warning messages
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[WARN]:-*******************************************************
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[WARN]:-Scan of log file indicates that some warnings or errors
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[WARN]:-were generated during the array creation
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Please review contents of log file
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20200314.log
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-To determine level of criticality
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-These messages could be from a previous run of the utility
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-that was called today!
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[WARN]:-*******************************************************
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Greenplum Database instance successfully created
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-------------------------------------------------------
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-To complete the environment configuration, please 
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-update gpadmin .bashrc file with the following
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/gpmaster/gpseg-1"
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-   to access the Greenplum scripts for this instance:
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-   or, use -d /home/gpadmin/gpdata/gpmaster/gpseg-1 option for the Greenplum scripts
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-   Example gpstate -d /home/gpadmin/gpdata/gpmaster/gpseg-1
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20200314.log
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Review options for gpinitstandby
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-------------------------------------------------------
    20200314:15:33:04:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-The Master /home/gpadmin/gpdata/gpmaster/gpseg-1/pg_hba.conf post gpinitsystem
    20200314:15:33:05:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-has been configured to allow all hosts within this new
    20200314:15:33:05:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
    20200314:15:33:05:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-new array must be explicitly added to this file
    20200314:15:33:05:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
    20200314:15:33:05:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-located in the /opt/greenplum//greenplum-db-5.24.2/docs directory
    20200314:15:33:05:020660 gpinitsystem:hadoop001:gpadmin-[INFO]:-------------------------------------------------------
    

    注意:如果上面有一些配置有问题,gpinitsystem就不能成功,日志在主节点/home/gpadmin/gpAdminLogs/的gpinitsystem_2020XXXX.log文件中。
    需要注意的是如果初始化失败,一定要认真查看这个日志文件,一味重复安装没有太大意义,重要的是要找到主要原因。

    5. 测试运行安装的Greenplum数据库

    5.1 启动和停止数据库测试是否能正常启动和关闭

    [gpadmin@hadoop001 ~]$ gpstart
    [gpadmin@hadoop001 ~]$ gpstop
    

    5.2 访问数据库

    [gpadmin@hadoop001 ~]$ psql -d postgres
    psql (8.3.23)
    Type "help" for help.
    
    postgres=# 
    

    出现以上界面,恭喜你已经安装成功了。
    输入查询语句,查看是否可以执行。

    postgres=# select datname,datdba,encoding,datacl from pg_database; 
      datname  | datdba | encoding |              datacl              
    -----------+--------+----------+----------------------------------
     template1 |     10 |        6 | {=c/gpadmin,gpadmin=CTc/gpadmin}
     template0 |     10 |        6 | {=c/gpadmin,gpadmin=CTc/gpadmin}
     postgres  |     10 |        6 | 
    (3 rows)
    #修改密码
    postgres=# alter user gpadmin with password 'gpadmin';
     #退出
    postgres=# \q
    

    5.3 常用命令

    gpstate -e #查看mirror的状态
    gpstate -f #查看standby master的状态
    gpstate -s #查看整个GP群集的状态
    gpstate -i #查看GP的版本
    gpstate --help #帮助文档,可以查看gpstate更多用法

    [gpadmin@hadoop001 ~]$ gpstate
    20200314:15:45:58:026614 gpstate:hadoop001:gpadmin-[INFO]:-Starting gpstate with args: 
    20200314:15:45:58:026614 gpstate:hadoop001:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7'
    20200314:15:45:58:026614 gpstate:hadoop001:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51'
    20200314:15:45:58:026614 gpstate:hadoop001:gpadmin-[INFO]:-Obtaining Segment details from master...
    20200314:15:45:58:026614 gpstate:hadoop001:gpadmin-[INFO]:-Gathering data from segments...
    . 
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-Greenplum instance status summary
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Master instance                                           = Active
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Master standby                                            = No master standby configured
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total segment instance count from metadata                = 8
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Primary Segment Status
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total primary segments                                    = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total primary segment valid (at master)                   = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total primary segment failures (at master)                = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number postmaster processes found                   = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Mirror Segment Status
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total mirror segments                                     = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total mirror segment valid (at master)                    = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total mirror segment failures (at master)                 = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number postmaster processes found                   = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number mirror segments acting as primary segments   = 0
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-   Total number mirror segments acting as mirror segments    = 4
    20200314:15:45:59:026614 gpstate:hadoop001:gpadmin-[INFO]:-----------------------------------------------------
    
    [gpadmin@hadoop001 ~]$ gpstate -i
    20200314:15:48:00:026812 gpstate:hadoop001:gpadmin-[INFO]:-Starting gpstate with args: -i
    20200314:15:48:00:026812 gpstate:hadoop001:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7'
    20200314:15:48:00:026812 gpstate:hadoop001:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51'
    20200314:15:48:00:026812 gpstate:hadoop001:gpadmin-[INFO]:-Obtaining Segment details from master...
    20200314:15:48:00:026812 gpstate:hadoop001:gpadmin-[INFO]:-Loading version information
    . 
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   Host        Datadir                                 Port    Version                                                                                                                                                                                                
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop001   /home/gpadmin/gpdata/gpmaster/gpseg-1   5432    PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop002   /home/gpadmin/gpdata/gpdatap1/gpseg0    40000   PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop003   /home/gpadmin/gpdata/gpdatam1/gpseg0    43000   PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop002   /home/gpadmin/gpdata/gpdatap2/gpseg1    40001   PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop003   /home/gpadmin/gpdata/gpdatam2/gpseg1    43001   PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop003   /home/gpadmin/gpdata/gpdatap1/gpseg2    40000   PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop002   /home/gpadmin/gpdata/gpdatam1/gpseg2    43000   PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop003   /home/gpadmin/gpdata/gpdatap2/gpseg3    40001   PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-   hadoop002   /home/gpadmin/gpdata/gpdatam2/gpseg3    43001   PostgreSQL 8.3.23 (Greenplum Database 5.24.2 build commit:09e162b11223fed0963d3d81d32f93168d082da7) on x86_64-pc-linux-gnu, compiled by GCC gcc (GCC) 6.2.0, 64-bit compiled on Jan 30 2020 18:17:51
    20200314:15:48:01:026812 gpstate:hadoop001:gpadmin-[INFO]:-All segments are running the same software version
    

    5.4 简单测试

    postgres=# create database sample;
    CREATE DATABASE
    postgres=# \c sample;
    You are now connected to database "sample" as user "gpadmin".
    sample=# select datname,datdba,encoding,datacl from pg_database;
      datname  | datdba | encoding |              datacl              
    -----------+--------+----------+----------------------------------
     template1 |     10 |        6 | {=c/gpadmin,gpadmin=CTc/gpadmin}
     template0 |     10 |        6 | {=c/gpadmin,gpadmin=CTc/gpadmin}
     postgres  |     10 |        6 | 
     sample    |     10 |        6 | 
    (4 rows)
    
    sample=# create table t1(c1 int) distributed by (c1);
    CREATE TABLE
    sample=# insert into t1 select * from generate_series(1,1000);
    INSERT 0 1000
    sample=# select count(*) from t1;
     count 
    -------
      1000
    (1 row)
    

    6 项目测试环境连接信息

    6.1 greenplum访问信息:

    地址:172.26.183.103
    端口:5432
    初始数据库:postgres
    用户:gpadmin
    密码:gpadmin

    参考链接:

    https://www.cnblogs.com/jnba/p/10528220.html
    https://jingyan.baidu.com/article/7082dc1c2c02b2e40a89bda4.html
    https://www.cnblogs.com/ruanjianlaowang/p/11182526.html

    相关文章

      网友评论

          本文标题:CentOS 7 部署 Greenplum 5.24.2

          本文链接:https://www.haomeiwen.com/subject/tsxishtx.html