Greenplu数据库的部署
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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/hosts 192.168.204.138 gpdb_m 192.168.204.139 gpdb_seg1 192.168.204.140 gpdb_seg2
2:修改系统参数(所有主机上)
# vi /etc/sysctl.conf kernel.shmmax = 5000000000 kernel.shmmni = 4096 kernel.shmall = 40000000000 kernel.sem = 250 5120000 100 20480 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.default.rp_filter = 1 net.ipv4.conf.all.arp_filter = 1 net.ipv4.ip_local_port_range = 1024 65535 net.core.netdev_max_backlog =10000 vm.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 131072 root 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.bin I HAVE READ AND AGREE TO THE TERMS OF THE ABOVE PIVOTAL SOFTWARE LICENSE AGREEMENT. ******************************************************************************** Do you accept the Pivotal Database license agreement? [yes|no] ******************************************************************************** yes ******************************************************************************** Provide the installation path for Greenplum Database or press ENTER to accept the default installation path: /usr/local/greenplum-db-5.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 available for download at http://gpdb.docs.pivotal.io 6:在所有主机上安装配置GPDB 以root身份加载GPDB的路径文件 # source /opt/apps/greenplum/greenplum_path.sh
创建一个host_list文件,里面包含GPDB集群的所有主机名
# vi host_list gpdb_m gpdb_seg1 gpdb_seg2
使用创建的host_list文件运行gpseginstall命令,在所有主机上创建gpadmin用户并设置用户的密码,同时把GPDB程序分发到所有主机上:
# gpseginstall -f /opt/conf/greenplum/host_list -u gpadmin -p gpadmin 20180322:18:52:00:001380 gpseginstall:gpdb_m:root-[INFO]:-Installation Info: link_name greenplum-db binary_path /opt/apps/greenplum binary_dir_location /opt/apps binary_dir_name greenplum 20180322: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 hostnames 20180322:18:52:05:001380 gpseginstall:gpdb_m:root-[INFO]:-master hostname: gpdb_m 20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-check for user gpadmin on cluster 20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-add user gpadmin on master 20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-add user gpadmin on cluster 20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-chown -R gpadmin:gpadmin /opt/apps/greenplum-db 20180322:18:52:06:001380 gpseginstall:gpdb_m:root-[INFO]:-chown -R gpadmin:gpadmin /opt/apps/greenplum 20180322:18:52:07:001380 gpseginstall:gpdb_m:root-[INFO]:-rm -f /opt/apps/greenplum.tar; rm -f /opt/apps/greenplum.tar.gz 20180322:18:52:07:001380 gpseginstall:gpdb_m:root-[INFO]:-cd /opt/apps; tar cf greenplum.tar greenplum 20180322:18:52:24:001380 gpseginstall:gpdb_m:root-[INFO]:-gzip /opt/apps/greenplum.tar 20180322:18:52:51:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: mkdir -p /opt/apps 20180322:18:52:51:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: rm -rf /opt/apps/greenplum 20180322:18:52:51:001380 gpseginstall:gpdb_m:root-[INFO]:-scp software to remote location [email protected]_seg2's password: [email protected]_seg1's password: [email protected]_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 location 20180322:18:54:16:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: cd /opt/apps; tar xf greenplum.tar 20180322:18:54:29:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: rm -f /opt/apps/greenplum.tar 20180322:18:54:31:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: cd /opt/apps; rm -f greenplum-db; ln -fs greenplum greenplum-db 20180322:18:54:33:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: chown -R gpadmin:gpadmin /opt/apps/greenplum-db 20180322:18:54:35:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: chown -R gpadmin:gpadmin /opt/apps/greenplum 20180322:18:54:35:001380 gpseginstall:gpdb_m:root-[INFO]:-rm -f /opt/apps/greenplum.tar.gz 20180322: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 root 20180322:18:54:41:001380 gpseginstall:gpdb_m:root-[INFO]:-Cmd 'gpssh-exkeys -f /opt/conf/greenplum/host_list' failed with error code 1 20180322: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 connection 20180322:18:54:43:001380 gpseginstall:gpdb_m:root-[ERROR]:-error on cmd: gpssh-exkeys -f /opt/conf/greenplum/host_list 20180322:18:54:43:001380 gpseginstall:gpdb_m:root-[INFO]:-exchange ssh keys for user gpadmin 20180322:18:54:45:001380 gpseginstall:gpdb_m:root-[INFO]:-/opt/apps/greenplum-db/./sbin/gpfixuserlimts -f /etc/security/limits.conf -u gpadmin 20180322: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 gpadmin 20180322:18:54:46:001380 gpseginstall:gpdb_m:root-[INFO]:-version string on master: gpssh version 5.5.0 build commit:67afa18296aa238d53a2dfcc724da60ed2f944f0 20180322:18:54:46:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: . /opt/apps/greenplum-db/./greenplum_path.sh; /opt/apps/greenplum-db/./bin/gpssh --version 20180322:18:54:46:001380 gpseginstall:gpdb_m:root-[INFO]:-remote command: . /opt/apps/greenplum/greenplum_path.sh; /opt/apps/greenplum/bin/gpssh --version 20180322: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_host gpdb_seg1 gpdb_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_config ARRAY_NAME="CMH greenplum" SEG_PREFIX=gpseg PORT_BASE=40000 declare -a DATA_DIRECTORY=(/opt/data/gpdata/primary) MASTER_HOSTNAME=gpdb_m MASTER_DIRECTORY=/opt/data/gpdata/master MASTER_PORT=5432 TRUSTED_SHELL=ssh CHECK_POINT_SEGMENTS=8 ENCODING=UNICODE MACHINE_LIST_FILE=/opt/conf/greenplum/seg_host
注:这里没有配置mirror,可以在初始化的时候配置mirror,也可以后期添加。
运行初始化命令:
$ gpinitsystem -c gpinitsystem_config 20180322: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_config 20180322:19:27:51:007412 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value 20180322:19:27:51:007412 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Locale set to en_US.utf8 20180322:19:27:51:gpinitsystem:gpdb_m:gpadmin-[FATAL]:-Master host data directory /opt/data/gpdata/master/gpseg-1 already exists Script Exiting! [[email protected]_m ~]$ gpinitsystem -c gpinitsystem_config 20180322: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_config 20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value 20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Locale set to en_US.utf8 20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates 20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250 20180322:19:28:03:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checking configuration parameters, Completed 20180322: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 array 20180322:19:28:04:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Commencing multi-home checks, Completed 20180322: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 host 20180322: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, Completed 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Greenplum Database Creation Parameters 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:--------------------------------------- 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master Configuration 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:--------------------------------------- 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master instance name = CMH greenplum 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master hostname = gpdb_m 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master port = 5432 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master instance dir = /opt/data/gpdata/master/gpseg-1 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master LOCALE = en_US.utf8 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Greenplum segment prefix = gpseg 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master Database = 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master connections = 250 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master buffers = 128000kB 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Segment connections = 750 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Segment buffers = 128000kB 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Checkpoint segments = 8 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Encoding = UNICODE 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Postgres param file = Off 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Initdb to be used = /opt/apps/greenplum-db/./bin/initdb 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-GP_LIBRARY_PATH is = /opt/apps/greenplum-db/./lib 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-HEAP_CHECKSUM is = on 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Ulimit check = Passed 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Array host connect type = Single hostname per node 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master IP address [1] = ::1 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master IP address [2] = 192.168.204.138 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Master IP address [3] = fe80::ba98:17d7:87fc:71d5 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Standby Master = Not Configured 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Primary segment # = 1 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Total Database segments = 2 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Trusted shell = ssh 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Number segment hosts = 2 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Mirroring config = OFF 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:---------------------------------------- 20180322:19:28:07:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Greenplum Primary Segment Configuration 20180322: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 0 20180322: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): > y 20180322: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 mode 20180322:19:28:23:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Commencing parallel build of primary segment instances 20180322: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 status 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:------------------------------------------------ 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Total processes marked as completed = 2 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Total processes marked as killed = 0 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Total processes marked as failed = 0 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:------------------------------------------------ 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Deleting distributed backout files 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Removing back out file 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-No errors generated from parallel processes 20180322:19:28:37:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode 20180322: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-1 20180322: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 information 20180322: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 database 20180322: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_m 20180322: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 segment instance directory=/opt/data/gpdata/master/gpseg-1 20180322:19:28:39:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process 20180322:19:28:39:009763 gpstop:gpdb_m:gpadmin-[INFO]:-Terminating processes for segment /opt/data/gpdata/master/gpseg-1 20180322:19:28:39:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Starting gpstart with args: -a -l /home/gpadmin/gpAdminLogs -d /opt/data/gpdata/master/gpseg-1 20180322: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 mode 20180322:19:28:40:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20180322: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 era 20180322: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 cluster 20180322:19:28:40:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Shutting down master 20180322: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 = 2 20180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:- Failed segment starts = 0 20180322:19:28:43:009789 gpstart:gpdb_m:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0 20180322: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 instances 20180322: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-1 20180322:19:28:45:009789 gpstart:gpdb_m:gpadmin-[INFO]:-Command pg_ctl reports Master gpdb_m instance active 20180322: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 started 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Scanning utility log file for any warning messages 20180322: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 errors 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[WARN]:-were generated during the array creation 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Please review contents of log file 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20180322.log 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-To determine level of criticality 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-These messages could be from a previous run of the utility 20180322: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 created 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:------------------------------------------------------- 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-To complete the environment configuration, please 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-update gpadmin .bashrc file with the following 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced 20180322: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 scripts 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:- Example gpstate -d /opt/data/gpdata/master/gpseg-1 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20180322.log 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Review options for gpinitstandby 20180322: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 gpinitsystem 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-has been configured to allow all hosts within this new 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-new array must be explicitly added to this file 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-located in the /opt/apps/greenplum-db/./docs directory 20180322:19:28:45:007646 gpinitsystem:gpdb_m:gpadmin-[INFO]:-------------------------------------------------------
11:配置GPDB系统变量:
$ vi ./.bashrc source /opt/apps/greenplum-db/greenplum_path.sh export MASTER_DATA_DIRECTORY=/opt/data/gpdata/master/gpseg-1 export PGPORT=5432 export PGUSER=gpadmin export PGDATABASE=postgres
12:验证segment状态:
$ psql –d postgres postgres=# 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集群就安装完成了。
以上是关于Greenplu数据库的部署的主要内容,如果未能解决你的问题,请参考以下文章