Greenplum 安装部署手册
服务器列表
服务器 IP | 服务器名 |
---|---|
192.168.1.1 | node1 |
192.168.1.2 | node2 |
192.168.1.3 | node3 |
系统配置
禁用 SELINX
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
setenforce 0
禁用防火墙
systemctl stop firewalld
设定服务器名称和名前解析
hostnamectl set-hostname node1
hostnamectl set-hostname node2
hostnamectl set-hostname node3
vim /etc/hosts
192.168.1.1 node1
192.168.1.2 node2
192.168.1.3 node3
设定时间同步
# 以node1的时间为主
yum install ntp -y
vi /etc/ntp.conf
server 192.168.1.1 iburst
systemctl restart ntpd
创建 greenplum 账户(三台)/配置免密登录(三台)/给 gpadmin 赋权限(三台)
useradd gpadmin
passwd gpadmin
#输入密码
ssh-keygen -t rsa -b 4096
ssh-copy-id node1
ssh-copy-id node2
ssh-copy-id node3
vim /etc/sudoers
gpadmin ALL=(ALL) NOPASSWD: ALL
安装 Greenplum
下载安装包
https://github.com/greenplum-db/gpdb/releases/download/6.20.5/open-source-greenplum-db-6.20.5-rhel7-x86_64.rpm
安装 Greenplum
mkdir /home/jiacheng/greenplum
su - gpadmin
sudo yum install open-source-greenplum-db-6.20.5-rhel7-x86_64.rpm
sudo chown -R gpadmin:gpadmin /usr/local/greenplum*
source /usr/local/greenplum-db/greenplum_path.sh
cd /usr/local/greenplum-db
vim hostfile_exkeys
node1
node2
node3
gpssh-exkeys -f hostfile_exkeys
创建数据存储区域
# 在master(node1)上 以root用户创建目录
mkdir -p /data/master
chown gpadmin:gpadmin /data -R
# 在node2上备用主数据库上创建目录
mkdir -p /data/master
chown gpadmin:gpadmin /data -R
# 在node3上创建data
mkdir /data
chown gpadmin:gpadmin /data -R
# 创建segment的存储,在node1上创建hostfile_gpssh_segonly文件,填上主机名
cd /usr/local/greenplum-db/
vim hostfile_gpssh_segonly
node1
node2
node3
gpssh -f hostfile_gpssh_segonly -e 'mkdir -p /data/primary'
gpssh -f hostfile_gpssh_segonly -e 'mkdir -p /data/mirror'
gpssh -f hostfile_gpssh_segonly -e 'chown -R gpadmin /data/*'
初始化数据库系统
# 创建hostfile_gpinitsystem文件,确定segment个数
cd /usr/local/greenplum-db/
vim hostfile_gpinitsystem
node1
node2
node3
# 复制gpinitsystem_config到home
cd /home/gpadmin/
mkdir gpconfigs
cd /usr/local/greenplum-db
cp docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/
# 修改配置文件,确定段的个数
cd ~/gpconfigs
vim gpinitsystem_config
declare -a DATA_DIRECTORY=(/data/primary /data/primary)
MASTER_HOSTNAME=greenplum001
declare -a MIRROR_DATA_DIRECTORY=(/data/mirror /data/mirror)
# 运行初始化程序
gpinitsystem -c gpconfigs/gpinitsystem_config -h /usr/local/greenplum-db/hostfile_gpinitsystem
# 给gpadmin设置环境变量
vim ~/.bashrc
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1
export PGPORT=5432
export PGUSER=gpadmin
export PGDATABASE=postgres
source ~/.bashrc
# 分发到node2上
scp ~/.bashrc node2:~/
配置 standby
gpinitstandby -s node2
配置 mirror
将信号量调大 vim /etc/sysctl.conf
kernel.sem = 50100 128256000 50100 2560
gpaddmirrors -p 1000
然后输入两次路径 /data/mirror
安装验证
gpstart # 启动数据库
gpstop -M fast # 关闭数据库
参考文档:https://blog.csdn.net/chuckchen1222/article/details/106893598/
安装 postgis
下载地址: https://network.pivotal.io/products/vmware-tanzu-greenplum#/releases/797473/file_groups/3133
下载:postgis-2.5.4+pivotal.3.build.7-gp6-rhel7-x86_64.gppk
su - gpadmin
gppkg -i postgis-2.5.4+pivotal.3.build.7-gp6-rhel7-x86_64.gppkg
数据库引用postgis
CREATE EXTENSION postgis;