GreenPlum 数据库安装

关于 GreenPlum 的介绍可以参考前一篇文章,这篇文章主要介绍 GreenPlum 3.6.1 详细安装步骤。

1 实验环境

1.1 硬件环境
一台 2G内存的联想 SL410K 双核笔记本, 并安装三台Linux虚拟机。

1.2虚拟机配置

节点 IP 内存 硬盘
gpmaster 192.168.1.50 400MB 15GB
gpnode1 192.168.1.51 400MB 15GB
gpnode2 192.168.1.52 400MB 15GB

1.3 本文中用到的术语
master host : 主节点主机
segment host : 子节点主机

2修改master, segments主机参数 (所有主机上执行)

2.1 修改 /etc/sysctl.conf 添加以下

1
2
3
4
5
6
7
8
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

2.2 修改 /etc/security/limits.conf ,添加以下

1
2
3
4
* soft nofile 65536  
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072

2.3 修改 /etc/hosts ,添加以下

1
2
3
192.168.1.50 gpmaster  
192.168.1.51 gpnode1
192.168.1.52 gpnode2

3 增加操作系统greenplum用户并创建数据目录(所有节点上执行)

3.1增加 greenplum 组和用户

1
2
3
[root@gpmaster greenplum-db]# groupadd greenplum  
[root@gpmaster greenplum-db]# useradd -g greenplum greenplum
[root@gpmaster greenplum-db]# passwd greenplum

3.2配置环境变量
将文件 /opt/greenplum-db/greenplum_path.sh 写入 /home/greenplum/.bash_profile
source .bash_profile

3.3创建 segment 数据目录

1
2
mkdir -p /opt/gp_data/data  
chown -R greenplum:greenplum /opt/gp_data/data

3.4创建 sgement 镜像目录

1
2
mkdir -p /opt/gp_data/mdata  
chown -R greenplum:greenplum /opt/gp_data/mdata

说明:上面两个步骤也可以等配置好主机之前等效性用 gpssh 执行。 gpssh可以同时连接所有子节点主机并进行操作。

4 在Master节点上安装 Greenplum 软件

4.1 下载介质
在官网 http://gpn.greenplum.com/download.php 下载

4.2 解压

1
unzip greenplum-db-3[1].3.6.1-build-1-RHEL5-i386.zip

4.3 安装 Greenplum软件

1
# /bin/bash greenplum-db-3.3.6.1-build-1-RHEL5-i386.bin

提示“yes” 接受协议 和安装路径, 默认的是“(/usr/local/greenplum-db-3.3.6.0)” ,我这里选择的是 “/opt/greenplum-db-3.3.6.1” ,安装结束后会自动创建一个软链接,如

1
2
3
[root@gpmaster opt]# ll /opt  
lrwxrwxrwx 1 root root 22 04-06 21:30 greenplum-db -> ./greenplum-db-3.3.6.1
drwxr-xr-x 11 root root 4096 04-06 21:30 greenplum-db-3.3.6.1

5 在所有子节点主机上安装 greenplumn 软件

5.1创建节点配置文件

1
2
3
4
vi /home/greenplum/all_host_file 添加以下内容  
gpmaster
gpnode1
gpnode2

5.2 执行文件greenplum_path.sh,设定环境变量

1
[root@gpmaster greenplum]#source /opt/greenplum-db/greenplum_path.sh

5.3以 root 用户交换密钥

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@gpmaster greenplum]# gpssh-exkeys -f /home/greenplum/all_host_file  
[STEP 1 of 5] create local ID and authorize on local host
... /root/.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 gpnode1
Enter password for gpnode1:
... send to gpnode2
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts
... finished key exchange with gpnode1
... finished key exchange with gpnode2
[INFO] completed successfully

5.4以 greenplum 用户交换密钥

1
2
[root@gpmaster greenplum]# su - greenplum  
[greenplum@gpmaster ~]$ gpssh-exkeys -f /home/greenplum/all_host_file

5.5将主节点上 greenplum 软件复制到 所有segments 主机 ( 主节点上操作 )

1
2
3
4
5
6
7
8
9
10
11
12
13
14
1 cd /opt  
tar cvf gp.tar greenplum-db-3.3.6.1
2 source /opt/greenplum-db/greenplum_path.sh
3 生成 all_host_file文件,添加以下
gpmaster
gpnode1
gpnode2
4 gpscp -f greenplum-db/all_host_file gp.tar =:/opt
5 gpssh -f greenplum-db/all_host_file
=> cd /opt
=> tar xvf /opt/gp.tar
=> chown -R greenplum:greenplum greenplum-db;
=> chown -R greenplum:greenplum greenplum-db-3.3.6.1;
=> ln -s /opt/greenplum-db-3.3.6.1 /opt/greenplum-db

5.6同步系统时钟(如果配置了 ntpd服务)

1
gpssh -f /opt/greenplum-db/all_hosts_file ntpd

6 初始化 Greenplum (on Master )

6.1 copy 配置文件模板

1
cp $GPHOME/docs/cli_help/gp_init_config_example /home/greenplum/gp_init_config

6.2修改配置文件 gp_init_config ,修改以下参数

1
2
3
4
5
6
7
8
9
10
ARRAY_NAME="Greenplum"  
MACHINE_LIST_FILE=/home/greenplum/multi_seg_host_file
SEG_PREFIX=gp
PORT_BASE=50000
declare -a DATA_DIRECTORY=(/opt/gp_data/data)
MASTER_HOSTNAME=gpmaster
MASTER_DIRECTORY=/opt/gp_data
MASTER_PORT=5432
MIRROR_PORT_BASE=60000
declare -a MIRROR_DATA_DIRECTORY=(/opt/gp_data/mdata)

上面是偶配置的参数,比较重要的两个参数是 “DATA_DIRECTORY” 和 “MIRROR_DATA_DIRECTORY” ,DATA_DIRECTORY 是指 segment主机 primary 实例的数据目录,MIRROR_DATA_DIRECTORY是指 segment 主机 mirror 实例的数据目录,这样一份配置,当后面执行 gpinitsystem 时,会在每一台 segment
主机上创建一个 primary 实例和 一个 mirror 实例。

6.3先检查下OS配置是否满足需求

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
[greenplum@gpmaster ~]$ gpcheckos -f all_host_file  
checking: postgres.md5 = 62406a6f410a5b324fcced3236150ee6
checking: postgres.version = postgres (Greenplum Database) 8.2.13
checking: sync.time between (2011-04-13 19:38:31.696946, 2011-04-13 19:38:51.696946)
checking: platform.hostname
checking: platform.memory
checking: platform.memory = 352321536
checking: platform.system = linux or sunos
checking: platform.system = linux
checking: platform.release = 2.6.18-194.el5xen
checking: sysctl.kernel.shmall = 4000000000
checking: sysctl.net.ipv4.tcp_max_syn_backlog = 4096
checking: sysctl.vm.overcommit_memory = 2
checking: sysctl.net.core.netdev_max_backlog = 10000
checking: ulimit.nofile >= 65536
checking: sysctl.kernel.sem = 250 64000 100 512
checking: sysctl.kernel.shmmax >= 500000000
checking: ulimit.nproc >= 131072
checking: sysctl.kernel.shmmni >= 4096
checking: sysctl.net.ipv4.ip_local_port_range = 1025 65535
checking: sysctl.net.ipv4.tcp_tw_recycle = 1
6.4初始化 greenplumn ( Master 节点上执行 )
[greenplum@gpmaster ~]$ gpinitsystem -c gp_init_config20110413:20:29:07:gpinitsystem:gpmaster:greenplum-[INFO]:-Checking configuration parameters, please wait...
20110413:20:29:09:gpinitsystem:gpmaster:greenplum-[INFO]:-Reading Greenplum configuration file gp_init_config
20110413:20:29:09:gpinitsystem:gpmaster:greenplum-[INFO]:-Locale has not been set in gp_init_config, will set to default value
20110413:20:29:11:gpinitsystem:gpmaster:greenplum-[INFO]:-Locale set to en_US.utf8
20110413:20:29:15:gpinitsystem:gpmaster:greenplum-[INFO]:-No DATABASE_NAME set, will exit following template1 updates
20110413:20:29:16:gpinitsystem:gpmaster:greenplum-[INFO]:-MASTER_MAX_CONNECT not set, will set to default value 25
20110413:20:29:18:gpinitsystem:gpmaster:greenplum-[INFO]:-Master IP address array = 192.168.122.1
20110413:20:29:18:gpinitsystem:gpmaster:greenplum-[INFO]:-Checking configuration parameters, Completed
20110413:20:29:19:gpinitsystem:gpmaster:greenplum-[INFO]:-Commencing multi-home checks, please wait...
..
20110413:20:29:24:gpinitsystem:gpmaster:greenplum-[INFO]:-Configuring build for standard array
20110413:20:29:24:gpinitsystem:gpmaster:greenplum-[INFO]:-Commencing multi-home checks, Completed
20110413:20:29:25:gpinitsystem:gpmaster:greenplum-[INFO]:-Building primary segment instance array, please wait...
..
20110413:20:29:34:gpinitsystem:gpmaster:greenplum-[INFO]:-Building group mirror array type , please wait...
..
20110413:20:29:45:gpinitsystem:gpmaster:greenplum-[INFO]:-Checking Master host
20110413:20:29:48:gpinitsystem:gpmaster:greenplum-[INFO]:-Checking new segment hosts, please wait...
....
20110413:20:30:24:gpinitsystem:gpmaster:greenplum-[INFO]:-Checking new segment hosts, Completed
20110413:20:30:26:gpinitsystem:gpmaster:greenplum-[INFO]:-Greenplum Database Creation Parameters
20110413:20:30:26:gpinitsystem:gpmaster:greenplum-[INFO]:---------------------------------------
20110413:20:30:26:gpinitsystem:gpmaster:greenplum-[INFO]:-Master Configuration
20110413:20:30:27:gpinitsystem:gpmaster:greenplum-[INFO]:---------------------------------------
20110413:20:30:27:gpinitsystem:gpmaster:greenplum-[INFO]:-Master instance name = Greenplum Database
20110413:20:30:27:gpinitsystem:gpmaster:greenplum-[INFO]:-Master hostname = gpmaster
20110413:20:30:28:gpinitsystem:gpmaster:greenplum-[INFO]:-Master port = 5432
20110413:20:30:28:gpinitsystem:gpmaster:greenplum-[INFO]:-Master instance dir = /opt/gp_data/gp-1
20110413:20:30:28:gpinitsystem:gpmaster:greenplum-[INFO]:-Master LOCALE = en_US.utf8
20110413:20:30:29:gpinitsystem:gpmaster:greenplum-[INFO]:-Greenplum segment prefix = gp
20110413:20:30:29:gpinitsystem:gpmaster:greenplum-[INFO]:-Master Database =
20110413:20:30:30:gpinitsystem:gpmaster:greenplum-[INFO]:-Master connections = 25
20110413:20:30:30:gpinitsystem:gpmaster:greenplum-[INFO]:-Master buffers = 128000kB
20110413:20:30:30:gpinitsystem:gpmaster:greenplum-[INFO]:-Segment connections = 125
20110413:20:30:31:gpinitsystem:gpmaster:greenplum-[INFO]:-Segment buffers = 128000kB
20110413:20:30:31:gpinitsystem:gpmaster:greenplum-[INFO]:-Checkpoint segments = 8
20110413:20:30:31:gpinitsystem:gpmaster:greenplum-[INFO]:-Encoding = UNICODE
20110413:20:30:32:gpinitsystem:gpmaster:greenplum-[INFO]:-Postgres param file = Off
20110413:20:30:32:gpinitsystem:gpmaster:greenplum-[INFO]:-Initdb to be used = /opt/greenplum-db/./bin/initdb
20110413:20:30:33:gpinitsystem:gpmaster:greenplum-[INFO]:-GP_LIBRARY_PATH is = /opt/greenplum-db/./lib
20110413:20:30:33:gpinitsystem:gpmaster:greenplum-[INFO]:-Ulimit check = Passed
20110413:20:30:33:gpinitsystem:gpmaster:greenplum-[INFO]:-Segment build type = Parallel
20110413:20:30:34:gpinitsystem:gpmaster:greenplum-[INFO]:-Array host connect type = Single hostname per node
20110413:20:30:34:gpinitsystem:gpmaster:greenplum-[INFO]:-Master IP address [1] = 192.168.122.1
20110413:20:30:34:gpinitsystem:gpmaster:greenplum-[INFO]:-Master IP address [2] = 192.168.1.50
20110413:20:30:35:gpinitsystem:gpmaster:greenplum-[INFO]:-Master only build = Off
20110413:20:30:35:gpinitsystem:gpmaster:greenplum-[INFO]:-Standby Master = Not Configured
20110413:20:30:35:gpinitsystem:gpmaster:greenplum-[INFO]:-Primary segment # = 1
20110413:20:30:36:gpinitsystem:gpmaster:greenplum-[INFO]:-Total Database segments = 2
20110413:20:30:36:gpinitsystem:gpmaster:greenplum-[INFO]:-Trusted shell = ssh
20110413:20:30:37:gpinitsystem:gpmaster:greenplum-[INFO]:-Number segment hosts = 2
20110413:20:30:37:gpinitsystem:gpmaster:greenplum-[INFO]:-Mirror port base = 60000
20110413:20:30:37:gpinitsystem:gpmaster:greenplum-[INFO]:-Mirror segment # = 1
20110413:20:30:38:gpinitsystem:gpmaster:greenplum-[INFO]:-Mirroring config = ON
20110413:20:30:38:gpinitsystem:gpmaster:greenplum-[INFO]:-Mirroring type = Group
20110413:20:30:38:gpinitsystem:gpmaster:greenplum-[INFO]:----------------------------------------
20110413:20:30:39:gpinitsystem:gpmaster:greenplum-[INFO]:-Greenplum Primary Segment Configuration
20110413:20:30:39:gpinitsystem:gpmaster:greenplum-[INFO]:----------------------------------------
20110413:20:30:40:gpinitsystem:gpmaster:greenplum-[INFO]:-gpnode1 /opt/gp_data/data/gp0 50001 2 0
20110413:20:30:40:gpinitsystem:gpmaster:greenplum-[INFO]:-gpnode2 /opt/gp_data/data/gp1 50001 3 1
20110413:20:30:40:gpinitsystem:gpmaster:greenplum-[INFO]:---------------------------------------
20110413:20:30:41:gpinitsystem:gpmaster:greenplum-[INFO]:-Greenplum Mirror Segment Configuration
20110413:20:30:41:gpinitsystem:gpmaster:greenplum-[INFO]:---------------------------------------
20110413:20:30:41:gpinitsystem:gpmaster:greenplum-[INFO]:-gpnode2 /opt/gp_data/mdata/gp0 60001 4 0
20110413:20:30:42:gpinitsystem:gpmaster:greenplum-[INFO]:-gpnode1 /opt/gp_data/mdata/gp1 60001 5 1
Continue with Greenplum creation Yy/Nn>

20110413:20:31:04:gpinitsystem:gpmaster:greenplum-[INFO]:-Building the Master instance database, please wait...
20110413:20:31:34:gpinitsystem:gpmaster:greenplum-[INFO]:-Starting the Master in admin mode
20110413:20:32:08:gpinitsystem:gpmaster:greenplum-[INFO]:-Commencing parallel build of primary segment instances
20110413:20:32:08:gpinitsystem:gpmaster:greenplum-[INFO]:-Spawning parallel processes batch [1], please wait...
..
20110413:20:32:13:gpinitsystem:gpmaster:greenplum-[INFO]:-Waiting for parallel processes batch [1], please wait...
.......................................................
20110413:20:33:20:gpinitsystem:gpmaster:greenplum-[INFO]:------------------------------------------------
20110413:20:33:21:gpinitsystem:gpmaster:greenplum-[INFO]:-Parallel process exit status
20110413:20:33:21:gpinitsystem:gpmaster:greenplum-[INFO]:------------------------------------------------
20110413:20:33:21:gpinitsystem:gpmaster:greenplum-[INFO]:-Total processes marked as completed = 2
20110413:20:33:22:gpinitsystem:gpmaster:greenplum-[INFO]:-Total processes marked as killed = 0
20110413:20:33:22:gpinitsystem:gpmaster:greenplum-[INFO]:-Total processes marked as failed = 0
20110413:20:33:22:gpinitsystem:gpmaster:greenplum-[INFO]:------------------------------------------------
20110413:20:33:24:gpinitsystem:gpmaster:greenplum-[INFO]:-Commencing parallel build of mirror segment instances
20110413:20:33:25:gpinitsystem:gpmaster:greenplum-[INFO]:-Spawning parallel processes batch [1], please wait...
..
20110413:20:33:30:gpinitsystem:gpmaster:greenplum-[INFO]:-Waiting for parallel processes batch [1], please wait...
....................................................
20110413:20:34:35:gpinitsystem:gpmaster:greenplum-[INFO]:------------------------------------------------
20110413:20:34:35:gpinitsystem:gpmaster:greenplum-[INFO]:-Parallel process exit status
20110413:20:34:35:gpinitsystem:gpmaster:greenplum-[INFO]:------------------------------------------------
20110413:20:34:36:gpinitsystem:gpmaster:greenplum-[INFO]:-Total processes marked as completed = 2
20110413:20:34:36:gpinitsystem:gpmaster:greenplum-[INFO]:-Total processes marked as killed = 0
20110413:20:34:36:gpinitsystem:gpmaster:greenplum-[INFO]:-Total processes marked as failed = 0
20110413:20:34:37:gpinitsystem:gpmaster:greenplum-[INFO]:------------------------------------------------
20110413:20:34:38:gpinitsystem:gpmaster:greenplum-[INFO]:-Deleting distributed backout files
20110413:20:34:38:gpinitsystem:gpmaster:greenplum-[INFO]:-Removing back out file
20110413:20:34:39:gpinitsystem:gpmaster:greenplum-[INFO]:-No errors generated from parallel processes
20110413:20:34:39:gpinitsystem:gpmaster:greenplum-[INFO]:-Restarting the Greenplum instance in production mode
20110413:20:34:40:gpstop:gpmaster:greenplum-[INFO]:-Starting gpstop with args: '-a -i -d /opt/gp_data/gp-1'
20110413:20:34:40:gpstop:gpmaster:greenplum-[INFO]:-Gathering information and validating the environment...
20110413:20:34:41:gpstop:gpmaster:greenplum-[INFO]:-Obtaining Greenplum Master catalog information
20110413:20:34:41:gpstop:gpmaster:greenplum-[INFO]:-Obtaining Segment details from master...
20110413:20:34:41:gpstop:gpmaster:greenplum-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 3.3.6.1 build 1'
20110413:20:34:41:gpstop:gpmaster:greenplum-[INFO]:-There are 0 connections to the database
20110413:20:34:41:gpstop:gpmaster:greenplum-[INFO]:-Commencing Master instance shutdown with mode='immediate'
20110413:20:34:41:gpstop:gpmaster:greenplum-[INFO]:-Master host=gpmaster
20110413:20:34:41:gpstop:gpmaster:greenplum-[INFO]:-Commencing Master instance shutdown with mode=immediate
20110413:20:34:41:gpstop:gpmaster:greenplum-[INFO]:-Master segment instance directory=/opt/gp_data/gp-1
20110413:20:34:43:gpstop:gpmaster:greenplum-[INFO]:-No standby master host configured
20110413:20:34:47:gpstop:gpmaster:greenplum-[INFO]:-Commencing parallel segment instance shutdown, please wait...
..........
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-------------------------------------------------
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-Parallel process exit status
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-------------------------------------------------
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-Total processes marked as completed = 4
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-Total processes marked as failed = 0
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-------------------------------------------------
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-Total instances marked invalid and bypassed = 0
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-Successfully shutdown 4 of 4 segment instances
20110413:20:34:57:gpstop:gpmaster:greenplum-[INFO]:-Database successfully shutdown with no errors reported
20110413:20:34:59:gpstart:gpmaster:greenplum-[INFO]:-Starting gpstart with args: '-a -d /opt/gp_data/gp-1'
20110413:20:34:59:gpstart:gpmaster:greenplum-[INFO]:-Gathering information and validating the environment...
20110413:20:35:00:gpstart:gpmaster:greenplum-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 3.3.6.1 build 1'
20110413:20:35:00:gpstart:gpmaster:greenplum-[INFO]:-Starting Master instance in admin mode
20110413:20:35:01:gpstart:gpmaster:greenplum-[INFO]:-Obtaining Greenplum Master catalog information
20110413:20:35:01:gpstart:gpmaster:greenplum-[INFO]:-Obtaining Segment details from master...
20110413:20:35:01:gpstart:gpmaster:greenplum-[INFO]:-Master Started...
20110413:20:35:01:gpstart:gpmaster:greenplum-[INFO]:-Shutting down master
20110413:20:35:10:gpstart:gpmaster:greenplum-[INFO]:-No standby master configured. skipping...
20110413:20:35:13:gpstart:gpmaster:greenplum-[INFO]:-Commencing parallel segment instance startup, please wait...
...........
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-Process results...
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-----------------------------------------------------
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-Total processes marked as completed = 4
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-Total processes marked as failed = 0
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-----------------------------------------------------
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-Total instances marked invalid and bypassed = 0
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-Successfully started 4 of 4 segment instances
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-----------------------------------------------------
20110413:20:35:24:gpstart:gpmaster:greenplum-[INFO]:-Starting Master instance gpmaster directory /opt/gp_data/gp-1
20110413:20:35:28:gpstart:gpmaster:greenplum-[INFO]:-Command pg_ctl reports Master gpmaster instance active
20110413:20:35:28:gpstart:gpmaster:greenplum-[INFO]:-Database successfully started with no errors reported
20110413:20:35:30:gpinitsystem:gpmaster:greenplum-[INFO]:-Completed restart of Greenplum instance in production mode
psql: FATAL: building Gang: Primary and mirror both unavailable for segment 0 (i 1 j 2) (cdbgang.c:1332)
20110413:20:35:31:gpinitsystem:gpmaster:greenplum-[WARN]:-Issue with update Greenplum superuser password
20110413:20:35:33:gpinitsystem:gpmaster:greenplum-[INFO]:-Scanning utility log file for any warning messages
20110413:20:35:33:gpinitsystem:gpmaster:greenplum-[WARN]:-*
20110413:20:35:33:gpinitsystem:gpmaster:greenplum-[WARN]:-Scan of log file indicates that some warnings or errors
20110413:20:35:34:gpinitsystem:gpmaster:greenplum-[WARN]:-were generated during the array creation
20110413:20:35:34:gpinitsystem:gpmaster:greenplum-[INFO]:-Please review contents of log file
20110413:20:35:35:gpinitsystem:gpmaster:greenplum-[INFO]:-/home/greenplum/gpAdminLogs/gpinitsystem_20110413.log
20110413:20:35:35:gpinitsystem:gpmaster:greenplum-[INFO]:-To determine level of criticality
20110413:20:35:35:gpinitsystem:gpmaster:greenplum-[INFO]:-These messages could be from a previous run of the utility
20110413:20:35:36:gpinitsystem:gpmaster:greenplum-[INFO]:-that was called today!
20110413:20:35:36:gpinitsystem:gpmaster:greenplum-[WARN]:-*
20110413:20:35:37:gpinitsystem:gpmaster:greenplum-[INFO]:-Greenplum Database instance successfully created
20110413:20:35:37:gpinitsystem:gpmaster:greenplum-[INFO]:-------------------------------------------------------
20110413:20:35:38:gpinitsystem:gpmaster:greenplum-[INFO]:-To complete the environment configuration, please
20110413:20:35:38:gpinitsystem:gpmaster:greenplum-[INFO]:-update greenplum .bashrc file with the following
20110413:20:35:38:gpinitsystem:gpmaster:greenplum-[INFO]:-1. Ensure that the greenplum_path.sh file is sourced
20110413:20:35:39:gpinitsystem:gpmaster:greenplum-[INFO]:-2. Add "export MASTER_DATA_DIRECTORY=/opt/gp_data/gp-1"
20110413:20:35:39:gpinitsystem:gpmaster:greenplum-[INFO]:- to access the Greenplum scripts for this instance:
20110413:20:35:40:gpinitsystem:gpmaster:greenplum-[INFO]:- or, use -d /opt/gp_data/gp-1 option for the Greenplum scripts
20110413:20:35:40:gpinitsystem:gpmaster:greenplum-[INFO]:- Example gpstate -d /opt/gp_data/gp-1
20110413:20:35:40:gpinitsystem:gpmaster:greenplum-[INFO]:-Script log file = /home/greenplum/gpAdminLogs/gpinitsystem_20110413.log
20110413:20:35:41:gpinitsystem:gpmaster:greenplum-[INFO]:-To remove instance, run gpdeletesystem utility
20110413:20:35:41:gpinitsystem:gpmaster:greenplum-[INFO]:-To initialize a Standby Master Segment for this Greenplum instance
20110413:20:35:41:gpinitsystem:gpmaster:greenplum-[INFO]:-Review options for gpinitstandby
20110413:20:35:42:gpinitsystem:gpmaster:greenplum-[INFO]:-------------------------------------------------------
20110413:20:35:42:gpinitsystem:gpmaster:greenplum-[INFO]:-The Master /opt/gp_data/gp-1/pg_hba.conf post gpinitsystem
20110413:20:35:43:gpinitsystem:gpmaster:greenplum-[INFO]:-has been configured to allow all hosts within this new
20110413:20:35:43:gpinitsystem:gpmaster:greenplum-[INFO]:-array to intercommunicate. Any hosts external to this
20110413:20:35:43:gpinitsystem:gpmaster:greenplum-[INFO]:-new array must be explicitly added to this file
20110413:20:35:44:gpinitsystem:gpmaster:greenplum-[INFO]:-Refer to the Greenplum Admin support guide which is
20110413:20:35:44:gpinitsystem:gpmaster:greenplum-[INFO]:-located in the /opt/greenplum-db/./docs directory
20110413:20:35:44:gpinitsystem:gpmaster:greenplum-[INFO]:-------------------------------------------------------

根据输出文件信息,看到”-[INFO]:-Greenplum Database instance successfully created” 说明 Greenplum 安装成功。

6.4 修改 .bash_profile,增加一行,配置 Maser 节点环境变量

1
2
export MASTER_DATA_DIRECTORY=/opt/gp_data/gp-1  
source .bash_profile

7 测试

7.1连接测试

1
2
3
4
5
6
7
8
9
[greenplum@gpmaster ~]$ psql template1  
template1=# l
List of databases
Name | Owner | Encoding
-----------+-----------+----------
postgres | greenplum | UTF8
template0 | greenplum | UTF8
template1 | greenplum | UTF8
(3 rows)

7.2创建用户

1
2
3
template1=# CREATE ROLE warehouse LOGIN ENCRYPTED PASSWORD 'warehouse'  
template1-# superuser noinherit nocreatedb nocreaterole ;
CREATE ROLE

7.3建库

1
2
3
4
5
template1=# CREATE DATABASE warehouse  
template1-# WITH OWNER = warehouse
template1-# TEMPLATE = template0
template1-# ENCODING = 'UTF8' ;
CREATE DATABASE

8 常见问题

8.1 Master 连接不上,报以下 Error

1
2
[greenplum@gpmaster ~]$ psql template1  
psql: FATAL: building Gang: Primary and mirror both unavailable for segment 0 (i 1 j 2) (cdbgang.c:1332)

同时数据库日志信息 ( csv log )

1
2
3
4
5
6
7
8
9
2011-04-13 20:48:42.195865 CST,,,p13846,th1756048,,,,0,con3,,seg-1,,,,,"LOG","00000","FTS: test connection failed, dbid 2 dbname postgres error message 'could not connect to server: No route to host  
Is the server running on host ""gpnode1"" and accepting
TCP/IP connections on port 50001?
':136",,,,,,,0,,,,
2011-04-13 20:48:42.196164 CST,,,p13846,th1756048,,,,0,con3,,seg-1,,,,,"LOG","00000","Found a fault with a segment 0 segment-dbid 2",,,,,,,0,,,,
2011-04-13 20:48:42.196727 CST,,,p13846,th14052240,,,,0,con3,,seg-1,,,,,"LOG","00000","FTS: test connection failed, dbid 4 dbname postgres error message 'could not connect to server: No route to host
Is the server running on host ""gpnode2"" and accepting
TCP/IP connections on port 60001?
':136",,,,,,,0,,,,

解决方法:从数据库日志可以看出Master无法连接 gpnode1 的 50001端口和 gpnode2 的 60001 端口,原因是防火墙问题端口权限没打开,只要开通数据库端口权限即可;

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/database/236388.html

(0)
上一篇 2022年1月24日 21:28
下一篇 2022年1月24日 21:28

相关推荐

发表回复

登录后才能评论