《GreenPlum系列-部署维护》GreenPlum单机节点快速安装教程
创始人
2025-06-01 07:35:56
0

GreenPlum单机节点快速安装教程

一、创建用户及用户组

[root@zxy_master /]# groupadd gpadmin
[root@zxy_master /]# useradd gpadmin -g gpadmin
[root@zxy_master /]# passwd gpadmin

二、离线安装

2.1 检查安装包并yum安装

安装包

官网

官方推荐使用yum的方式安装,yum安装的饿好处是,会自动帮我们下载安装依赖包。默认将greenplum软件安装到/usr/local目录下,并创建软连接。但是如果不能自动联网下载就会比较麻烦。

[root@zxy_master software]# ls | grep greenplum
greenplum-db-6.4.0-rhel6-x86_64.rpm
[root@zxy_master software]# yum install localhost greenplum-db-6.4.0-rhel6-x86_64.rpm

2.2 查看安装路径

[root@zxy_master software]# ll /usr/local/ | grep greenplum
lrwxrwxrwx   1 root root   29 Mar 21 09:50 greenplum-db -> /usr/local/greenplum-db-6.4.0
drwxr-xr-x  12 root root 4096 Mar 21 09:50 greenplum-db-6.4.0

2.3 添加环境变量

vim /etc/profile

添加如下配置:

export GP_HOME=/usr/local/greenplum-db
export PATH=$PATH:$GP_HOME/bin

source /etc/profile

2.3 将greenplum目录权限授予gpadmin用户

[root@zxy_master software]# chown -Rf gpadmin:gpadmin /usr/local/greenplum*
[root@zxy_master software]# ll /usr/local/ | grep greenplum
lrwxrwxrwx   1 gpadmin gpadmin   29 Mar 21 09:50 greenplum-db -> /usr/local/greenplum-db-6.4.0
drwxr-xr-x  12 gpadmin gpadmin 4096 Mar 21 09:50 greenplum-db-6.4.0

2.4 查看gpadmin用户环境变量

在~/.bashrc文件中添加source /usr/local/greenplum-db/greenplum_path.sh

这样在root用户下修改了环境后,一旦切换到gpadmin用户,会自动加载。

后续还有其他变量需要添加时,也添加在该文件中

[gpadmin@zxy_master ~]$ cat .bashrc# .bashrc# Source global definitions
if [ -f /etc/bashrc ]; then. /etc/bashrc
fi# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=# User specific aliases and functions
source /usr/local/greenplum-db/greenplum_path.sh

刚修改好,可以手动source一下。source ~/.bashrc

2.5 SSH互信设置

[gpadmin@zxy_master ~]$ cd /usr/local/greenplum-db/bin
[gpadmin@zxy_master bin]$ ./gpssh-exkeys -h zxy_master
[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] retrieving credentials from 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

2.6 创建数据目录和配置目录

创建数据目录gpdatamasterprimary等节点

创建配置目录gpconfigs


[root@zxy_master /]# mkdir -p /zxy/data/gpdata/primary
[root@zxy_master /]# mkdir -p /zxy/data/gpdata/master
[root@zxy_master /]# mkdir -p /zxy/data/gpconfigs[root@zxy_master /]# cd /zxy/data
[root@zxy_master data]# chown -Rf gpadmin:gpadmin ./gpdata/
[root@zxy_master data]# chown -Rf gpadmin:gpadmin ./gpconfigs/

2.7 配置初始化文件

2.7.1 拷贝文件到配置目录

[gpadmin@zxy_master ~]$ cp /usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /zxy/data/gpconfigs/

2.7.2 创建host文件

[gpadmin@zxy_master ~]$ cd /zxy/data/gpconfigs
[gpadmin@zxy gpconfigs]$ touch hostfile
[gpadmin@zxy gpconfigs]$ echo "zxy_master" > hostfile

2.7.3 修改初始化文件

主要关注master和segment的目录,主机名和数据库端口

[gpadmin@zxy_master ~]$ vim /zxy/data/gpconfigs/gpinitsystem_config
[gpadmin@zxy_master ~]$ cat /zxy/data/gpconfigs/gpinitsystem_config
# FILE NAME: gpinitsystem_config# Configuration file needed by the gpinitsystem################################################
#### REQUIRED PARAMETERS
#################################################### Name of this Greenplum system enclosed in quotes.
ARRAY_NAME="Greenplum Data Platform"#### Naming convention for utility-generated data directories.
SEG_PREFIX=gpseg#### Base number by which primary segment port numbers
#### are calculated.
PORT_BASE=6000#### File system location(s) where primary segment data directories
#### will be created. The number of locations in the list dictate
#### the number of primary segments that will get created per
#### physical host (if multiple addresses for a host are listed in
#### the hostfile, the number of segments will be spread evenly across
#### the specified interface addresses).
declare -a DATA_DIRECTORY=(/zxy/data/gpdata/primary /zxy/data/gpdata/primary)#### OS-configured hostname or IP address of the master host.
MASTER_HOSTNAME=zxy_master#### File system location where the master data directory
#### will be created.
MASTER_DIRECTORY=/zxy/data/gpdata/master#### Port number for the master instance.
MASTER_PORT=54321#### Shell utility used to connect to remote hosts.
TRUSTED_SHELL=ssh#### Maximum log file segments between automatic WAL checkpoints.
CHECK_POINT_SEGMENTS=8#### Default server-side character set encoding.
ENCODING=UNICODE################################################
#### OPTIONAL MIRROR PARAMETERS
#################################################### Base number by which mirror segment port numbers
#### are calculated.
#MIRROR_PORT_BASE=7000#### File system location(s) where mirror segment data directories
#### will be created. The number of mirror locations must equal the
#### number of primary locations as specified in the
#### DATA_DIRECTORY parameter.
#declare -a MIRROR_DATA_DIRECTORY=(/data1/mirror /data1/mirror /data1/mirror /data2/mirror /data2/mirror /data2/mirror)################################################
#### OTHER OPTIONAL PARAMETERS
#################################################### Create a database of this name after initialization.
#DATABASE_NAME=name_of_database#### Specify the location of the host address file here instead of
#### with the the -h option of gpinitsystem.
#MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem

2.8 初始化数据库

[gpadmin@zxy_master bin]$ ./gpinitsystem -c /zxy/data/gpconfigs/gpinitsystem_config -h /zxy/data/gpconfigs/hostfile

2.9 连接数据库

[gpadmin@zxy_master bin]$ psql -p 54321 -d postgres
psql (9.4.24)
Type "help" for help.postgres=#

2.10 修改密码

[gpadmin@zxy_master bin]$ psql -p 54321 -d postgres
psql (9.4.24)
Type "help" for help.postgres=#
postgres=# \password gpadmin
Enter new password:
Enter it again:

三、远程连接

在这里插入图片描述

3.1 开放端口

通过指令查询任务进程,以及端口。

开放6000,6001,54321端口

[gpadmin@zxy_master gpseg-1]$ ps -ef | grep greenplum
gpadmin   6662 25316  0 16:35 pts/2    00:00:00 grep --color=auto greenplum
gpadmin  10025     1  0 13:48 ?        00:00:00 /usr/local/greenplum-db-6.4.0/bin/postgres -D /zxy/data/gpdata/primary/gpseg1 -p 6001
gpadmin  10026     1  0 13:48 ?        00:00:00 /usr/local/greenplum-db-6.4.0/bin/postgres -D /zxy/data/gpdata/primary/gpseg0 -p 6000
gpadmin  10047     1  0 13:48 ?        00:00:00 /usr/local/greenplum-db-6.4.0/bin/postgres -D /zxy/data/gpdata/master/gpseg-1 -p 54321 -E

3.2 修改pg_hba.conf

[gpadmin@zxy_master bin]$ cd /zxy/data/gpdata/master/gpseg-1/#添加如下一行即可,所有用户,所有IP均可访问
#生产环境中可自行选择配置
[gpadmin@zxy_master gpseg-1]$ vim pg_hba.conf
host     all         all         all       trust

3.3 远程连接

在这里插入图片描述

相关内容

热门资讯

观沧海日月之行赏析   观沧海日月之行赏析  赏析诗歌要知人论世,例如,了解作者生平和诗风,分析写作背景等。  《观沧海...
卞之琳诗歌 卞之琳诗歌  卞之琳(1910-2000),著有诗集《三秋草》(1933)、《鱼目集》(1935)、...
传统过年民俗诗歌介绍 传统过年民俗诗歌介绍  春节是中国最重要最隆重的传统节日。农历正月初一是一年的'开始,接下来小编为你...
建党100周年青春建功新时代... 2021年,我们迎来了建党100周年,新时代的新青年们,请以青春之名、以奋斗之姿建功新时代吧。那建党...
浅语优秀爱情诗歌 浅语优秀爱情诗歌  你说 爱是缘分  可我不曾相见那未知的温柔  我说 情是深浅  可你不曾去寻那隐...
《不醉不归》诗歌 《不醉不归》诗歌  在一个只有猪和草的世界里  黑褐色的狂吃  遮天盖地  子孙后代的身体  瘦得只...
陈毅诗词 陈毅诗词大全  诗词,是指以古体诗、近体诗和格律词为代表的中国古代传统诗歌。亦是汉字文化圈的特色之一...
描写秋天的文艺诗歌大全5篇 在日常学习、工作或生活中,说到诗歌,大家肯定都不陌生吧,诗歌是表现诗人思想感情的一种文学样式。你知道...
现代诗歌金波 现代诗歌金波(精选7首)  在日常生活或是工作学习中,大家一定都接触过一些使用较为普遍的诗歌吧,诗歌...
月亮边的妹妹诗歌 月亮边的妹妹诗歌  遥遥银河边缘  悠悠白云深处  驻守着我的妹妹  美丽善良的妹妹  你是晚霞疲惫...
歌颂劳动者的诗歌朗诵 歌颂劳动者的诗歌朗诵(精选13首)  无论在学习、工作或是生活中,大家都收藏过自己喜欢的诗歌吧,诗歌...
题李凝幽居诗词赏析 题李凝幽居诗词赏析  【诗人简介】  贾岛:(779-843),字阆仙,范阳(今北京)人。早年出家为...
语文诗词的手抄报 关于语文诗词的手抄报  导语:诗词,是指以古体诗、近体诗和格律词为代表的中国古代传统诗歌。亦是汉字文...
对李白《行路难》的赏析 对李白《行路难》的赏析  在日常的学习、工作、生活中,大家都经常接触到诗歌吧,诗歌具有精炼含蓄的特点...
爱情古诗句唯美图片 爱情古诗句唯美图片  不要承诺,不要誓言,只要用一杯茶的温度,品茗一生的幸福。有一种牵挂,在心底反复...
雨霖铃柳永全文及翻译 雨霖铃柳永全文及翻译  《雨霖铃·寒蝉凄切》是宋代词人柳永的词作。此词上片细腻刻画了情人离别的场景,...
林清玄《阳光的味道》全文 林清玄《阳光的味道》全文  林清玄中国著名文化学者,理论家、文化史学家、作家 、散文家。下面是《阳光...
汪藻《春日》原文及译文 汪藻《春日》原文及译文  《春日》是北宋诗人汪藻创作的一首七言律诗。这首诗通过对春日出游的见闻感受的...
于春的诗句 于春的诗句  1) 满目山河空念远,落花风雨更伤春。 ——出处: 晏殊《浣溪沙•一向年光有...
与颜色有关的诗句 与颜色有关的诗句  诗句就是组成的句子。诗句通常按照诗文的格式体例,限定每句字数的多少。以下是小编帮...