GreenPlum数据库安装系列第三篇:非mirror模式数据库的初始化
上一篇文章记录了GreenPlum数据库的Segment节点在非Mirror模式的安装过程(详见GreenPlum数据库安装系列第二篇:非mirror模式Segment节点软件安装),本文简要记录NO Mirror模式GreenPlum的数据库初始化安装过程。本实验操作系统为OEL 6.5,GPDB版本为4.3.6.2。
1.系统设置
1.1创建数据文件存放目录(所有节点)
本案例Master节点的数据文件存放在/gpdb/gpdata/master目录,Segment节点的数据文件存放在/gpdb/gpdata/primary目录。
[gpadmin@mdw config]$ mkdir -p /gpdb/gpdata/master
Segment节点可以通过gpssh工具批量创建相同的目录。
[gpadmin@mdw config]$ cat seg_host sdw1 sdw2 sdw3 [gpadmin@mdw config]$ gpssh -f seg_host -e 'mkdir -p /gpdb/gpdata/primary' [sdw1] mkdir -p /gpdb/gpdata/primary [sdw2] mkdir -p /gpdb/gpdata/primary [sdw3] mkdir -p /gpdb/gpdata/primary
1.2配置NTP时间同步(所有节点)
本案例Master节点的服务器配置为NTP的服务端,Segment节点为NTP的客户端。所有节点的/etc/ntp.conf文件增加以下两行内容:
[root@mdw ~]# vi /etc/ntp.conf server 10.9.15.20 # local clock fudge 10.9.15.20 stratum 10
验证NTP服务是否成功配置,Master节点使用root用户,加载GreenPlum的环境变量。
root@mdw ~]# source /gpdb/app/greenplum_path.sh
Master节点使用root用户通过gpssh-exkeys工具打开所有节点之间的互信关系。
[root@mdw ~]# gpssh-exkeys -f /gpdb/app/config/hostlist [STEP 1 of 5] create local ID and authorize on local host [STEP 2 of 5] keyscan all hosts and update known_hosts file [STEP 3 of 5] authorize current user on remote hosts ... send to sdw1 *** *** Enter password for sdw1: --输入root密码 ... send to sdw2 ... send to sdw3 [STEP 4 of 5] determine common authentication file content [STEP 5 of 5] copy authentication files to all remote hosts ... finished key exchange with sdw1 ... finished key exchange with sdw2 ... finished key exchange with sdw3 [INFO] completed successfully
Master节点使用root用户通过gpssh工具批量调用date命令对比各服务器的时间是否一致。
[root@mdw ~]# gpssh -f /gpdb/app/config/hostlist -v -e date [Reset ...] [INFO] login sdw2 [INFO] login sdw1 [INFO] login mdw [INFO] login sdw3 [sdw2] date [sdw2] Wed Jan 13 17:52:18 CST 2016 [sdw1] date [sdw1] Wed Jan 13 17:52:19 CST 2016 [ mdw] date [ mdw] Wed Jan 13 17:52:19 CST 2016 [sdw3] date [sdw3] Wed Jan 13 17:52:19 CST 2016 [INFO] completed successfully
因为各服务器上是按最先连接到哪台服务器就先在哪台服务器上执行date命令,也可以说gpssh工具连接多节点时的先后顺序是随机的,并不是和之前配置的节点信息文件(hostlist)里的顺序一致,因此先返回结果的节点时间早一点点是正常的。
1.3先决条件检查(仅Master节点)
在初始化数据库之前,需要进行先决条件检查,主要检查磁盘I/O能力、网络带宽、内核参数、limit等条件是否满足GreenPlum数据库的要求,如下显示的信息是所有节点内核参数中的shmmax和shmall需要重新设置。
[root@mdw ~]# gpcheck -f /gpdb/app/config/hostlist -m mdw 20160113:10:58:10:026374 gpcheck:mdw:root-[INFO]:-dedupe hostnames 20160113:10:58:10:026374 gpcheck:mdw:root-[INFO]:-Detected platform: Generic Linux Cluster 20160113:10:58:10:026374 gpcheck:mdw:root-[INFO]:-generate data on servers 20160113:10:58:10:026374 gpcheck:mdw:root-[INFO]:-copy data files from servers 20160113:10:58:10:026374 gpcheck:mdw:root-[INFO]:-delete remote tmp files 20160113:10:58:11:026374 gpcheck:mdw:root-[INFO]:-Using gpcheck config file: /gpdb/greenplum-db/./etc/gpcheck.cnf 20160113:10:58:11:026374 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw3): /etc/sysctl.conf value for key 'kernel.shmmax' has value '68719476736' and expects '500000000' 20160113:10:58:11:026374 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw3): /etc/sysctl.conf value for key 'kernel.shmall' has value '4294967296' and expects '4000000000' 20160113:10:58:11:026374 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): /etc/sysctl.conf value for key 'kernel.shmmax' has value '68719476736' and expects '500000000' 20160113:10:58:11:026374 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw1): /etc/sysctl.conf value for key 'kernel.shmall' has value '4294967296' and expects '4000000000' 20160113:10:58:11:026374 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): /etc/sysctl.conf value for key 'kernel.shmmax' has value '68719476736' and expects '500000000' 20160113:10:58:11:026374 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(sdw2): /etc/sysctl.conf value for key 'kernel.shmall' has value '4294967296' and expects '4000000000' 20160113:10:58:11:026374 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): /etc/sysctl.conf value for key 'kernel.shmmax' has value '68719476736' and expects '500000000' 20160113:10:58:11:026374 gpcheck:mdw:root-[ERROR]:-GPCHECK_ERROR host(mdw): /etc/sysctl.conf value for key 'kernel.shmall' has value '4294967296' and expects '4000000000' 20160113:10:58:11:026374 gpcheck:mdw:root-[INFO]:-gpcheck completing...
调整所有节点的内核参数。
kernel.shmmax = 500000000 kernel.shmall = 4000000000
通过sysctl –p命令使之生效。
[root@mdw ~]# sysctl -p
再次检查,看看是否还有其他不满足需求的地方。
[root@mdw ~]# gpcheck -f /gpdb/app/config/hostlist -m mdw 20160113:11:02:51:026615 gpcheck:mdw:root-[INFO]:-dedupe hostnames 20160113:11:02:51:026615 gpcheck:mdw:root-[INFO]:-Detected platform: Generic Linux Cluster 20160113:11:02:51:026615 gpcheck:mdw:root-[INFO]:-generate data on servers 20160113:11:02:51:026615 gpcheck:mdw:root-[INFO]:-copy data files from servers 20160113:11:02:51:026615 gpcheck:mdw:root-[INFO]:-delete remote tmp files 20160113:11:02:52:026615 gpcheck:mdw:root-[INFO]:-Using gpcheck config file: /gpdb/greenplum-db/./etc/gpcheck.cnf 20160113:11:02:52:026615 gpcheck:mdw:root-[INFO]:-GPCHECK_NORMAL 20160113:11:02:52:026615 gpcheck:mdw:root-[INFO]:-gpcheck completing...
2.GreenPlum数据库初始化
2.1创建GreenPlum数据库的参数文件(仅Master节点)
在$GPHOME/docs目录下,存在一些参数文件的模版,可以通过这些模版快速配置一些常用的参数文件。比如GreenPlum数据库的参数文件可以参考$GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config文件。
[gpadmin@mdw ~]$ cd /gpdb/app/docs/cli_help/gpconfigs/ [gpadmin@mdw gpconfigs]$ cat gpinitsystem_config | grep -v ^# | grep -v ^$ >/gpdb/app/config/gpinitsystem_config [gpadmin@mdw gpconfigs]$ cd /gpdb/app/config/
打开新创建的参数文件,只需要修改两个地方即可。
[gpadmin@mdw config]$ cat gpinitsystem_config ARRAY_NAME="EMC Greenplum DW" SEG_PREFIX=gpseg --segment数据库的名字前缀 PORT_BASE=40000 --segment节点的起始端口号 declare -a DATA_DIRECTORY=(/gpdb/gpdata/primary) --修改,该目录为segment节点的数据文件存放地址 MASTER_HOSTNAME=mdw --通常默认就是master节点的主机名,如不是,需要修改 MASTER_DIRECTORY=/gpdb/gpdata/master --修改,该目录为master节点的数据文件存放地址 MASTER_PORT=5432 --master节点的监听端口,默认5432,可自定义修改 TRUSTED_SHELL=ssh --指定默认的bash版本 CHECK_POINT_SEGMENTS=8 ENCODING=UNICODE --字符集
2.2GreenPlum数据库初始化(仅Master节点)
接下来就可以使用gpinitsystem工具初始化数据库了,一些参数文件中没有设置的重要参数,在初始化数据库时会被使用默认值,可以在初始化之后根据需求及主机的配置进行设置。GreenPlum数据库的参数也分为静态参数和动态参数,静态参数需重启数据库才能生效,动态参数不需要重启数据库即可生效。
[gpadmin@mdw config]$ gpinitsystem -c gpinitsystem_config -h seg_host 20160114:10:30:11:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, please wait... 20160114:10:30:11:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Reading Greenplum configuration file gpinitsystem_config 20160114:10:30:11:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value 20160114:10:30:11:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Locale set to en_US.utf8 20160114:10:30:11:030682 gpinitsystem:mdw:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates 20160114:10:30:11:030682 gpinitsystem:mdw:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250 20160114:10:30:11:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Checking configuration parameters, Completed 20160114:10:30:12:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, please wait... ... 20160114:10:30:12:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Configuring build for standard array 20160114:10:30:12:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing multi-home checks, Completed 20160114:10:30:12:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Building primary segment instance array, please wait... ... 20160114:10:30:13:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Checking Master host 20160114:10:30:13:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, please wait... ... 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Checking new segment hosts, Completed 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database Creation Parameters 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:--------------------------------------- 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master Configuration 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:--------------------------------------- 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master instance name = EMC Greenplum DW 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master hostname = mdw 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master port = 5432 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master instance dir = /gpdb/gpdata/master/gpseg-1 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master LOCALE = en_US.utf8 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum segment prefix = gpseg 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master Database = 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master connections = 250 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master buffers = 128000kB 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Segment connections = 750 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Segment buffers = 128000kB 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Checkpoint segments = 8 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Encoding = UNICODE 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Postgres param file = Off 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Initdb to be used = /gpdb/greenplum-db/./bin/initdb 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-GP_LIBRARY_PATH is = /gpdb/greenplum-db/./lib 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Ulimit check = Passed 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Array host connect type = Single hostname per node 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [1] = ::1 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [2] = 10.9.15.20 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [3] = 10.9.15.21 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [4] = fe80::20c:29ff:feee:43b5 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [5] = fe80::20c:29ff:feee:43bf 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [6] = fe80::20c:29ff:feee:43c9 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Master IP address [7] = fe80::20c:29ff:feee:43d3 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Standby Master = Not Configured 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Primary segment # = 1 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Total Database segments = 3 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Trusted shell = ssh 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Number segment hosts = 3 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Mirroring config = OFF 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------- 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Primary Segment Configuration 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:---------------------------------------- 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-sdw1 /gpdb/gpdata/primary/gpseg0 40000 2 0 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-sdw2 /gpdb/gpdata/primary/gpseg1 40000 3 1 20160114:10:30:17:030682 gpinitsystem:mdw:gpadmin-[INFO]:-sdw3 /gpdb/gpdata/primary/gpseg2 40000 4 2 Continue with Greenplum creation Yy/Nn>
上面通过参数文件检查,列出了GreenPlum数据库的一些基本信息,比如参数文件中没有设置的一些参数,MASTER_MAX_CONNECT、Master buffers、Segment connections、Segment buffers等,往往在生产环境,这些参数的默认值满足不了需求,后续会有章节介绍如何修改这些参数。输入Y确认继续安装。
y 20160114:10:30:59:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Building the Master instance database, please wait... 20160114:10:31:07:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Starting the Master in admin mode 20160114:10:31:12:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Commencing parallel build of primary segment instances 20160114:10:31:12:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Spawning parallel processes batch [1], please wait... ... 20160114:10:31:12:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait... ..................... 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------ 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Parallel process exit status 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------ 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as completed = 3 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as killed = 0 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Total processes marked as failed = 0 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------ 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Deleting distributed backout files 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Removing back out file 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:-No errors generated from parallel processes 20160114:10:31:33:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Starting gpstop with args: -a -i -m -d /gpdb/gpdata/master/gpseg-1 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Gathering information and validating the environment... 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Obtaining Segment details from master... 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.3.6.2 build 1' 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-There are 0 connections to the database 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='immediate' 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Master host=mdw 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate 20160114:10:31:34:011709 gpstop:mdw:gpadmin-[INFO]:-Master segment instance directory=/gpdb/gpdata/master/gpseg-1 20160114:10:31:35:011709 gpstop:mdw:gpadmin-[INFO]:-Attempting forceful termination of any leftover master process 20160114:10:31:35:011709 gpstop:mdw:gpadmin-[INFO]:-Terminating processes for segment /gpdb/gpdata/master/gpseg-1 20160114:10:31:35:011796 gpstart:mdw:gpadmin-[INFO]:-Starting gpstart with args: -a -d /gpdb/gpdata/master/gpseg-1 20160114:10:31:35:011796 gpstart:mdw:gpadmin-[INFO]:-Gathering information and validating the environment... 20160114:10:31:35:011796 gpstart:mdw:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.3.6.2 build 1' 20160114:10:31:35:011796 gpstart:mdw:gpadmin-[INFO]:-Greenplum Catalog Version: '201310150' 20160114:10:31:35:011796 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance in admin mode 20160114:10:31:36:011796 gpstart:mdw:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20160114:10:31:36:011796 gpstart:mdw:gpadmin-[INFO]:-Obtaining Segment details from master... 20160114:10:31:36:011796 gpstart:mdw:gpadmin-[INFO]:-Setting new master era 20160114:10:31:36:011796 gpstart:mdw:gpadmin-[INFO]:-Master Started... 20160114:10:31:36:011796 gpstart:mdw:gpadmin-[INFO]:-Shutting down master 20160114:10:31:37:011796 gpstart:mdw:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait... .. 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:-Process results... 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:----------------------------------------------------- 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:- Successful segment starts = 3 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:- Failed segment starts = 0 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:----------------------------------------------------- 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:- 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:-Successfully started 3 of 3 segment instances 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:----------------------------------------------------- 20160114:10:31:39:011796 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance mdw directory /gpdb/gpdata/master/gpseg-1 20160114:10:31:40:011796 gpstart:mdw:gpadmin-[INFO]:-Command pg_ctl reports Master mdw instance active 20160114:10:31:40:011796 gpstart:mdw:gpadmin-[INFO]:-No standby master configured. skipping... 20160114:10:31:40:011796 gpstart:mdw:gpadmin-[INFO]:-Database successfully started 20160114:10:31:40:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode 20160114:10:31:40:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Loading gp_toolkit... 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Scanning utility log file for any warning messages 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[WARN]:-******************************************************* 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[WARN]:-Scan of log file indicates that some warnings or errors 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[WARN]:-were generated during the array creation 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Please review contents of log file 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20160114.log 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-To determine level of criticality 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[WARN]:-******************************************************* 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Greenplum Database instance successfully created 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------------- 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-To complete the environment configuration, please 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-update gpadmin .bashrc file with the following 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/gpdb/gpdata/master/gpseg-1" 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:- to access the Greenplum scripts for this instance: 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:- or, use -d /gpdb/gpdata/master/gpseg-1 option for the Greenplum scripts 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:- Example gpstate -d /gpdb/gpdata/master/gpseg-1 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20160114.log 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Review options for gpinitstandby 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:------------------------------------------------------- 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-The Master /gpdb/gpdata/master/gpseg-1/pg_hba.conf post gpinitsystem 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-has been configured to allow all hosts within this new 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-new array must be explicitly added to this file 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-located in the /gpdb/greenplum-db/./docs directory 20160114:10:31:41:030682 gpinitsystem:mdw:gpadmin-[INFO]:-------------------------------------------------------
安装完成并且数据库已经成功启动,可以通过查看进程的方式来检查数据库是否成功启动。以下是Mster节点的输出信息。
[gpadmin@mdw config]$ ps -ef | grep post root 1970 1 0 2015 ? 00:00:03 /usr/libexec/postfix/master postfix 1978 1970 0 2015 ? 00:00:00 qmgr -l -t fifo -u gpadmin 11859 1 0 10:31 ? 00:00:00 /gpdb/app/bin/postgres -D /gpdb/gpdata/master/gpseg-1 -p 5432 -b 1 -z 3 --silent-mode=true -i -M master -C -1 -x 0 -E gpadmin 11860 11859 0 10:31 ? 00:00:00 postgres: port 5432, master logger process gpadmin 11863 11859 0 10:31 ? 00:00:00 postgres: port 5432, stats collector process gpadmin 11864 11859 0 10:31 ? 00:00:00 postgres: port 5432, writer process gpadmin 11865 11859 0 10:31 ? 00:00:00 postgres: port 5432, checkpoint process gpadmin 11866 11859 0 10:31 ? 00:00:00 postgres: port 5432, seqserver process gpadmin 11867 11859 0 10:31 ? 00:00:00 postgres: port 5432, ftsprobe process gpadmin 11868 11859 0 10:31 ? 00:00:00 postgres: port 5432, sweeper process gpadmin 13270 30583 0 10:32 pts/0 00:00:00 grep post postfix 30486 1970 0 09:29 ? 00:00:00 pickup -l -t fifo -u
以下是Segment节点的输出信息。
[gpadmin@sdw1 primary]$ ps -ef | grep post root 2000 1 0 2015 ? 00:00:04 /usr/libexec/postfix/master postfix 2009 2000 0 2015 ? 00:00:00 qmgr -l -t fifo -u postfix 15946 2000 0 09:51 ? 00:00:00 pickup -l -t fifo -u gpadmin 16893 1 0 10:31 ? 00:00:00 /gpdb/app/bin/postgres -D /gpdb/gpdata/primary/gpseg0 -p 40000 -b 2 -z 3 --silent-mode=true -i -M mirrorless -C 0 gpadmin 16894 16893 0 10:31 ? 00:00:00 postgres: port 40000, logger process gpadmin 16897 16893 0 10:31 ? 00:00:00 postgres: port 40000, stats collector process gpadmin 16898 16893 0 10:31 ? 00:00:00 postgres: port 40000, writer process gpadmin 16899 16893 0 10:31 ? 00:00:00 postgres: port 40000, checkpoint process gpadmin 16900 16893 0 10:31 ? 00:00:00 postgres: port 40000, sweeper process gpadmin 16917 16013 0 10:33 pts/1 00:00:00 grep post
也可以通过gpstate命令来查看数据库的状态,相关信息将在下一章节在介绍。
2.3 设置环境变量(所有节点)
将MASTER_DATA_DIRECTORY环境变量添加到profile中。
[gpadmin@mdw gpseg-1]$ vi /home/gpadmin/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH source /gpdb/app/greenplum_path.sh export MASTER_DATA_DIRECTORY=/gpdb/gpdata/master/gpseg-1
通过下面的命令使之生效。
[gpadmin@mdw gpseg-1]$ . ~/.bash_profile