GreenPlum的安裝步驟

myamor發表於2012-03-20
 
在安裝GreenPlum之前,先介紹一下基礎架構,這樣有個概念.
 
GreenPlum是一種基於postgresql(開源資料庫)的分散式資料庫.它採用的是shared nothing架構(MPP),主機、作業系統、記憶體、儲存都是自我控制,不存在著共享.它主要由master host,segment host,interconnect三大部分構成.
 
Master節點是GreenPlum資料庫的入口點,它主要是處理客戶端發起的連線訪問,同時還處理程式執行的SQL語句.由於GreenPlum資料庫的引擎是基於PostrgeSql的,當使用者連線到GreenPlum的master節點的時候會感覺就像是連線到到一臺postgresql資料庫一樣.並且可以通過psql、應用程式的api介面來連線GreenPlum資料庫.Master下面存放到是全域性的系統目錄.(global system catalog),包含系統表和後設資料,不包含使用者的資料.使用者資料是存放在segment中.
 
Master節點做以下事情:
 ?客戶端訪問連線的認證.
 ?處理傳入的SQL語句.
 ?在segment之間分配工作負荷..
 ?協調每個segment返回的結果,並把最終結果返回給客戶端..
 
Segment節點主要做資料儲存和資料處理,使用者建立的索引和表被分發到各個子節點當中,每一個子節點都包含了使用者資料的分片,而這些分片不存在重複的情況.
 
Interconnect是GreenPlum資料庫的網路層.在每個segment中起到一個ipc的作用(inter-process communication).GreenPlum資料庫推薦使用標準的千兆乙太網交換機來做Interconnect.預設情況下,Interconnect預設使用的是UDP協議來進行傳輸,因為在GreenPlum的軟體當中,它沒有其他包去檢查和驗證UDP,所以可靠性上等同於TCP協議,並且超過了TCP的效能和可擴充套件性,而且使用TCP協議就會有一個限制,最大隻能使用1000個segment例項.
 
下面開始介紹安裝:因為是一臺虛擬機器實現,即是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 ? [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_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
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
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)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/177006/viewspace-719153/,如需轉載,請註明出處,否則將追究法律責任。

相關文章