Centos 5.7上安装GreenPlum(单虚拟机)

在安装GreenPlum之前,先介绍一下基础架构,这样有个概念.

GreenPlum是一种基于postgresql(开源数据库)的分布式数据库.它采用的是shared nothing架构(MPP),主机、操作系统、内存、存储都是自我控制,不存在着共享.它主要由master host,segment host,interconnect三大部分构成.

Master节点GreenPlum数据库的入口点,它主要是处理客户端发起的连接访问,同时还处理进程执行的SQL语句.由于GreenPlum数据库的引擎是基于PostrgeSql,当用户连接到GreenPlummaster节点的时候会感觉就像是连接到到一台postgresql数据库一样.并且可以通过psql、应用程序的api接口来连接GreenPlum数据库.Master下面存放到是全局的系统目录.(global system catalog),包含系统表和元数据,不包含用户的数据.用户数据是存放在segment.

Master节点做以下事情:

  • 客户端访问连接的认证.
  • 处理传入的SQL语句.
  • segment之间分配工作负荷..
  • 协调每个segment返回的结果,并把最终结果返回给客户端..

Segment节点主要做数据存储和数据处理,用户创建的索引和表被分发到各个子节点当中,每一个子节点都包含了用户数据的分片,而这些分片不存在重复的情况.

InterconnectGreenPlum数据库的网络层.在每个segment中起到一个ipc的作用(inter-process communication).GreenPlum数据库推荐使用标准的千兆以太网交换机来做Interconnect.默认情况下,Interconnect默认使用的是UDP协议来进行传输,因为在GreenPlum的软件当中,它没有其他包去检查和验证UDP,所以可靠性上等同于TCP协议,并且超过了TCP的性能和可扩展性,而且使用TCP协议就会有一个限制,最大只能使用1000segment实例.

下面开始介绍安装:因为是一台虚拟机实现,即是Master节点,又是Segment节点,所以省略了网络的配置.默认安装好一台CentOS 5.7的主机就好.

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

[root@greenplum tmp]# unzip greenplum-db-4.1.1.8-build-2-RHEL5-x86_64.zip
Archive:  greenplum-db-4.1.1.8-build-2-RHEL5-x86_64.zip
inflating: README_INSTALL
inflating: greenplum-db-4.1.1.8-build-2-RHEL5-x86_64.bin
[root@greenplum tmp]# /bin/bash greenplum-db-4.1.1.8-build-2-RHEL5-x86_64.bin
********************************************************************************
You must read and accept the Greenplum Database license agreement
before installing
********************************************************************************
I HAVE READ AND AGREE TO THE TERMS OF THE ABOVE GREENPLUM SOFTWARE
LICENSE AGREEMENT.
********************************************************************************
Do you accept the Greenplum 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-4.1.1.8
********************************************************************************

********************************************************************************
Install Greenplum Database into </usr/local/greenplum-db-4.1.1.8>? [yes|no]
********************************************************************************
yes
********************************************************************************
/usr/local/greenplum-db-4.1.1.8 does not exist.
Create /usr/local/greenplum-db-4.1.1.8 ? [yes|no]
(Selecting no will exit the installer)
********************************************************************************
yes
Extracting product to /usr/local/greenplum-db-4.1.1.8
********************************************************************************
Installation complete.
Greenplum Database is installed in /usr/local/greenplum-db-4.1.1.8
Greenplum Database documentation is available for download
at http://powerlink.emc.com.
********************************************************************************

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_hostsall_hosts文件并进行编辑

因为我们就只使用了一台虚拟机既做Master节点,又做Segment节点,因此,这两个文件的内容只要填写一个主机名就行了,在多台的环境下面,需要按照实际环境来进行修改.

6.使用gpssh-exkeysroot用户交换密钥

[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.给mastersegment创建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-exkeysgpadmin用户交换密钥

[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
20120219:22:30:51:gpcheck:greenplum:root-[INFO]:-dedupe hostnames
20120219:22:30:52:gpcheck:greenplum:root-[INFO]:-Detected platform: Generic Linux Cluster
20120219:22:30:52:gpcheck:greenplum:root-[INFO]:-generate data on servers
20120219:22:30:53:gpcheck:greenplum:root-[INFO]:-copy data files from servers
20120219:22:30:54:gpcheck:greenplum:root-[INFO]:-delete remote tmp files
20120219:22:30:55:gpcheck:greenplum:root-[INFO]:-Using gpcheck config file: /usr/local/greenplum-db/./etc/gpcheck.cnf
20120219:22:30:55:gpcheck:greenplum:root-[ERROR]:-GPCHECK_ERROR host(greenplum.localdomain): on device (fd0) IO scheduler 'cfq'
does not match expected value 'deadline'
20120219:22:30:55:gpcheck:greenplum:root-[ERROR]:-GPCHECK_ERROR host(greenplum.localdomain): on device (hdc) IO scheduler 'cfq'
does not match expected value 'deadline'
20120219:22:30:55:gpcheck:greenplum:root-[ERROR]:-GPCHECK_ERROR host(greenplum.localdomain): on device (sda) IO scheduler 'cfq'
does not match expected value 'deadline'
20120219:22:30:55:gpcheck:greenplum:root-[ERROR]:-GPCHECK_ERROR host(greenplum.localdomain): on device (/dev/sda1) blockdev readahead value '256'
does not match expected value '16384'
20120219:22:30:55:gpcheck:greenplum:root-[ERROR]:-GPCHECK_ERROR host(greenplum.localdomain): on device (/dev/sda2) blockdev readahead value '256'
does not match expected value '16384'
20120219:22:30:55:gpcheck:greenplum:root-[ERROR]:-GPCHECK_ERROR host(greenplum.localdomain): on device (/dev/sda) blockdev readahead value '256'
does not match expected value '16384'
20120219:22:30:55:gpcheck:greenplum:root-[ERROR]:-GPCHECK_ERROR host(greenplum.localdomain): ntpd not detected on machine
20120219:22:30:55:gpcheck:greenplum:root-[INFO]:-gpcheck completing...

这里出现的错误主要是每个设备文件都得预读值都应该是16384,因为是虚拟机安装,所以此类错误可忽略

[root@greenplum local]# /sbin/blockdev --getra /dev/sda
256
[root@greenplum local]# /sbin/blockdev --getra /dev/sda1
256

14.使用gpcheckperf验证网络性

因为我们使用了一台虚拟机来完成,所以这个步骤可以省

15.验证磁盘I/O和内存带宽

[root@greenplum local]# gpcheckperf -f /heome/gpadmin/seg_hosts -r ds -D -d /gpsegment1 -d /gpsegment2
/usr/local/greenplum-db/./bin/gpcheckperf -f /home/gpadmin/seg_hosts -r ds -D -d /gpsegment1 -d /gpsegment2
--------------------
--  DISK WRITE TEST
--------------------
--------------------
--  DISK READ TEST
--------------------
--------------------
--  STREAM TEST
--------------------
====================
==  RESULT
====================
disk write avg time (sec): 25.93
disk write tot bytes: 4216324096
disk write tot bandwidth (MB/s): 155.07
disk write min bandwidth (MB/s): 155.07 [greenplum.localdomain]
disk write max bandwidth (MB/s): 155.07 [greenplum.localdomain]
-- per host bandwidth --
disk write bandwidth (MB/s): 155.07 [greenplum.localdomain]
disk read avg time (sec): 16.91
disk read tot bytes: 4216324096
disk read tot bandwidth (MB/s): 237.79
disk read min bandwidth (MB/s): 237.79 [greenplum.localdomain]
disk read max bandwidth (MB/s): 237.79 [greenplum.localdomain]
-- per host bandwidth --
disk read bandwidth (MB/s): 237.79 [greenplum.localdomain]
stream tot bandwidth (MB/s): 8963.98
stream min bandwidth (MB/s): 8963.98 [greenplum.localdomain]
stream max bandwidth (MB/s): 8963.98 [greenplum.localdomain]
-- per host bandwidth --
stream bandwidth (MB/s): 8963.98 [greenplum.localdomain]

16.初始化gp

[gpadmin@greenplum ~]$ mkdir gpconfigs/
[gpadmin@greenplum ~]$ cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config
/home/gpadmin/gpconfigs/gpinitsystem_config
--根据情况修改下列参数值
ARRAY_NAME="EMC Greenplum DW"
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/gpsegment1 /gpsegment2)
MASTER_HOSTNAME=greenplum.localdomain
MASTER_DIRECTORY=/gpmaster
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
MACHINE_LIST_FILE=/home/gpadmin/seg_hosts
[gpadmin@greenplum ]$ gpinitsystem -c /home/gpoadmin/gpconfigs/gpinitsystem_config
20120219:23:54:20:gpinitsystem:greenplum:gpadmin-[INFO]:-Checking configuration parameters, please wait...
20120219:23:54:20:gpinitsystem:greenplum:gpadmin-[INFO]:-Reading Greenplum configuration file /home/gpadmin/gpconfigs/gpinitsystem_config
20120219:23:54:20:gpinitsystem:greenplum:gpadmin-[INFO]:-Locale has not been set in /home/gpadmin/gpconfigs/gpinitsystem_config, will set to default value
20120219:23:54:21:gpinitsystem:greenplum:gpadmin-[INFO]:-Locale set to en_US.utf8
20120219:23:54:21:gpinitsystem:greenplum:gpadmin-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20120219:23:54:21:gpinitsystem:greenplum:gpadmin-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 25
20120219:23:54:21:gpinitsystem:greenplum:gpadmin-[INFO]:-Detected a single host GPDB array build, reducing value of BATCH_DEFAULT from 60 to 4
20120219:23:54:22:gpinitsystem:greenplum:gpadmin-[INFO]:-Checking configuration parameters, Completed
20120219:23:54:22:gpinitsystem:greenplum:gpadmin-[INFO]:-Commencing multi-home checks, please wait...
.
20120219:23:54:22:gpinitsystem:greenplum:gpadmin-[INFO]:-Configuring build for standard array
20120219:23:54:22:gpinitsystem:greenplum:gpadmin-[INFO]:-Commencing multi-home checks, Completed
20120219:23:54:22:gpinitsystem:greenplum:gpadmin-[INFO]:-Building primary segment instance array, please wait...
..
20120219:23:54:23:gpinitsystem:greenplum:gpadmin-[INFO]:-Checking Master host
20120219:23:54:24:gpinitsystem:greenplum:gpadmin-[INFO]:-Checking new segment hosts, please wait...
.
20120219:23:54:26:gpinitsystem:greenplum:gpadmin-[WARN]:-----------------------------------------------------------
20120219:23:54:26:gpinitsystem:greenplum:gpadmin-[WARN]:-Host greenplum.localdomain is assigned as localhost in /etc/hosts
20120219:23:54:26:gpinitsystem:greenplum:gpadmin-[WARN]:-This will cause segment->master communication failures
20120219:23:54:26:gpinitsystem:greenplum:gpadmin-[WARN]:-Remove greenplum.localdomain from local host line in /etc/hosts
20120219:23:54:26:gpinitsystem:greenplum:gpadmin-[WARN]:-----------------------------------------------------------
.
20120219:23:54:27:gpinitsystem:greenplum:gpadmin-[WARN]:-----------------------------------------------------------
20120219:23:54:27:gpinitsystem:greenplum:gpadmin-[WARN]:-Host greenplum.localdomain is assigned as localhost in /etc/hosts
20120219:23:54:27:gpinitsystem:greenplum:gpadmin-[WARN]:-This will cause segment->master communication failures
20120219:23:54:27:gpinitsystem:greenplum:gpadmin-[WARN]:-Remove greenplum.localdomain from local host line in /etc/hosts
20120219:23:54:27:gpinitsystem:greenplum:gpadmin-[WARN]:-----------------------------------------------------------
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Checking new segment hosts, Completed20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Greenplum Database Creation Parameters
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:---------------------------------------
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master Configuration
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:---------------------------------------
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master instance name       = EMC Greenplum DW
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master hostname            = greenplum.localdomain
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master port                = 5432
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master instance dir        = /gpmaster/gpseg-1
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master LOCALE              = en_US.utf8
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Greenplum segment prefix   = gpseg
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master Database            =
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master connections         = 25
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master buffers             = 128000kB
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Segment connections        = 125
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Segment buffers            = 128000kB
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Checkpoint segments        = 8
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Encoding                   = UNICODE
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Postgres param file        = Off
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Initdb to be used          = /usr/local/greenplum-db/./bin/initdb
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-GP_LIBRARY_PATH is         = /usr/local/greenplum-db/./lib
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Ulimit check               = Passed
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Array host connect type    = Single hostname per node
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Master IP address [1]      = 192.168.204.116
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Standby Master             = Not Configured
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Primary segment #          = 2
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Total Database segments    = 2
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Trusted shell              = ssh
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Number segment hosts       = 1
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Mirroring config           = OFF
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:----------------------------------------
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-Greenplum Primary Segment Configuration
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:----------------------------------------
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-greenplum.localdomain  /gpsegment1/gpseg0  40000  2  0
20120219:23:54:28:gpinitsystem:greenplum:gpadmin-[INFO]:-greenplum.localdomain  /gpsegment2/gpseg1  40001  3  1
Continue with Greenplum creation Yy/Nn>
Y
20120219:23:54:35:gpinitsystem:greenplum:gpadmin-[INFO]:-Building the Master instance database, please wait...
20120219:23:54:54:gpinitsystem:greenplum:gpadmin-[INFO]:-Starting the Master in admin mode
20120219:23:55:01:gpinitsystem:greenplum:gpadmin-[INFO]:-Commencing parallel build of primary segment instances
20120219:23:55:01:gpinitsystem:greenplum:gpadmin-[INFO]:-Spawning parallel processes    batch [1], please wait...
..
20120219:23:55:02:gpinitsystem:greenplum:gpadmin-[INFO]:-Waiting for parallel processes batch [1], please wait...
........................................
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:------------------------------------------------
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:-Parallel process exit status
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:------------------------------------------------
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:-Total processes marked as completed           = 2
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:-Total processes marked as killed              = 0
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:-Total processes marked as failed              = 0
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:------------------------------------------------
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:-Deleting distributed backout files
20120219:23:55:44:gpinitsystem:greenplum:gpadmin-[INFO]:-Removing back out file
20120219:23:55:45:gpinitsystem:greenplum:gpadmin-[INFO]:-No errors generated from parallel processes
20120219:23:55:45:gpinitsystem:greenplum:gpadmin-[INFO]:-Restarting the Greenplum instance in production mode
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Starting gpstop with args: -a -i -m -d /gpmaster/gpseg-1
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Gathering information and validating the environment...
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Obtaining Segment details from master...
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.1.1.8 build 2'
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-There are 0 connections to the database
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Commencing Master instance shutdown with mode='immediate'
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Master host=greenplum.localdomain
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Commencing Master instance shutdown with mode=immediate
20120219:23:55:45:gpstop:greenplum:gpadmin-[INFO]:-Master segment instance directory=/gpmaster/gpseg-1
20120219:23:55:45:gpstart:greenplum:gpadmin-[INFO]:-Starting gpstart with args: -a -d /gpmaster/gpseg-1
20120219:23:55:45:gpstart:greenplum:gpadmin-[INFO]:-Gathering information and validating the environment...
20120219:23:55:45:gpstart:greenplum:gpadmin-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.1.1.8 build 2'
20120219:23:55:45:gpstart:greenplum:gpadmin-[INFO]:-Greenplum Catalog Version: '201101130'
20120219:23:55:45:gpstart:greenplum:gpadmin-[INFO]:-Starting Master instance in admin mode
20120219:23:55:46:gpstart:greenplum:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20120219:23:55:46:gpstart:greenplum:gpadmin-[INFO]:-Obtaining Segment details from master...
20120219:23:55:47:gpstart:greenplum:gpadmin-[INFO]:-Master Started...
20120219:23:55:47:gpstart:greenplum:gpadmin-[INFO]:-Shutting down master
20120219:23:55:50:gpstart:greenplum:gpadmin-[INFO]:-No standby master configured.  skipping...
20120219:23:55:50:gpstart:greenplum:gpadmin-[INFO]:-Commencing parallel segment instance startup, please wait...
..
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-Process results...
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-----------------------------------------------------
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-   Successful segment starts                                            = 2
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-   Failed segment starts                                                = 0
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 0
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-----------------------------------------------------
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-Successfully started 2 of 2 segment instances
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-----------------------------------------------------
20120219:23:55:52:gpstart:greenplum:gpadmin-[INFO]:-Starting Master instance greenplum.localdomain directory /gpmaster/gpseg-1
20120219:23:55:53:gpstart:greenplum:gpadmin-[INFO]:-Command pg_ctl reports Master greenplum.localdomain instance active
20120219:23:55:53:gpstart:greenplum:gpadmin-[INFO]:-Database successfully started with no errors reported
20120219:23:55:53:gpinitsystem:greenplum:gpadmin-[INFO]:-Completed restart of Greenplum instance in production mode
20120219:23:55:53:gpinitsystem:greenplum:gpadmin-[INFO]:-Loading gp_toolkit...
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-Scanning utility log file for any warning messages
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[WARN]:-*******************************************************
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[WARN]:-Scan of log file indicates that some warnings or errors
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[WARN]:-were generated during the array creation
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-Please review contents of log file
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-/home/gpadmin/gpAdminLogs/gpinitsystem_20120219.log
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-To determine level of criticality
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[WARN]:-*******************************************************
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-Greenplum Database instance successfully created
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-------------------------------------------------------
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-To complete the environment configuration, please
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-update gpadmin .bashrc file with the following
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/gpmaster/gpseg-1"
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-   to access the Greenplum scripts for this instance:
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-   or, use -d /gpmaster/gpseg-1 option for the Greenplum scripts
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-   Example gpstate -d /gpmaster/gpseg-1
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20120219.log
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-To remove instance, run gpdeletesystem utility
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance
20120219:23:55:57:gpinitsystem:greenplum:gpadmin-[INFO]:-Review options for gpinitstandby
20120219:23:55:58:gpinitsystem:greenplum:gpadmin-[INFO]:-------------------------------------------------------
20120219:23:55:58:gpinitsystem:greenplum:gpadmin-[INFO]:-The Master /gpmaster/gpseg-1/pg_hba.conf post gpinitsystem
20120219:23:55:58:gpinitsystem:greenplum:gpadmin-[INFO]:-has been configured to allow all hosts within this new
20120219:23:55:58:gpinitsystem:greenplum:gpadmin-[INFO]:-array to intercommunicate. Any hosts external to this
20120219:23:55:58:gpinitsystem:greenplum:gpadmin-[INFO]:-new array must be explicitly added to this file
20120219:23:55:58:gpinitsystem:greenplum:gpadmin-[INFO]:-Refer to the Greenplum Admin support guide which is
20120219:23:55:58:gpinitsystem:greenplum:gpadmin-[INFO]:-located in the /usr/local/greenplum-db/./docs directory
20120219:23:55:58:gpinitsystem:greenplum:gpadmin-[INFO]:------------------------------------------------------

18.设置MASTER_DATA_DIRECTORY环境变量

初始化结束后,运行gpstat -s查看状态,会失败,它会提示你需要设置MASTER_DATA_DIRECTORY环境

[gpadmin@greenplum gpconfigs]$ gpstate -s
20120220:00:03:50:gpstate:greenplum:gpadmin-[INFO]:-Starting gpstate with args: -s
20120220:00:03:50:gpstate:greenplum:gpadmin-[CRITICAL]:-gpstate failed. (Reason='Environment Variable MASTER_DATA_DIRECTORY not set!') exiting...
--在.bashrc中添加,再次运行
MASTER_DATA_DIRECTORY=/gpmaster/gpseg-1 export MASTER_DATA_DIRECTORY
[gpadmin@greenplum ~]$ gpstate -s
<pre>20120220:00:07:30:gpstate:greenplum:gpadmin-[INFO]:-Starting gpstate with args: -s
20120220:00:07:30:gpstate:greenplum:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.1.1.8 build 2'
20120220:00:07:30:gpstate:greenplum:gpadmin-[INFO]:-Obtaining Segment details from master...
20120220:00:07:30:gpstate:greenplum:gpadmin-[INFO]:-Gathering data from segments...
.
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-----------------------------------------------------
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:--Master Configuration & Status
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-----------------------------------------------------
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Master host                    = greenplum.localdomain
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Master postgres process ID     = 18610
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Master data directory          = /gpmaster/gpseg-1
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Master port                    = 5432
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Master current role            = dispatch
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Greenplum initsystem version   = 4.1.1.8 build 2
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Greenplum current version      = PostgreSQL 8.2.15 (Greenplum Database 4.1.1.8 build 2)
on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Nov 14 2011 22:44:34
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Postgres version               = 8.2.15
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Master standby                 = No master standby configured
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-----------------------------------------------------
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-Segment Instance Status Report
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-----------------------------------------------------
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Segment Info
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Hostname                          = greenplum.localdomain
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Address                           = greenplum.localdomain
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Datadir                           = /gpsegment1/gpseg0
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Port                              = 40000
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Status
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      PID                               = 18576
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Configuration reports status as   = Up
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Database status                   = Up
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-----------------------------------------------------
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Segment Info
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Hostname                          = greenplum.localdomain
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Address                           = greenplum.localdomain
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Datadir                           = /gpsegment2/gpseg1
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Port                              = 40001
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-   Status
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      PID                               = 18570
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Configuration reports status as   = Up
20120220:00:07:32:gpstate:greenplum:gpadmin-[INFO]:-      Database status                   = Up

19.尝试连接到postgres数据库

[gpadmin@greenplum ~]$ 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)
分享到: 更多

Post a Comment

Your email is never published nor shared. Required fields are marked *