千家信息网

Greenplu数据库的部署

发表于:2025-02-03 作者:千家信息网编辑
千家信息网最后更新 2025年02月03日,简单介绍Greenplum基于postgre数据库开发,是一个关系型数据库集群,它实际上是由多个postgre数据库服务组合成的逻辑数据库集群。它包含两个角色,master和segment。它将一个表
千家信息网最后更新 2025年02月03日Greenplu数据库的部署

简单介绍

Greenplum基于postgre数据库开发,是一个关系型数据库集群,它实际上是由多个postgre数据库服务组合成的逻辑数据库集群。它包含两个角色,master和segment。它将一个表的数据均匀分布在segmeng上,实现了快速的海量并行运算。Greenplum在海量数据的处理方面性能十分强大。

master和segment的角色,可以参考如下表格:

本文章中,主要介绍Greenplum的安装。


安装环境


角色

主机名

IP地址

OS

maser

gpdb_m

192.168.204.138

CentOS7.4

segment

gpdb_seg1

192.168.204.139

CentOS7.4

segment

gpdb_seg2

192.168.204.140

CentOS7.4



安装步骤


1:配置host解析(所有主机上)

# vi /etc/hosts192.168.204.138 gpdb_m192.168.204.139 gpdb_seg1192.168.204.140 gpdb_seg2


2:修改系统参数(所有主机上)

# vi /etc/sysctl.confkernel.shmmax = 5000000000kernel.shmmni = 4096kernel.shmall = 40000000000kernel.sem = 250 5120000 100 20480 kernel.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.default.rp_filter = 1net.ipv4.conf.all.arp_filter = 1net.ipv4.ip_local_port_range = 1024 65535net.core.netdev_max_backlog =10000vm.overcommit_memory = 2 使参数生效:# sysctl -p

3:修改最大文件打开数(所有主机上)

# vi /etc/security/limits.conf* soft nofile 65536* hard nofile 65536* soft nproc 131072* hard nproc 131072* soft core unlimited # vi /etc/security/limits.d/20-nproc.conf*          soft    nproc     131072root       soft    nproc     unlimited

4:修改gpdb磁盘挂载参数

Gpdb在linux平台上,推荐使用XFS文件系统,GP建议使用以下的挂在参数:

Rw,noatime,inode64,allocsize=16m

比如想把gpdb数据存储在/dev/sdb磁盘下,挂载目录为/opt/data,则可以如此挂载:

# vi /etc/fstab/dev/sdb   /opt/data  xfs   rw,noatime,inode64,allocsize=16m   1  1

5:在master上安装GPDB

这里使用gpdb二进制包的方式安装,该方式对比源码安装,比较简单,无需安装大量的依赖包和软件包。安装包可在https://network.pivotal.io/下载,需进行注册与邮件验证。

# unzip greenplum-db-5.5.0-rhel7-x86_64.zip# ./greenplum-db-5.5.0-rhel7-x86_64.binI HAVE READ AND AGREE TO THE TERMS OF THE ABOVE PIVOTAL SOFTWARELICENSE AGREEMENT.  ********************************************************************************Do you accept the Pivotal Database license agreement? [yes|no]******************************************************************************** yes ********************************************************************************Provide the installation path for Greenplum Database or press ENTER toaccept the default installation path: /usr/local/greenplum-db-5.5.0******************************************************************************** /opt/apps/greenplum                 (指定安装目录) ********************************************************************************Install Greenplum Database into /opt/apps/greenplum? [yes|no]******************************************************************************** yes ********************************************************************************/opt/apps/greenplum does not exist.Create /opt/apps/greenplum ? [yes|no](Selecting no will exit the installer)******************************************************************************** yes Extracting product to /opt/apps/greenplum ********************************************************************************Installation complete.Greenplum Database is installed in /opt/apps/greenplum Pivotal Greenplum documentation is availablefor download at http://gpdb.docs.pivotal.io 6:在所有主机上安装配置GPDB以root身份加载GPDB的路径文件# source /opt/apps/greenplum/greenplum_path.sh

创建一个host_list文件,里面包含GPDB集群的所有主机名

# vi host_listgpdb_mgpdb_seg1gpdb_seg2

使用创建的host_list文件运行gpseginstall命令,在所有主机上创建gpadmin用户并设置用户的密码,同时把GPDB程序分发到所有主机上:

# gpseginstall -f /opt/conf/greenplum/host_list  -u gpadmin -p gpadmin20180322:18:52:00:001380 gpseginstall:gpdb_m:root-[INFO]:-Installation Info:link_name greenplum-dbbinary_path /opt/apps/greenplumbinary_dir_location /opt/appsbinary_dir_name greenplum20180322:18:52:00:001380 gpseginstall:gpdb_m:root-[INFO]:-check cluster password access  *** Enter password for gpdb_m:20180322:18:52:05:001380 gpseginstall:gpdb_m:root-[INFO]:-de-duplicate hostnames20180322:18:52:05:001380 gpseginstall:gpdb_m:root-[INFO]:-master hostname: gpdb_m20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-check for user gpadmin on cluster20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-add user gpadmin on master20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-add user gpadmin on cluster20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-chown -R gpadmin:gpadmin /opt/apps/greenplum-db20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-chown -R gpadmin:gpadmin /opt/apps/greenplum20180322:18:52:07:001380 gpseginstall:gpdb_m:root-[INFO]:-rm -f /opt/apps/greenplum.tar; rm -f /opt/apps/greenplum.tar.gz20180322:18:52:07:001380 gpseginstall:gpdb_m:root-[INFO]:-cd /opt/apps; tar cf greenplum.tar greenplum20180322:18:52:24:001380 gpseginstall:gpdb_m:root-[INFO]:-gzip /opt/apps/greenplum.tar20180322:18:52:51:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: mkdir -p /opt/apps20180322:18:52:51:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: rm -rf /opt/apps/greenplum20180322:18:52:51:001380 gpseginstall:gpdb_m:root-[INFO]:-scp software to remote locationroot@gpdb_seg2's password: root@gpdb_seg1's password:  root@gpdb_seg1's password:20180322:18:54:05:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: gzip -f -d /opt/apps/greenplum.tar.gz 20180322:18:54:13:001380 gpseginstall:gpdb_m:root-[INFO]:-md5 check on remote location20180322:18:54:16:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: cd /opt/apps; tar xf greenplum.tar20180322:18:54:29:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: rm -f /opt/apps/greenplum.tar20180322:18:54:31:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: cd /opt/apps; rm -f greenplum-db; ln -fs greenplum greenplum-db20180322:18:54:33:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: chown -R gpadmin:gpadmin /opt/apps/greenplum-db20180322:18:54:35:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: chown -R gpadmin:gpadmin /opt/apps/greenplum20180322:18:54:35:001380 gpseginstall:gpdb_m:root-[INFO]:-rm -f /opt/apps/greenplum.tar.gz20180322:18:54:35:001380 gpseginstall:gpdb_m:root-[INFO]:-Changing system passwords ...20180322:18:54:39:001380 gpseginstall:gpdb_m:root-[INFO]:-exchange ssh keys for user root20180322:18:54:41:001380 gpseginstall:gpdb_m:root-[INFO]:-Cmd 'gpssh-exkeys -f /opt/conf/greenplum/host_list' failed with error code 120180322:18:54:41:001380 gpseginstall:gpdb_m:root-[INFO]:-gppsh-exkeys failed running from within pexpect ... now try outside of pexpect[STEP 1 of 5] create local ID and authorize on local host  ... /root/.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 gpdb_seg1  ... send to gpdb_seg2 [STEP 4 of 5] determine common authentication file content [STEP 5 of 5] copy authentication files to all remote hosts  ... finished key exchange with gpdb_seg1[ERROR] unable to copy authentication files to gpdb_seg2     lost connection20180322:18:54:43:001380 gpseginstall:gpdb_m:root-[ERROR]:-error on cmd: gpssh-exkeys -f /opt/conf/greenplum/host_list20180322:18:54:43:001380 gpseginstall:gpdb_m:root-[INFO]:-exchange ssh keys for user gpadmin20180322:18:54:45:001380 gpseginstall:gpdb_m:root-[INFO]:-/opt/apps/greenplum-db/./sbin/gpfixuserlimts -f /etc/security/limits.conf -u gpadmin20180322:18:54:45:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: . /opt/apps/greenplum-db/./greenplum_path.sh; /opt/apps/greenplum-db/./sbin/gpfixuserlimts -f /etc/security/limits.conf -u gpadmin20180322:18:54:46:001380 gpseginstall:gpdb_m:root-[INFO]:-version string on master: gpssh version 5.5.0 build commit:67afa18296aa238d53a2dfcc724da60ed2f944f020180322:18:54:46:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: . /opt/apps/greenplum-db/./greenplum_path.sh; /opt/apps/greenplum-db/./bin/gpssh --version20180322:18:54:46:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: . /opt/apps/greenplum/greenplum_path.sh; /opt/apps/greenplum/bin/gpssh --version20180322:18:54:46:001380 gpseginstall:gpdb_m:root-[INFO]:-SUCCESS -- Requested commands completed

7:确认每个主机上是否都安装好了gpdb

Master:

# su - gpadmin$ source /opt/apps/greenplum/greenplum_path.sh$ gpssh-exkeys -f /opt/conf/greenplum/host_list[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 gpdb_seg1  ... send to gpdb_seg2 [STEP 4 of 5] determine common authentication file content [STEP 5 of 5] copy authentication files to all remote hosts  ... finished key exchange with gpdb_seg1  ... finished key exchange with gpdb_seg2 [INFO] completed successfully$ gpssh -f /opt/conf/greenplum/host_list  ls /opt/apps/[   gpdb_m] greenplum  greenplum-db[gpdb_seg2] greenplum  greenplum-db[gpdb_seg1] greenplum  greenplum-db

以上可以看到gpdb软件已经安装到每个主机上。

8:创建数据目录。

Master:

# mkdir -p /opt/data/gpdata/master# chown gpadmin.gpadmin /opt/data/gpdata/master

Segment:

创建seg_host文件,该文件包含segment主机名# vi /opt/conf/greenplum/seg_hostgpdb_seg1gpdb_seg2

各节点创建segmeng数据目录

# gpssh -f  /opt/conf/greenplum/seg_host=> mkdir -p /opt/data/gpdata/primary[gpdb_seg2][gpdb_seg1]=> mkdir -p /opt/data/gpdata/mirror[gpdb_seg2][gpdb_seg1]=> chown gpadmin.gpadmin /opt/data/gpdata/primary[gpdb_seg2][gpdb_seg1]=> chown gpadmin.gpadmin /opt/data/gpdata/mirror[gpdb_seg2][gpdb_seg1]

10:初始化GPDB

创建GPDB配置文件:

$ cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/$ vi /home/gpadmin/gpinitsystem_configARRAY_NAME="CMH greenplum"SEG_PREFIX=gpsegPORT_BASE=40000declare -a DATA_DIRECTORY=(/opt/data/gpdata/primary)MASTER_HOSTNAME=gpdb_mMASTER_DIRECTORY=/opt/data/gpdata/masterMASTER_PORT=5432TRUSTED_SHELL=sshCHECK_POINT_SEGMENTS=8ENCODING=UNICODEMACHINE_LIST_FILE=/opt/conf/greenplum/seg_host

注:这里没有配置mirror,可以在初始化的时候配置mirror,也可以后期添加。

运行初始化命令:

$ gpinitsystem -c gpinitsystem_config20180322:19:27:51:007412 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checking configuration parameters, please wait...20180322:19:27:51:007412 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Reading Greenplum configuration file gpinitsystem_config20180322:19:27:51:007412 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value20180322:19:27:51:007412 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Locale set to en_US.utf820180322:19:27:51:gpinitsystem:gpdb_m:gpadmin-[FATAL]:-Master host data directory /opt/data/gpdata/master/gpseg-1 already exists Script Exiting![gpadmin@gpdb_m ~]$ gpinitsystem -c gpinitsystem_config20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checking configuration parameters, please wait...20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Reading Greenplum configuration file gpinitsystem_config20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Locale set to en_US.utf820180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 25020180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checking configuration parameters, Completed20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Commencing multi-home checks, please wait.....20180322:19:28:04:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Configuring build for standard array20180322:19:28:04:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Commencing multi-home checks, Completed20180322:19:28:04:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Building primary segment instance array, please wait.....20180322:19:28:04:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checking Master host20180322:19:28:04:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checking new segment hosts, please wait.....20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checking new segment hosts, Completed20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Greenplum Database Creation Parameters20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:---------------------------------------20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master Configuration20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:---------------------------------------20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master instance name       = CMH greenplum20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master hostname            = gpdb_m20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master port                = 543220180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master instance dir        = /opt/data/gpdata/master/gpseg-120180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master LOCALE              = en_US.utf820180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Greenplum segment prefix   = gpseg20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master Database            =20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master connections         = 25020180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master buffers             = 128000kB20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Segment connections        = 75020180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Segment buffers            = 128000kB20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checkpoint segments        = 820180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Encoding                   = UNICODE20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Postgres param file        = Off20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Initdb to be used          = /opt/apps/greenplum-db/./bin/initdb20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-GP_LIBRARY_PATH is         = /opt/apps/greenplum-db/./lib20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-HEAP_CHECKSUM is           = on20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Ulimit check               = Passed20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Array host connect type    = Single hostname per node20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master IP address [1]      = ::120180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master IP address [2]      = 192.168.204.13820180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master IP address [3]      = fe80::ba98:17d7:87fc:71d520180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Standby Master             = Not Configured20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Primary segment #          = 120180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Total Database segments    = 220180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Trusted shell              = ssh20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Number segment hosts       = 220180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Mirroring config           = OFF20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:----------------------------------------20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Greenplum Primary Segment Configuration20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:----------------------------------------20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-gpdb_seg1  /opt/data/gpdata/primary/gpseg0         40000   2       020180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-gpdb_seg2  /opt/data/gpdata/primary/gpseg1         40000   3       1 Continue with Greenplum creation Yy|Nn (default=N):> y20180322:19:28:14:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Building the Master instance database, please wait...20180322:19:28:18:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Starting the Master in admin mode20180322:19:28:23:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Commencing parallel build of primary segment instances20180322:19:28:23:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait.....20180322:19:28:23:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait.................20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:------------------------------------------------20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Parallel process exit status20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:------------------------------------------------20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Total processes marked as completed           = 220180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Total processes marked as killed              = 020180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Total processes marked as failed              = 020180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:------------------------------------------------20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Deleting distributed backout files20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Removing back out file20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-No errors generated from parallel processes20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Starting gpstop with args: -a -l /home/gpadmin/gpAdminLogs -i -m -d /opt/data/gpdata/master/gpseg-120180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Gathering information and validating the environment...20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Obtaining Segment details from master...20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 5.5.0 build commit:67afa18296aa238d53a2dfcc724da60ed2f944f0'20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-There are 0 connections to the database20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='immediate'20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Master host=gpdb_m20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate20180322:19:28:37:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Master segment instance directory=/opt/data/gpdata/master/gpseg-120180322:19:28:39:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process20180322:19:28:39:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Terminating processes for segment /opt/data/gpdata/master/gpseg-120180322:19:28:39:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /opt/data/gpdata/master/gpseg-120180322:19:28:39:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Gathering information and validating the environment...20180322:19:28:39:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 5.5.0 build commit:67afa18296aa238d53a2dfcc724da60ed2f944f0'20180322:19:28:39:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Greenplum Catalog Version: '301705051'20180322:19:28:39:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Starting Master instance in admin mode20180322:19:28:40:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information20180322:19:28:40:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Obtaining Segment details from master...20180322:19:28:40:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Setting new master era20180322:19:28:40:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Master Started...20180322:19:28:40:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Heap checksum setting is consistent across the cluster20180322:19:28:40:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Shutting down master20180322:19:28:41:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait.....20180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Process results...20180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-----------------------------------------------------20180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-   Successful segment starts                                            = 220180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-   Failed segment starts                                                = 020180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 020180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-----------------------------------------------------20180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Successfully started 2 of 2 segment instances20180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-----------------------------------------------------20180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Starting Master instance gpdb_m directory /opt/data/gpdata/master/gpseg-120180322:19:28:45:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Command pg_ctl reports Master gpdb_m instance active20180322:19:28:45:009789 gpstart:gpdb_m:gpadmin-[INFO]:-No standby master configured.  skipping...20180322:19:28:45:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Database successfully started20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Scanning utility log file for any warning messages20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[WARN]:-*******************************************************20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[WARN]:-Scan of log file indicates that some warnings or errors20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[WARN]:-were generated during the array creation20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Please review contents of log file20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20180322.log20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-To determine level of criticality20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-These messages could be from a previous run of the utility20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-that was called today!20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[WARN]:-*******************************************************20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Greenplum Database instance successfully created20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-------------------------------------------------------20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-To complete the environment configuration, please20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-update gpadmin .bashrc file with the following20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/opt/data/gpdata/master/gpseg-1"20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-   to access the Greenplum scripts for this instance:20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-   or, use -d /opt/data/gpdata/master/gpseg-1 option for the Greenplum scripts20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-   Example gpstate -d /opt/data/gpdata/master/gpseg-120180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20180322.log20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Review options for gpinitstandby20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-------------------------------------------------------20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-The Master /opt/data/gpdata/master/gpseg-1/pg_hba.conf post gpinitsystem20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-has been configured to allow all hosts within this new20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-new array must be explicitly added to this file20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-located in the /opt/apps/greenplum-db/./docs directory20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-------------------------------------------------------

11:配置GPDB系统变量:

$ vi ./.bashrcsource /opt/apps/greenplum-db/greenplum_path.shexport MASTER_DATA_DIRECTORY=/opt/data/gpdata/master/gpseg-1export PGPORT=5432export PGUSER=gpadminexport PGDATABASE=postgres

12:验证segment状态:

$ psql -d postgrespostgres=# select * from gp_segment_configuration; dbid | content | role | preferred_role | mode | status | port  | hostname  |  address  | replication_port------+---------+------+----------------+------+--------+-------+-----------+-----------+------------------    1 |      -1 | p    | p              | s    | u      |  5432 | gpdb_m    | gpdb_m    |                    2 |       0 | p    | p              | s    | u      | 40000 | gpdb_seg1 | gpdb_seg1 |                    3 |       1 | p    | p              | s    | u      | 40000 | gpdb_seg2 | gpdb_seg2 |                (3 rows)

可以看到我们起了3个postgres实例,其中1个master,两个segment。Segment分别分布在gpdb_seg1和gpdb_seg2上。


至此,一个Greenplum集群就安装完成了。

0