参考:http://www.dbrabbit.com/archivers/centos-5-7%E4%B8%8A%E5%AE%89%E8%A3%85greenplum%E4%B8%80%E5%8F%B0%E8%99%9A%E6%8B%9F%E6%9C%BA.html
[gpadmin@sgpc146 ~]$ ll total 20 -rw-rw-r-- 1 gpadmin gpadmin 5 Sep 28 19:53 all_hosts drwxrwxr-x 2 gpadmin gpadmin 4096 Sep 28 20:39 gpAdminLogs drwxrwxr-x 2 gpadmin gpadmin 4096 Sep 28 20:25 gpconfigs -rw-rw-r-- 1 gpadmin gpadmin 3193 Sep 28 20:34 gpinitsystem_config -rw-rw-r-- 1 gpadmin gpadmin 5 Sep 28 20:07 seg_hosts [gpadmin@sgpc146 ~]$ more all_hosts sdw1 [gpadmin@sgpc146 ~]$ more seg_hosts sdw1 [gpadmin@sgpc146 ~]$ more /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. #127.0.0.1 localhost.localdomain localhost 127.0.0.1 localhost mdw sdw1 129.100.253.146 sgpc146 [gpadmin@sgpc146 ~]$
1.内核参数设置
设置下列参数到/etc/sysctl.conf文件中.然后运行sysctl -p使其生效.这些参数是不要随便修改它的数字,后面在执行gpcheck的时候会严格校验,发现和其中不一样,会报错.
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.arp_filter = 1
net.ipv4.ip_local_port_range=1025 65535
net.core.netdev_max_backlog=10000
vm.overcommit_memory=2
2.设置下列参数到/etc/security/limits.conf文件
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
3.用root登陆到Master主机上安装Greenplum binaries
# /bin/bash greenplum-db-4.1.1.8-build-2-RHEL5-x86_64.bin
4.创建gpadmin用户
[root@greenplum tmp]# useradd gpadmin
[root@greenplum tmp]# passwd gpadmin
Changing password for user gpadmin.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
5.创建seg_hosts和all_hosts文件并进行编辑
因为我们就只使用了一台虚拟机既做Master节点,又做Segment节点,因此,这两个文件的内容只要填写一个主机名就行了,在多台的环境下面,需要按照实际环境来进行修改.
6.使用gpssh-exkeys给root用户交换密钥
[root@greenplum greenplum-db]# pwd
/usr/local/greenplum-db
[root@greenplum greenplum-db]# source greenplum_path.sh
[root@greenplum greenplum-db]# cat /home/gpadmin/all_hosts
greenplum.localdomain
[root@greenplum greenplum-db]# gpssh-exkeys -f /home/gpadmin/all_hosts
[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
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
[INFO] completed successfully
7.使用gpssh来同步设置
SSH配置好了之后,就可以用gpssh来同步设置,例如创建用户,同步安装介质等.但是因为我们这里就用到一台虚拟机,此步骤可以忽略,真实情况如下演示所示:
[root@greenplum greenplum-db]# gpssh -f /home/gpadmin/seg_hosts 'useradd gpadmin'
[greenplum.localdomain] useradd: user gpadmin exists
8.修改GreenPlum安装目录的用户和属主
[root@greenplum local]# chown -R gpadmin:gpadmin greenplum-db-4.1.1.8/
[root@greenplum local]# chown -R gpadmin:gpadmin greenplum-db
[root@greenplum local]# ll
total 84
drwxr-xr-x 2 root root 4096 May 11 2011 bin
drwxr-xr-x 2 root root 4096 May 11 2011 etc
drwxr-xr-x 2 root root 4096 May 11 2011 games
lrwxrwxrwx 1 gpadmin gpadmin 22 Feb 19 21:30 greenplum-db -> ./greenplum-db-4.1.1.8
drwxr-xr-x 11 gpadmin gpadmin 4096 Feb 19 21:30 greenplum-db-4.1.1.8
drwxr-xr-x 2 root root 4096 May 11 2011 include
drwxr-xr-x 2 root root 4096 May 11 2011 lib
drwxr-xr-x 2 root root 4096 May 11 2011 lib64
drwxr-xr-x 2 root root 4096 May 11 2011 libexec
drwxr-xr-x 2 root root 4096 May 11 2011 sbin
drwxr-xr-x 4 root root 4096 Feb 18 21:03 share
drwxr-xr-x 2 root root 4096 May 11 2011 src
9.配置gpadmin用户的环境变量
[gpadmin@greenplum ~]$ cat .bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
source /usr/local/greenplum-db/greenplum_path.sh
10.给master和segment创建data目录
[root@greenplum local]# mkdir /gpmaster
[root@greenplum local]# chown gpadmin:gpadmin /gpmaster/
[root@greenplum local]# mkdir /gpsegment1
[root@greenplum local]# chown gpadmin:gpadmin /gpsegment1/
[root@greenplum local]# mkdir /gpsegment2
[root@greenplum local]# chown gpadmin:gpadmin /gpsegment2/
11.使用gpssh-exkeys给gpadmin用户交换密钥
[gpadmin@greenplum ~]$ id
uid=500(gpadmin) gid=500(gpadmin) groups=500(gpadmin)
[gpadmin@greenplum ~]$ gpssh-exkeys -f /home/gpadmin/all_hosts
[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
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
[INFO] completed successfully
12.同步系统时钟
[gpadmin@greenplum ~]$ gpssh -f seg_hosts -v date
[Reset ...]
[INFO] login greenplum.localdomain
[greenplum.localdomain] Sun Feb 19 22:12:45 CST 2012
[INFO] completed successfully
[Cleanup...]
13.却换到root下面执行运行OS方面的校验
[root@greenplum local]# gpcheck -f /home/gpadmin/all_hosts -m greenplum.localdomain -s greenplum.localdoamin
14.使用gpcheckperf验证网络性能
因为我们使用了一台虚拟机来完成,所以这个步骤可以省略
15.验证磁盘I/O和内存带宽
[root@greenplum local]# gpcheckperf -f /heome/gpadmin/seg_hosts -r ds -D -d /gpsegment1 -d /gpsegment2
初始化gp:
[gpadmin@sgpc146 ~]$ vi gpinitsystem_config #### 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=(/data1/mirror /data1/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror) ################################################ #### OTHER OPTIONAL PARAMETERS ################################################ #### Create a database of this name after initialization. #DATABASE_NAME=name_of_database #### Specify the location of the host address file here instead of #### with the the -h option of gpinitsystem. #MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem CHINE_LIST_FILE=/home/gpadmin/seg_hosts ARRAY_NAME="EMC Greenplum DW" SEG_PREFIX=gpseg PORT_BASE=40000 declare -a DATA_DIRECTORY=(/gpsegment1 /gpsegment2) MASTER_HOSTNAME=mdw MASTER_DIRECTORY=/data/master MASTER_PORT=5432 TRUSTED_SHELL=ssh CHECK_POINT_SEGMENTS=8 ENCODING=UNICODE #MIRROR_PORT_BASE=50000 #REPLICATION_PORT_BASE=41000 #MIRROR_REPLICATION_PORT_BASE=51000 #declare -a MIRROR_DATA_DIRECTORY=(/data/mirror /data/mirror) #DATABASE_NAME=name_of_database #MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem [gpadmin@sgpc146 ~]$ vi gpinitsystem_config #### 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=(/data1/mirror /data1/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror) ################################################ #### OTHER OPTIONAL PARAMETERS ################################################ #### Create a database of this name after initialization. #DATABASE_NAME=name_of_database #### Specify the location of the host address file here instead of #### with the the -h option of gpinitsystem. #MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem ARRAY_NAME="EMC Greenplum DW" SEG_PREFIX=gpseg PORT_BASE=40000 declare -a DATA_DIRECTORY=(/gpsegment1 /gpsegment2) MASTER_HOSTNAME=mdw MASTER_DIRECTORY=/data/master MASTER_PORT=5432 TRUSTED_SHELL=ssh CHECK_POINT_SEGMENTS=8 ENCODING=UNICODE #MIRROR_PORT_BASE=50000 #REPLICATION_PORT_BASE=41000 #MIRROR_REPLICATION_PORT_BASE=51000 #declare -a MIRROR_DATA_DIRECTORY=(/data/mirror /data/mirror) #DATABASE_NAME=name_of_database #MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem MACHINE_LIST_FILE=/home/gpadmin/seg_hosts "gpinitsystem_config" 98L, 3193C written [gpadmin@sgpc146 ~]$ ll total 20 -rw-rw-r-- 1 gpadmin gpadmin 5 Sep 28 19:53 all_hosts drwxrwxr-x 2 gpadmin gpadmin 4096 Sep 28 16:57 gpAdminLogs drwxrwxr-x 2 gpadmin gpadmin 4096 Sep 28 20:25 gpconfigs -rw-rw-r-- 1 gpadmin gpadmin 3193 Sep 28 20:34 gpinitsystem_config -rw-rw-r-- 1 gpadmin gpadmin 5 Sep 28 20:07 seg_hosts [gpadmin@sgpc146 ~]$ gpinitsystem -c /home/gpadmin/gpinitsystem_config 20110928:20:34:19:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Checking configuration parameters, please wait... 20110928:20:34:19:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Reading Greenplum configuration file /home/gpadmin/gpinitsystem_config 20110928:20:34:19:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Locale has not been set in /home/gpadmin/gpinitsystem_config, will set to default value 20110928:20:34:19:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Locale set to en_US.utf8 20110928:20:34:19:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-Master hostname mdw does not match hostname output 20110928:20:34:19:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Checking to see if mdw can be resolved on this host The authenticity of host 'mdw (127.0.0.1)' can't be established. RSA key fingerprint is 11:2a:87:60:e5:2f:fd:56:d0:eb:96:bb:a9:45:89:df. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'mdw' (RSA) to the list of known hosts. 20110928:20:34:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Can resolve mdw to this host 20110928:20:34:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates 20110928:20:34:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250 20110928:20:34:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Detected a single host GPDB array build, reducing value of BATCH_DEFAULT from 60 to 4 20110928:20:34:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Checking configuration parameters, Completed 20110928:20:34:50:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Commencing multi-home checks, please wait... . 20110928:20:34:50:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Configuring build for standard array 20110928:20:34:50:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Commencing multi-home checks, Completed 20110928:20:34:50:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Building primary segment instance array, please wait... .. 20110928:20:34:51:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Checking Master host 20110928:20:34:51:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Checking new segment hosts, please wait... .20110928:20:34:52:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:----------------------------------------------------------- 20110928:20:34:52:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-Host sdw1 is assigned as localhost in /etc/hosts 20110928:20:34:52:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-This will cause segment->master communication failures 20110928:20:34:52:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-Remove sdw1 from local host line in /etc/hosts 20110928:20:34:52:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:----------------------------------------------------------- .20110928:20:34:52:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:----------------------------------------------------------- 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-Host sdw1 is assigned as localhost in /etc/hosts 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-This will cause segment->master communication failures 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-Remove sdw1 from local host line in /etc/hosts 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:----------------------------------------------------------- 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Checking new segment hosts, Completed 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Greenplum Database Creation Parameters 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:--------------------------------------- 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master Configuration 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:--------------------------------------- 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master instance name = EMC Greenplum DW 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master hostname = mdw 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master port = 5432 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master instance dir = /data/master/gpseg-1 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master LOCALE = en_US.utf8 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Greenplum segment prefix = gpseg 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master Database = 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master connections = 250 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master buffers = 128000kB 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Segment connections = 750 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Segment buffers = 128000kB 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Checkpoint segments = 8 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Encoding = UNICODE 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Postgres param file = Off 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Initdb to be used = /usr/local/greenplum-db/./bin/initdb 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-GP_LIBRARY_PATH is = /usr/local/greenplum-db/./lib 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Ulimit check = Passed 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Array host connect type = Single hostname per node 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master IP address [1] = ::1 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master IP address [2] = 129.100.253.146 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master IP address [3] = 169.254.95.120 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master IP address [4] = 2002:8164:fdd6:b:3640:b5ff:fea2:119c 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master IP address [5] = 2002:8164:fdde:b:3640:b5ff:fea2:119c 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master IP address [6] = fe80::3440:b5ff:fe9b:119f 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master IP address [7] = fe80::3640:b5ff:fea2:119c 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Master IP address [8] = fec0::b:3640:b5ff:fea2:119c 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Standby Master = Not Configured 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Primary segment # = 2 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Total Database segments = 2 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Trusted shell = ssh 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Number segment hosts = 1 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Mirroring config = OFF 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:---------------------------------------- 20110928:20:34:53:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Greenplum Primary Segment Configuration 20110928:20:34:54:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:---------------------------------------- 20110928:20:34:54:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-sdw1 /gpsegment1/gpseg0 40000 2 0 20110928:20:34:54:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-sdw1 /gpsegment2/gpseg1 40001 3 1 Continue with Greenplum creation Yy/Nn> y 20110928:20:34:58:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Building the Master instance database, please wait... 20110928:20:35:09:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Starting the Master in admin mode 20110928:20:35:29:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Commencing parallel build of primary segment instances 20110928:20:35:29:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Spawning parallel processes batch [1], please wait... .. 20110928:20:35:30:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait... ................... 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:------------------------------------------------ 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Parallel process exit status 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:------------------------------------------------ 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Total processes marked as completed = 2 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Total processes marked as killed = 0 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Total processes marked as failed = 0 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:------------------------------------------------ 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Deleting distributed backout files 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Removing back out file 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-No errors generated from parallel processes 20110928:20:35:49:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Starting gpstop with args: -a -i -m -d /data/master/gpseg-1 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Gathering information and validating the environment... 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Obtaining Segment details from master... 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.2.1.2 build 2' 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-There are 0 connections to the database 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='immediate' 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Master host=sgpc146 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate 20110928:20:35:49:018848 gpstop:sgpc146:gpadmin-[INFO]:-Master segment instance directory=/data/master/gpseg-1 20110928:20:35:51:018937 gpstart:sgpc146:gpadmin-[INFO]:-Starting gpstart with args: -a -d /data/master/gpseg-1 20110928:20:35:51:018937 gpstart:sgpc146:gpadmin-[INFO]:-Gathering information and validating the environment... 20110928:20:35:51:018937 gpstart:sgpc146:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.2.1.2 build 2' 20110928:20:35:51:018937 gpstart:sgpc146:gpadmin-[INFO]:-Greenplum Catalog Version: '201109210' 20110928:20:35:51:018937 gpstart:sgpc146:gpadmin-[INFO]:-Starting Master instance in admin mode 20110928:20:35:52:018937 gpstart:sgpc146:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20110928:20:35:52:018937 gpstart:sgpc146:gpadmin-[INFO]:-Obtaining Segment details from master... 20110928:20:35:52:018937 gpstart:sgpc146:gpadmin-[INFO]:-Setting new master era 20110928:20:35:52:018937 gpstart:sgpc146:gpadmin-[INFO]:-Master Started... 20110928:20:35:52:018937 gpstart:sgpc146:gpadmin-[INFO]:-Shutting down master 20110928:20:35:53:018937 gpstart:sgpc146:gpadmin-[INFO]:-No standby master configured. skipping... 20110928:20:35:53:018937 gpstart:sgpc146:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait... .. 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:-Process results... 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:- Successful segment starts = 2 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:- Failed segment starts = 0 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:- 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:-Successfully started 2 of 2 segment instances 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:35:55:018937 gpstart:sgpc146:gpadmin-[INFO]:-Starting Master instance sgpc146 directory /data/master/gpseg-1 20110928:20:35:56:018937 gpstart:sgpc146:gpadmin-[INFO]:-Command pg_ctl reports Master sgpc146 instance active 20110928:20:35:56:018937 gpstart:sgpc146:gpadmin-[INFO]:-Database successfully started 20110928:20:35:56:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode 20110928:20:35:56:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Loading gp_toolkit... 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Scanning utility log file for any warning messages 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-******************************************************* 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-Scan of log file indicates that some warnings or errors 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-were generated during the array creation 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Please review contents of log file 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20110928.log 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-To determine level of criticality 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-These messages could be from a previous run of the utility 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-that was called today! 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[WARN]:-******************************************************* 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Greenplum Database instance successfully created 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:------------------------------------------------------- 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-To complete the environment configuration, please 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-update gpadmin .bashrc file with the following 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/data/master/gpseg-1" 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:- to access the Greenplum scripts for this instance: 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:- or, use -d /data/master/gpseg-1 option for the Greenplum scripts 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:- Example gpstate -d /data/master/gpseg-1 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20110928.log 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Review options for gpinitstandby 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:------------------------------------------------------- 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-The Master /data/master/gpseg-1/pg_hba.conf post gpinitsystem 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-has been configured to allow all hosts within this new 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this 20110928:20:35:57:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-new array must be explicitly added to this file 20110928:20:35:58:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is 20110928:20:35:58:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:-located in the /usr/local/greenplum-db/./docs directory 20110928:20:35:58:004425 gpinitsystem:sgpc146:gpadmin-[INFO]:------------------------------------------------------- [gpadmin@sgpc146 ~]$ [gpadmin@sgpc146 ~]$ [gpadmin@sgpc146 ~]$ [gpadmin@sgpc146 ~]$ [gpadmin@sgpc146 ~]$
设置MASTER_DATA_DIRECTORY环境变量
初始化结束后,运行gpstat -s查看状态,会失败,它会提示你需要设置MASTER_DATA_DIRECTORY环境
[gpadmin@sgpc146 ~]$ gpstate -s 20110928:20:37:34:020820 gpstate:sgpc146:gpadmin-[INFO]:-Starting gpstate with args: -s 20110928:20:37:34:020820 gpstate:sgpc146:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.2.1.2 build 2' 20110928:20:37:34:020820 gpstate:sgpc146:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.2.1.2 build 2) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Jun 11 2012 16:28:44' 20110928:20:37:34:020820 gpstate:sgpc146:gpadmin-[INFO]:-Obtaining Segment details from master... 20110928:20:37:34:020820 gpstate:sgpc146:gpadmin-[INFO]:-Gathering data from segments... . 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:--Master Configuration & Status 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Master host = sgpc146 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Master postgres process ID = 19078 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Master data directory = /data/master/gpseg-1 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Master port = 5432 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Master current role = dispatch 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Greenplum initsystem version = 4.2.1.2 build 2 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Greenplum current version = PostgreSQL 8.2.15 (Greenplum Database 4.2.1.2 build 2) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Jun 11 2012 16:28:44 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Postgres version = 8.2.15 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Master standby = No master standby configured 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:-Segment Instance Status Report 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Segment Info 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Hostname = sgpc146 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Address = sdw1 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Datadir = /gpsegment1/gpseg0 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Port = 40000 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Status 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- PID = 19047 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Configuration reports status as = Up 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Database status = Up 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Segment Info 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Hostname = sgpc146 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Address = sdw1 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Datadir = /gpsegment2/gpseg1 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Port = 40001 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Status 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- PID = 19048 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Configuration reports status as = Up 20110928:20:37:35:020820 gpstate:sgpc146:gpadmin-[INFO]:- Database status = Up
尝试连接到postgres数据库:
[gpadmin@sgpc146 ~]$ psql -d postgres psql (8.2.15) Type "help" for help. postgres=# select datname,datdba,encoding,datacl from pg_database; datname | datdba | encoding | datacl -----------+--------+----------+---------------------------------- postgres | 10 | 6 | template1 | 10 | 6 | {=c/gpadmin,gpadmin=CTc/gpadmin} template0 | 10 | 6 | {=c/gpadmin,gpadmin=CTc/gpadmin} (3 rows) postgres=# \q [gpadmin@sgpc146 ~]$ gpstop -a 20110928:20:39:32:021338 gpstop:sgpc146:gpadmin-[INFO]:-Starting gpstop with args: -a 20110928:20:39:32:021338 gpstop:sgpc146:gpadmin-[INFO]:-Gathering information and validating the environment... 20110928:20:39:32:021338 gpstop:sgpc146:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20110928:20:39:32:021338 gpstop:sgpc146:gpadmin-[INFO]:-Obtaining Segment details from master... 20110928:20:39:33:021338 gpstop:sgpc146:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.2.1.2 build 2' 20110928:20:39:33:021338 gpstop:sgpc146:gpadmin-[INFO]:-There are 0 connections to the database 20110928:20:39:33:021338 gpstop:sgpc146:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='smart' 20110928:20:39:33:021338 gpstop:sgpc146:gpadmin-[INFO]:-Master host=sgpc146 20110928:20:39:33:021338 gpstop:sgpc146:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=smart 20110928:20:39:33:021338 gpstop:sgpc146:gpadmin-[INFO]:-Master segment instance directory=/data/master/gpseg-1 20110928:20:39:34:021338 gpstop:sgpc146:gpadmin-[INFO]:-No standby master host configured 20110928:20:39:34:021338 gpstop:sgpc146:gpadmin-[INFO]:-Commencing parallel segment instance shutdown, please wait... ... 20110928:20:39:37:021338 gpstop:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:39:37:021338 gpstop:sgpc146:gpadmin-[INFO]:- Segments stopped successfully = 2 20110928:20:39:37:021338 gpstop:sgpc146:gpadmin-[INFO]:- Segments with errors during stop = 0 20110928:20:39:37:021338 gpstop:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:39:37:021338 gpstop:sgpc146:gpadmin-[INFO]:-Successfully shutdown 2 of 2 segment instances 20110928:20:39:37:021338 gpstop:sgpc146:gpadmin-[INFO]:-Database successfully shutdown with no errors reported [gpadmin@sgpc146 ~]$ [gpadmin@sgpc146 ~]$ psql -d postgres psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? [gpadmin@sgpc146 ~]$ [gpadmin@sgpc146 ~]$ [gpadmin@sgpc146 ~]$ gpstart -a 20110928:20:40:00:021497 gpstart:sgpc146:gpadmin-[INFO]:-Starting gpstart with args: -a 20110928:20:40:00:021497 gpstart:sgpc146:gpadmin-[INFO]:-Gathering information and validating the environment... 20110928:20:40:00:021497 gpstart:sgpc146:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.2.1.2 build 2' 20110928:20:40:00:021497 gpstart:sgpc146:gpadmin-[INFO]:-Greenplum Catalog Version: '201109210' 20110928:20:40:00:021497 gpstart:sgpc146:gpadmin-[INFO]:-Starting Master instance in admin mode 20110928:20:40:01:021497 gpstart:sgpc146:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information 20110928:20:40:01:021497 gpstart:sgpc146:gpadmin-[INFO]:-Obtaining Segment details from master... 20110928:20:40:01:021497 gpstart:sgpc146:gpadmin-[INFO]:-Setting new master era 20110928:20:40:01:021497 gpstart:sgpc146:gpadmin-[INFO]:-Master Started... 20110928:20:40:01:021497 gpstart:sgpc146:gpadmin-[INFO]:-Shutting down master 20110928:20:40:03:021497 gpstart:sgpc146:gpadmin-[INFO]:-No standby master configured. skipping... 20110928:20:40:03:021497 gpstart:sgpc146:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait... .. 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:-Process results... 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:- Successful segment starts = 2 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:- Failed segment starts = 0 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:- Skipped segment starts (segments are marked down in configuration) = 0 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:- 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:-Successfully started 2 of 2 segment instances 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:----------------------------------------------------- 20110928:20:40:05:021497 gpstart:sgpc146:gpadmin-[INFO]:-Starting Master instance sgpc146 directory /data/master/gpseg-1 20110928:20:40:06:021497 gpstart:sgpc146:gpadmin-[INFO]:-Command pg_ctl reports Master sgpc146 instance active 20110928:20:40:06:021497 gpstart:sgpc146:gpadmin-[INFO]:-Database successfully started [gpadmin@sgpc146 ~]$ psql -d postgres psql (8.2.15) Type "help" for help. postgres=# select datname,datdba,encoding,datacl from pg_database; datname | datdba | encoding | datacl -----------+--------+----------+---------------------------------- postgres | 10 | 6 | template1 | 10 | 6 | {=c/gpadmin,gpadmin=CTc/gpadmin} template0 | 10 | 6 | {=c/gpadmin,gpadmin=CTc/gpadmin} (3 rows) postgres=# select datname,datdba,encoding,datacl from pg_database; datname | datdba | encoding | datacl -----------+--------+----------+---------------------------------- postgres | 10 | 6 | template1 | 10 | 6 | {=c/gpadmin,gpadmin=CTc/gpadmin} template0 | 10 | 6 | {=c/gpadmin,gpadmin=CTc/gpadmin} (3 rows) postgres=#
[gpadmin@sggp ~]$ gpcheckperf -f seg_hosts -r ds -D -d segmentdata
/usr/local/greenplum-db/./bin/gpcheckperf -f seg_hosts -r ds -D -d segmentdata
--------------------
-- DISK WRITE TEST
--------------------
--------------------
-- DISK READ TEST
--------------------
--------------------
-- STREAM TEST
--------------------
====================
== RESULT
====================
disk write avg time (sec): 107.08
disk write tot bytes: 33694318592
disk write tot bandwidth (MB/s): 300.09
disk write min bandwidth (MB/s): 300.09 [sdw]
disk write max bandwidth (MB/s): 300.09 [sdw]
-- per host bandwidth --
disk write bandwidth (MB/s): 300.09 [sdw]
disk read avg time (sec): 72.46
disk read tot bytes: 33694318592
disk read tot bandwidth (MB/s): 443.46
disk read min bandwidth (MB/s): 443.46 [sdw]
disk read max bandwidth (MB/s): 443.46 [sdw]
-- per host bandwidth --
disk read bandwidth (MB/s): 443.46 [sdw]
stream tot bandwidth (MB/s): 4814.12
stream min bandwidth (MB/s): 4814.12 [sdw]
stream max bandwidth (MB/s): 4814.12 [sdw]
-- per host bandwidth --
stream bandwidth (MB/s): 4814.12 [sdw]
[gpadmin@sggp ~]$