vi /etc/security/limits.d/20-nproc.conf # Default limit for number of user's processes to prevent # accidental fork bombs. # See rhbz #432903 for reasoning.
# 注意执行用户为gpadmin ssh-keygen -t rsa # 一直回车 Generating public/private rsa key pair. Enter file inwhich to save the key (/root/.ssh/id_rsa): /root/.ssh/id_rsa already exists. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: SHA256:8Z+R0Truk1NIVC4Tl6w5VTgP2WrjhM3ZtmYu2Ykn8v8 root@master The key's randomart image is: +---[RSA 2048]----+ | .oo*.| | .=O .| | . .+BoB | | o **O +| | S ..=* o.| | o.+o+ | | +oB .| | o+= = | | ++=.E| +----[SHA256]-----+
[gpadmin@master ~]$ gpssh-exkeys -f all_hosts_file [STEP 1 of 5] create local ID and authorize on local host ... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped
[STEP 2 of 5] keyscan all hosts and update known_hosts file
[STEP 3 of 5] retrieving credentials from remote hosts ... send to segment1
[STEP 4 of 5] determine common authentication file content
[STEP 5 of 5] copy authentication files to all remote hosts ... finished key exchange with segment1
20210514:23:06:59:044510 gpexpand:master:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.16.0 build commit:5650be2b79197fed564dca8d734d10f2a76b876c' 20210514:23:06:59:044510 gpexpand:master:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.16.0 build commit:5650be2b79197fed564dca8d734d10f2a76b876c) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Apr 21 2021 19:24:38' 20210514:23:06:59:044510 gpexpand:master: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 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 20210514:23:07:00:044510 gpexpand:master:gpadmin-[ERROR]:-gpexpand failed: Hosts file hosts_gpexpand not found
Exiting... 20210514:23:07:00:044510 gpexpand:master:gpadmin-[INFO]:-Shutting down gpexpand... [gpadmin@master ~]$ gpexpand -f hosts_expand 20210514:23:07:10:044551 gpexpand:master:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.16.0 build commit:5650be2b79197fed564dca8d734d10f2a76b876c' 20210514:23:07:10:044551 gpexpand:master:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.16.0 build commit:5650be2b79197fed564dca8d734d10f2a76b876c) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Apr 21 2021 19:24:38' 20210514:23:07:10:044551 gpexpand:master: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 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): > 4 Enter new primary data directory 1: > /data/gpdata/gp1 Enter new primary data directory 2: > /data/gpdata/gp2 Enter new primary data directory 3: > /data/gpdata/gp3 Enter new primary data directory 4: > /data/gpdata/gp4
Input configuration file was written to 'gpexpand_inputfile_20210514_230827'.
Please review the file and make sure that it is correct then re-run with: gpexpand -i gpexpand_inputfile_20210514_230827 20210514:23:08:27:044551 gpexpand:master:gpadmin-[INFO]:-Exiting...
[gpadmin@master ~]$ gpexpand -i gpexpand_inputfile_20210514_230827 20210514:23:11:57:044991 gpexpand:master:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.16.0 build commit:5650be2b79197fed564dca8d734d10f2a76b876c' 20210514:23:11:57:044991 gpexpand:master:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.16.0 build commit:5650be2b79197fed564dca8d734d10f2a76b876c) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Apr 21 2021 19:24:38' 20210514:23:11:57:044991 gpexpand:master:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state 20210514:23:11:58:044991 gpexpand:master:gpadmin-[INFO]:-Heap checksum setting consistent across cluster 20210514:23:11:58:044991 gpexpand:master:gpadmin-[INFO]:-Syncing Greenplum Database extensions
...
20210514:23:12:02:044991 gpexpand:master:gpadmin-[INFO]:-{'segment1': '/data/gpdata/gp1/gpseg4:33000:true:false:6:4::-1:,/data/gpdata/gp2/gpseg5:33001:true:false:7:5::-1:,/data/gpdata/gp3/gpseg6:33002:true:false:8:6::-1:,/data/gpdata/gp4/gpseg7:33003:true:false:9:7::-1:'} 20210514:23:12:19:044991 gpexpand:master:gpadmin-[INFO]:-Cleaning up temporary template files 20210514:23:12:19:044991 gpexpand:master:gpadmin-[INFO]:-Cleaning up databases in new segments. 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-Unlocking catalog 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-Unlocked catalog 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-Creating expansion schema 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database template1 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database postgres 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-Populating gpexpand.status_detail with data from database gpdb 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-************************************************ 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-Initialization of the system expansion complete. 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-To begin table expansion onto the new segments 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-rerun gpexpand 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-************************************************ 20210514:23:12:21:044991 gpexpand:master:gpadmin-[INFO]:-Exiting...
(出现Initialization of the system expansion complete即增加节点成功)
[gpadmin@master ~]$ gpexpand -c 20210515:00:49:17:051000 gpexpand:master:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 6.16.0 build commit:5650be2b79197fed564dca8d734d10f2a76b876c' 20210515:00:49:17:051000 gpexpand:master:gpadmin-[INFO]:-master Greenplum Version: 'PostgreSQL 9.4.24 (Greenplum Database 6.16.0 build commit:5650be2b79197fed564dca8d734d10f2a76b876c) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Apr 21 2021 19:24:38' 20210515:00:49:17:051000 gpexpand:master:gpadmin-[INFO]:-Querying gpexpand schema for current expansion state 20210515:00:49:18:051000 gpexpand:master:gpadmin-[WARNING]:-Expansion has not yet completed. Removing the expansion 20210515:00:49:18:051000 gpexpand:master:gpadmin-[WARNING]:-schema now will leave the following tables unexpanded: 20210515:00:49:18:051000 gpexpand:master:gpadmin-[WARNING]:- 20210515:00:49:18:051000 gpexpand:master:gpadmin-[WARNING]:-These tables will have to be expanded manually by setting 20210515:00:49:18:051000 gpexpand:master:gpadmin-[WARNING]:-the distribution policy using the ALTER TABLE command.
Are you sure you want to drop the expansion schema? Yy|Nn (default=N): > y
Do you want to dump the gpexpand.status_detail table to file? Yy|Nn (default=Y): > y 20210515:00:49:22:051000 gpexpand:master:gpadmin-[INFO]:-Dumping gpexpand.status_detail to /home/gpdata/master/gpseg-1/gpexpand.status_detail 20210515:00:49:22:051000 gpexpand:master:gpadmin-[INFO]:-Removing gpexpand schema 20210515:00:49:22:051000 gpexpand:master:gpadmin-[INFO]:-Cleanup Finished. exiting...
5.5重分布表
1
gpexpand -d 60:00:00
(出现completed successfully即重分布成功)
5.6失败回滚
1
gpexpand -r
5.7进入GP查询节点信息
1 2 3 4 5
su - gpadmin # 登录greenplum,注意端口(前面的初始化配置文件设置的) psql -p 2345 # 执行sql查询集群状态 select * from gp_segment_configuration;
1 2 3 4 5 6 7 8 9 10 11 12 13 14
gpdb=# select*from gp_segment_configuration; dbid | content | role | preferred_role | mode | status | port | hostname | address | datadir ------+---------+------+----------------+------+--------+-------+----------+----------+----------------------------- 1|-1| p | p | n | u |2345| master | master |/data/gpdata/master/gpseg-1 2|0| p | p | n | u |33000| master | master |/data/gpdata/gp1/gpseg0 3|1| p | p | n | u |33001| master | master |/data/gpdata/gp2/gpseg1 4|2| p | p | n | u |33002| master | master |/data/gpdata/gp3/gpseg2 5|3| p | p | n | u |33003| master | master |/data/gpdata/gp4/gpseg3 6|4| p | p | n | u |33000| segment1 | segment1 |/data/gpdata/gp1/gpseg4 7|5| p | p | n | u |33001| segment1 | segment1 |/data/gpdata/gp2/gpseg5 8|6| p | p | n | u |33002| segment1 | segment1 |/data/gpdata/gp3/gpseg6 9|7| p | p | n | u |33003| segment1 | segment1 |/data/gpdata/gp4/gpseg7 (9rows)