greenplum(一)

商业型greenplum貌似最近很火,小小的研究了一下

一:环境搭建

  我使用的是单节点,用作测试,后续会有master主备模式,多台seg节点。

 

安装用户:smp
安装路径:/home/smp/gp/
数据目录:/home/smp/data/d1 
Master目录:/home/smp/data/master
所有节点ip list文件:/home/smp/gp/all_hosts
Agent节点文件:/home/smp/gp/seg_hosts
配置文件:/home/smp/gpinitsystem_config 
      cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config  /home/smp/gpinitsystem_config
      chmod 644 /home/smp/gpinitsystem_config
      对配置文件 /home/smp/gpinitsystem_config进行相应的修改

1. 编辑: /etc/hosts

   加入所有节点ip地址,并加入  ’127.0.0.1  localhost’

2.修改内核文件/etc/sysctl.conf,追加入以下内容:

net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.sem = 250 64000 100 512
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall =  4000000000
kernel.sem = 250 64000 100 512
net.ipv4.tcp_tw_recycle=1
net.ipv4.tcp_max_syn_backlog=4096
net.core.netdev_max_backlog=10000
vm.overcommit_memory=2

  

3.修改最大线程数和最大打开文件数,修改文件:/etc/security/limits.conf

 

smp   soft    nproc           261072
smp   hard    nproc           131072
smp   soft    nofile          65536
smp   hard    nofile          125536

  

 

1.安装

 [smp@rh1 gp]$Chmod 755 greenplum-db-4.2.2.0-build-6-RHEL5-x86_64.bin

 [smp@rh1 gp]$./greenplum-db-4.2.2.0-build-6-RHEL5-x86_64.bin

CLCK WRP Rev 20090813


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.2.2.0
********************************************************************************

/home/smp/gp

********************************************************************************
Install Greenplum Database into </home/smp/gp>? [yes|no]
********************************************************************************

yes

********************************************************************************
/home/smp/gp does not exist.
Create /home/smp/gp ? [yes|no]
(Selecting no will exit the installer)
********************************************************************************

yes

********************************************************************************
[Optional] Provide the path to a previous installation of Greenplum Database,
or press ENTER to skip this step. e.g. /usr/local/greenplum-db-4.1.1.3

This installation step will migrate any Greenplum Database extensions from the
provided path to the version currently being installed. This step is optional
and can be run later with:
gppkg --migrate <path_to_old_gphome> /home/smp/gp
********************************************************************************



Extracting product to /home/smp/gp








Skipping migration of Greenplum Database extensions...

********************************************************************************
Installation complete.
Greenplum Database is installed in /home/smp/gp

Greenplum Database documentation is available for download
at http://powerlink.emc.com.
********************************************************************************

  

2.环境变量

[smp@rh1 gp]$ cat ~/.bashrc

# .bashrc

 

# Source global definitions

if [ -f /etc/bashrc ]; then

        . /etc/bashrc

fi

 

# User specific aliases and functions

. /home/smp/gp/greenplum_path.sh

  

3.免密码

 

[smp@rh1 gp]$ gpssh-exkeys  -f all_hosts

[STEP 1 of 5] create local ID and authorize on local host
  ... /home/smp/.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 172.16.40.71

[STEP 4 of 5] determine common authentication file content

[STEP 5 of 5] copy authentication files to all remote hosts
  ... finished key exchange with 172.16.40.71

[INFO] completed successfully

 

4.时间同步

[smp@rh1 gp]$ gpssh -f seg_hosts -v date

[Reset ...]
[INFO] login 172.16.40.71
[172.16.40.71] Thu Mar  7 00:18:38 PST 2013
[INFO] completed successfully

[Cleanup...]

 

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

[smp@rh1 gp]$ gpcheckperf -f all_hosts -r ds -D -d /home/smp/data/d1/

/home/smp/greenplum-db/./bin/gpcheckperf -f all_hosts -r ds -D -d /home/smp/data/d1/

 

--------------------
--  DISK WRITE TEST
--------------------

--------------------
--  DISK READ TEST
--------------------

--------------------
--  STREAM TEST
--------------------

====================
==  RESULT
====================

 disk write avg time (sec): 42.03
 disk write tot bytes: 2083749888
 disk write tot bandwidth (MB/s): 47.28
 disk write min bandwidth (MB/s): 47.28 [172.16.40.71]
 disk write max bandwidth (MB/s): 47.28 [172.16.40.71]
 -- per host bandwidth --
    disk write bandwidth (MB/s): 47.28 [172.16.40.71]


 disk read avg time (sec): 23.85
 disk read tot bytes: 2083749888
 disk read tot bandwidth (MB/s): 83.32
 disk read min bandwidth (MB/s): 83.32 [172.16.40.71]
 disk read max bandwidth (MB/s): 83.32 [172.16.40.71]
 -- per host bandwidth --
    disk read bandwidth (MB/s): 83.32 [172.16.40.71]


 stream tot bandwidth (MB/s): 10419.82
 stream min bandwidth (MB/s): 10419.82 [172.16.40.71]
 stream max bandwidth (MB/s): 10419.82 [172.16.40.71]
 -- per host bandwidth --
  stream bandwidth (MB/s): 10419.82 [172.16.40.71]

 

6.启动服务

 

[smp@rh1 ~]$ gpinitsystem -c gpinitsystem_config

 

20130307:01:54:25:002104 gpinitsystem:rh1:smp-[INFO]:-Checking configuration parameters, please wait...
20130307:01:54:25:002104 gpinitsystem:rh1:smp-[INFO]:-Reading Greenplum configuration file gpinitsystem_config
20130307:01:54:25:002104 gpinitsystem:rh1:smp-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value
20130307:01:54:26:002104 gpinitsystem:rh1:smp-[INFO]:-Locale set to en_US.utf8
20130307:01:54:26:gpinitsystem:rh1:smp-[FATAL]:-Master host data directory /home/smp/data/master/gpseg-1 already exists Script Exiting!
[smp@rh1 ~]$ rm -rf /home/smp/data/master/gpseg-1
[smp@rh1 ~]$ gpinitsystem -c gpinitsystem_config
20130307:01:54:39:003011 gpinitsystem:rh1:smp-[INFO]:-Checking configuration parameters, please wait...
20130307:01:54:40:003011 gpinitsystem:rh1:smp-[INFO]:-Reading Greenplum configuration file gpinitsystem_config
20130307:01:54:40:003011 gpinitsystem:rh1:smp-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value
20130307:01:54:40:003011 gpinitsystem:rh1:smp-[INFO]:-Locale set to en_US.utf8
20130307:01:54:40:003011 gpinitsystem:rh1:smp-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20130307:01:54:40:003011 gpinitsystem:rh1:smp-[INFO]:-Detected a single host GPDB array build, reducing value of BATCH_DEFAULT from 60 to 4
20130307:01:54:40:003011 gpinitsystem:rh1:smp-[INFO]:-Checking configuration parameters, Completed
20130307:01:54:40:003011 gpinitsystem:rh1:smp-[INFO]:-Commencing multi-home checks, please wait...
.
20130307:01:54:40:003011 gpinitsystem:rh1:smp-[INFO]:-Configuring build for standard array
20130307:01:54:41:003011 gpinitsystem:rh1:smp-[INFO]:-Commencing multi-home checks, Completed
20130307:01:54:41:003011 gpinitsystem:rh1:smp-[INFO]:-Building primary segment instance array, please wait...
.
20130307:01:54:41:003011 gpinitsystem:rh1:smp-[INFO]:-Checking Master host
20130307:01:54:41:003011 gpinitsystem:rh1:smp-[INFO]:-Checking new segment hosts, please wait...
.20130307:01:54:42:gpinitsystem:rh1:smp-[FATAL]:-Instance directory /home/smp/data/d1/gpseg0 exists on segment instance 172.16.40.71 Script Exiting!
[smp@rh1 ~]$ rm -rf /home/smp/data/d1/gpseg0
[smp@rh1 ~]$ gpinitsystem -c gpinitsystem_config
20130307:01:54:54:005468 gpinitsystem:rh1:smp-[INFO]:-Checking configuration parameters, please wait...
20130307:01:54:54:005468 gpinitsystem:rh1:smp-[INFO]:-Reading Greenplum configuration file gpinitsystem_config
20130307:01:54:54:005468 gpinitsystem:rh1:smp-[INFO]:-Locale has not been set in gpinitsystem_config, will set to default value
20130307:01:54:55:005468 gpinitsystem:rh1:smp-[INFO]:-Locale set to en_US.utf8
20130307:01:54:55:005468 gpinitsystem:rh1:smp-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 250
20130307:01:54:55:005468 gpinitsystem:rh1:smp-[INFO]:-Detected a single host GPDB array build, reducing value of BATCH_DEFAULT from 60 to 4
20130307:01:54:55:005468 gpinitsystem:rh1:smp-[INFO]:-Checking configuration parameters, Completed
20130307:01:54:55:005468 gpinitsystem:rh1:smp-[INFO]:-Commencing multi-home checks, please wait...
.
20130307:01:54:55:005468 gpinitsystem:rh1:smp-[INFO]:-Configuring build for standard array
20130307:01:54:55:005468 gpinitsystem:rh1:smp-[INFO]:-Commencing multi-home checks, Completed
20130307:01:54:55:005468 gpinitsystem:rh1:smp-[INFO]:-Building primary segment instance array, please wait...
.
20130307:01:54:56:005468 gpinitsystem:rh1:smp-[INFO]:-Checking Master host
20130307:01:54:56:005468 gpinitsystem:rh1:smp-[INFO]:-Checking new segment hosts, please wait...
.
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Checking new segment hosts, Completed
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Greenplum Database Creation Parameters
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:---------------------------------------
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master Configuration
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:---------------------------------------
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master instance name       = EMC Greenplum DW
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master hostname            = rh1
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master port                = 5432
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master instance dir        = /home/smp/data/master/gpseg-1
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master LOCALE              = en_US.utf8
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Greenplum segment prefix   = gpseg
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master Database            = testdatabase
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master connections         = 250
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master buffers             = 128000kB
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Segment connections        = 750
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Segment buffers            = 128000kB
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Checkpoint segments        = 8
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Encoding                   = UNICODE
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Postgres param file        = Off
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Initdb to be used          = /home/smp/greenplum-db/./bin/initdb
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-GP_LIBRARY_PATH is         = /home/smp/greenplum-db/./lib
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Ulimit check               = Passed
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Array host connect type    = Single hostname per node
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master IP address [1]      = ::1
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master IP address [2]      = 172.16.40.71
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Master IP address [3]      = fe80::20c:29ff:fe2a:45a1
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Standby Master             = Not Configured
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Primary segment #          = 1
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Total Database segments    = 1
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Trusted shell              = ssh
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Number segment hosts       = 1
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Mirroring config           = OFF
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:----------------------------------------
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:-Greenplum Primary Segment Configuration
20130307:01:54:57:005468 gpinitsystem:rh1:smp-[INFO]:----------------------------------------
20130307:01:54:58:005468 gpinitsystem:rh1:smp-[INFO]:-172.16.40.71      /home/smp/data/d1/gpseg0        40000   2       0
Continue with Greenplum creation Yy/Nn>
y
20130307:01:55:00:005468 gpinitsystem:rh1:smp-[INFO]:-Building the Master instance database, please wait...
20130307:01:55:18:005468 gpinitsystem:rh1:smp-[INFO]:-Starting the Master in admin mode
20130307:01:55:33:005468 gpinitsystem:rh1:smp-[INFO]:-Commencing parallel build of primary segment instances
20130307:01:55:33:005468 gpinitsystem:rh1:smp-[INFO]:-Spawning parallel processes    batch [1], please wait...
.
20130307:01:55:34:005468 gpinitsystem:rh1:smp-[INFO]:-Waiting for parallel processes batch [1], please wait...
....................
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:------------------------------------------------
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:-Parallel process exit status
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:------------------------------------------------
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:-Total processes marked as completed           = 1
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:-Total processes marked as killed              = 0
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:-Total processes marked as failed              = 0
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:------------------------------------------------
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:-Deleting distributed backout files
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:-Removing back out file
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:-No errors generated from parallel processes
20130307:01:55:54:005468 gpinitsystem:rh1:smp-[INFO]:-Restarting the Greenplum instance in production mode
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Starting gpstop with args: -a -i -m -d /home/smp/data/master/gpseg-1
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Gathering information and validating the environment...
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Obtaining Greenplum Master catalog information
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Obtaining Segment details from master...
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 4.2.2.0 build 6'
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-There are 0 connections to the database
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Commencing Master instance shutdown with mode='immediate'
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Master host=rh1
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Commencing Master instance shutdown with mode=immediate
20130307:01:55:54:013829 gpstop:rh1:smp-[INFO]:-Master segment instance directory=/home/smp/data/master/gpseg-1
20130307:01:55:55:013912 gpstart:rh1:smp-[INFO]:-Starting gpstart with args: -a -d /home/smp/data/master/gpseg-1
20130307:01:55:55:013912 gpstart:rh1:smp-[INFO]:-Gathering information and validating the environment...
20130307:01:55:55:013912 gpstart:rh1:smp-[INFO]:-Greenplum Binary Version: 'postgres (Greenplum Database) 4.2.2.0 build 6'
20130307:01:55:55:013912 gpstart:rh1:smp-[INFO]:-Greenplum Catalog Version: '201109210'
20130307:01:55:55:013912 gpstart:rh1:smp-[INFO]:-Starting Master instance in admin mode
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-Obtaining Greenplum Master catalog information
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-Obtaining Segment details from master...
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-Setting new master era
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-Master Started...
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-Checking for filespace consistency
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-Obtaining current filespace entries used by TRANSACTION_FILES
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-TRANSACTION_FILES OIDs are consistent for pg_system filespace
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-TRANSACTION_FILES entries are consistent for pg_system filespace
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-Checking for filespace consistency
20130307:01:55:56:013912 gpstart:rh1:smp-[INFO]:-Obtaining current filespace entries used by TEMPORARY_FILES
20130307:01:55:57:013912 gpstart:rh1:smp-[INFO]:-TEMPORARY_FILES OIDs are consistent for pg_system filespace
20130307:01:55:57:013912 gpstart:rh1:smp-[INFO]:-TEMPORARY_FILES entries are consistent for pg_system filespace
20130307:01:55:57:013912 gpstart:rh1:smp-[INFO]:-Shutting down master
20130307:01:55:58:013912 gpstart:rh1:smp-[INFO]:-No standby master configured.  skipping...
20130307:01:55:58:013912 gpstart:rh1:smp-[INFO]:-Commencing parallel segment instance startup, please wait...
..
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-Process results...
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-----------------------------------------------------
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-   Successful segment starts                                            = 1
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-   Failed segment starts                                                = 0
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-   Skipped segment starts (segments are marked down in configuration)   = 0
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-----------------------------------------------------
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-Successfully started 1 of 1 segment instances
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-----------------------------------------------------
20130307:01:56:00:013912 gpstart:rh1:smp-[INFO]:-Starting Master instance rh1 directory /home/smp/data/master/gpseg-1
20130307:01:56:02:013912 gpstart:rh1:smp-[INFO]:-Command pg_ctl reports Master rh1 instance active
20130307:01:56:02:013912 gpstart:rh1:smp-[INFO]:-Database successfully started
20130307:01:56:02:005468 gpinitsystem:rh1:smp-[INFO]:-Completed restart of Greenplum instance in production mode
20130307:01:56:02:005468 gpinitsystem:rh1:smp-[INFO]:-Loading gp_toolkit...
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-Scanning utility log file for any warning messages
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[WARN]:-*******************************************************
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[WARN]:-Scan of log file indicates that some warnings or errors
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[WARN]:-were generated during the array creation
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-Please review contents of log file
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-/home/smp/gpAdminLogs/gpinitsystem_20130307.log
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-To determine level of criticality
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-These messages could be from a previous run of the utility
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-that was called today!
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[WARN]:-*******************************************************
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-Greenplum Database instance successfully created
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-------------------------------------------------------
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-To complete the environment configuration, please
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-update smp .bashrc file with the following
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/home/smp/data/master/gpseg-1"
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-   to access the Greenplum scripts for this instance:
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-   or, use -d /home/smp/data/master/gpseg-1 option for the Greenplum scripts
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-   Example gpstate -d /home/smp/data/master/gpseg-1
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-Script log file = /home/smp/gpAdminLogs/gpinitsystem_20130307.log
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-To remove instance, run gpdeletesystem utility
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-Review options for gpinitstandby
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-------------------------------------------------------
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-The Master /home/smp/data/master/gpseg-1/pg_hba.conf post gpinitsystem
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-has been configured to allow all hosts within this new
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-array to intercommunicate. Any hosts external to this
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-new array must be explicitly added to this file
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-Refer to the Greenplum Admin support guide which is
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-located in the /home/smp/greenplum-db/./docs directory
20130307:01:56:07:005468 gpinitsystem:rh1:smp-[INFO]:-------------------------------------------------------

  

7.查看启动后状态

[smp@rh1 ~]$ gpstate -s

20130307:01:56:18:015715 gpstate:rh1:smp-[INFO]:-Starting gpstate with args: -s
20130307:01:56:18:015715 gpstate:rh1:smp-[CRITICAL]:-gpstate failed. (Reason='Environment Variable MASTER_DATA_DIRECTORY not set!') exiting...

  

有错误需要加入以下环境变量

 

[smp@rh1 ~]$ cat .bashrc 

  # .bashrc
  # Source global definitions
  if [ -f /etc/bashrc ]; then
  	. /etc/bashrc
  fi
  # User specific aliases and functions
  . /home/smp/gp/greenplum_path.sh
  MASTER_DATA_DIRECTORY=/home/smp/data/master/gpseg-1 export MASTER_DATA_DIRECTORY

然后在查看状态,就对了

[smp@rh1 ~]$ gpstate -s

20130307:01:59:00:015804 gpstate:rh1:smp-[INFO]:-Starting gpstate with args: -s
20130307:01:59:01:015804 gpstate:rh1:smp-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.2.2.0 build 6'
20130307:01:59:01:015804 gpstate:rh1:smp-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.2.2.0 build 6) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Jul  1 2012 11:15:14'
20130307:01:59:01:015804 gpstate:rh1:smp-[INFO]:-Obtaining Segment details from master...
20130307:01:59:01:015804 gpstate:rh1:smp-[INFO]:-Gathering data from segments...
.
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-----------------------------------------------------
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:--Master Configuration & Status
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-----------------------------------------------------
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Master host                    = rh1
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Master postgres process ID     = 14186
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Master data directory          = /home/smp/data/master/gpseg-1
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Master port                    = 5432
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Master current role            = dispatch
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Greenplum initsystem version   = 4.2.2.0 build 6
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Greenplum current version      = PostgreSQL 8.2.15 (Greenplum Database 4.2.2.0 build 6) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Jul  1 2012 11:15:14
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Postgres version               = 8.2.15
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Master standby                 = No master standby configured
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-----------------------------------------------------
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-Segment Instance Status Report
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-----------------------------------------------------
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Segment Info
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-      Hostname                          = rh1
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-      Address                           = 172.16.40.71
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-      Datadir                           = /home/smp/data/d1/gpseg0
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-      Port                              = 40000
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-   Status
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-      PID                               = 14170
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-      Configuration reports status as   = Up
20130307:01:59:02:015804 gpstate:rh1:smp-[INFO]:-      Database status                   = Up

  

8.连接到postgres数据库

[smp@rh1 ~]$ psql -d postgres

 

psql (8.2.15)
Type "help" for help.

postgres=# select datname,datdba,encoding,datacl from pg_database;
   datname    | datdba | encoding |        datacl
--------------+--------+----------+----------------------
 testdatabase |     10 |        6 |
 postgres     |     10 |        6 |
 template1    |     10 |        6 | {=c/smp,smp=CTc/smp}
 template0    |     10 |        6 | {=c/smp,smp=CTc/smp}

  

 

 

 

 

 

posted on 2013-03-12 15:58  wangbokun  阅读(2281)  评论(0编辑  收藏  举报

导航