注意:如果master配置了standby master,添加的segment必须要有mirror segment存在,否则报错。
1 查看某张表的数据分布情况
tutorial=# select gp_segment_id, count(*) from otp_r group by gp_segment_id;
gp_segment_id | count
---------------+---------
0 | 1024552
(1 row)
2 关闭iptables和selinux
3 root用户配置ssh互信
略
4 创建gpadmin用户
/usr/sbin/useradd gpadmin -d /home/gpadmin -s /bin/bash
5 gpadmin用户配置ssh互信
略
6 编辑new_hosts_file文件
该文件中仅包含新增节点主机名
7 创建inputfile
[gpadmin@hadoop02 ~]$ gpexpand -f new_hosts_file -D gpadmin
20160928:17:04:09:015501 gpexpand:hadoop02:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.8.1 build 1'
20160928:17:04:09:015501 gpexpand:hadoop02:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.8.1 build 1) on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.4.2 compiled on Apr 20 2016 08:08:56'
20160928:17:04:09:015501 gpexpand:hadoop02:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state
System Expansion is used to add segments to an existing GPDB array.
gpexpand did not detect a System Expansion that is in progress.
Before initiating a System Expansion, you need to provision and burn-in
the new hardware. Please be sure to run gpcheckperf/gpcheckos to make
sure the new hardware is working properly.
Please refer to the Admin Guide for more information.
Would you like to initiate a new System Expansion Yy|Nn (default=N):
> y
By default, new hosts are configured with the same number of primary
segments as existing hosts. Optionally, you can increase the number
of segments per host.
For example, if existing hosts have two primary segments, entering a value
of 2 will initialize two additional segments on existing hosts, and four
segments on new hosts. In addition, mirror segments will be added for
these new primary segments if mirroring is enabled.
How many new primary segments per host do you want to add? (default=0):
>
Generating configuration file...
20160928:17:04:12:015501 gpexpand:hadoop02:gpadmin-[INFO]:-Generating input file...
Input configuration files were written to 'gpexpand_inputfile_20160928_170412' and 'None'.
Please review the file and make sure that it is correct then re-run
with: gpexpand -i gpexpand_inputfile_20160928_170412 -D gpadmin
20160928:17:04:12:015501 gpexpand:hadoop02:gpadmin-[INFO]:-Exiting...
8 使用input file添加节点
[gpadmin@hadoop02 ~]$ gpexpand -i gpexpand_inputfile_20160928_170412 -D gpadmin
20160928:17:04:49:015600 gpexpand:hadoop02:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.3.8.1 build 1'
20160928:17:04:49:015600 gpexpand:hadoop02:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 8.2.15 (Greenplum Database 4.3.8.1 build 1) on x86_64-unknown-linux-gnu, compil