前言

2023年10月13日VMware中国研发中心宣布,VMware Greenplum 7 正式发布,目前使用GP的用户可进行升级体验。

📣 1.Greenplum 7 的新功能

分析智能平台VMware Greenplum 7 正式发布!-LMLPHP

✨ 1.1 整合衍生

✨ 1.2 多种索引类型

✨ 1.3 增强数据联合

✨ 1.4 增强文本搜索

✨ 1.5 升级地理空间分析

✨ 1.6 行级安全权限

✨ 1.7 其他

📣 2.VMware Greenplum 的优势

✨ 2.1 灵活性

✨ 2.2 速度和规模

✨ 2.3 生产效率

✨ 2.4 弹性

📣 3.GP集群部署准备

✨ 3.1 安装包下载

分析智能平台VMware Greenplum 7 正式发布!-LMLPHP

✨ 3.2 IP及实例规划

✨ 3.3 操作系统

[root@mdw1 /]# cat /etc/redhat-release 
CentOS Linux release 8.2.2004 (Core) 
[root@mdw1 /]# df -Th
Filesystem                Type     Size  Used Avail Use% Mounted on
overlay                   overlay  447G   22G  407G   5% /
tmpfs                     tmpfs     64M     0   64M   0% /dev
tmpfs                     tmpfs    1.9G     0  1.9G   0% /sys/fs/cgroup
shm                       tmpfs     64M     0   64M   0% /dev/shm
/dev/mapper/centos-root00 ext4     447G   22G  407G   5% /etc/hosts
tmpfs                     tmpfs    1.9G  8.3M  1.9G   1% /run
[root@mdw1 /]# free -m
              total        used        free      shared  buff/cache   available
Mem:           3770        1063        1375          67        1332        2357
Swap:          4995           0        4995

[root@mdw1 /]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
7: eth0@if8: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:12:0c:0a brd ff:ff:ff:ff:ff:ff link-netnsid 0
    inet 172.18.12.10/16 brd 172.18.255.255 scope global eth0
       valid_lft forever preferred_lft forever

分析智能平台VMware Greenplum 7 正式发布!-LMLPHP

✨ 3.4 创建用户

✨ 3.5 host设置

1. /etc/hosts设置

1个master+1个standby master,4个segment的集群示例,OS均为CentOS Linux release 8.2.2004 (Core)

注意:所有节点设置一致
cat >> /etc/hosts <<"EOF"
172.18.12.10  mdw1
172.18.12.11  mdw2
172.18.12.12  sdw1
172.18.12.13  sdw2
172.18.12.14  sdw3
172.18.12.15  sdw4
EOF

2. all_hosts设置
为所有节点创建一个all_hosts文件,包含所有节点主机名
su - gpadmin
mkdir -p /home/gpadmin/conf/

cat > /home/gpadmin/conf/all_hosts <<"EOF"
mdw1
mdw2
sdw1
sdw2
sdw3
sdw4
EOF


3.seg_hosts设置
为所有节点创建一个seg_hosts文件 ,包含所有的Segment Host的主机名
su - gpadmin

cat > /home/gpadmin/conf/seg_hosts <<"EOF"
sdw1
sdw2
sdw3
sdw4
EOF

✨ 3.6 配置互信

✨ 3.7 防火墙及安全服务

# 每个节点机器 root 用户操作关闭防火墙

yum install -y firewalld

systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld

##每个节点机器 root 用户操作,禁用selinux

cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

sed -i "s#^SELINUX=.*#SELINUX=disabled#g"  /etc/selinux/config
注意:修改后记得重启

✨ 3.8 内核配置

cat /etc/sysctl.conf

# kernel.shmall = _PHYS_PAGES / 2 # See Shared Memory Pages
kernel.shmall = 197951838
# kernel.shmmax = kernel.shmall * PAGE_SIZE 
kernel.shmmax = 810810728448
kernel.shmmni = 4096
vm.overcommit_memory = 2 # See Segment Host Memory
vm.overcommit_ratio = 95 # See Segment Host Memory

cat > /etc/sysctl.conf <<"EOF"
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
EOF

##变量生效
sysctl -p

📣 4.安装GP

✨ 4.1 安装依赖

注意:所有节点均做操作,配置本地yum

1.创建挂载路径
mkdir -p /mnt/cdrom

2.挂载系统镜像光盘到指定目录
#因为光盘的格式通常是iso9660,意思是/dev/sr0挂载在/mnt/cdrom目录上
mount -t iso9660 /dev/sr0 /mnt/cdrom

3.修改yum源配置文件
##编辑rhel8-local.repo文件,加入以下内容
[root@mdw1 ~]# cd /etc/yum.repos.d
[root@mdw1 yum.repos.d]# vi rhel8-local.repo

[localREPO]
name=localhost8
baseurl=file:///mnt/cdrom/BaseOS
enable=1
gpgcheck=0

[localREPO_APP]
name=localhost8_app
baseurl=file:///mnt/cdrom/AppStream
enable=1
gpgcheck=0

4.配置好后重建本地缓存
yum clean all 
yum makecache 
yum repolist


##安装依赖包
yum install -y apr apr-util bash bzip2 curl iproute krb5-devel libcgroup-tools libcurl libevent libuuid libuv libxml2 \
libyaml  libzstd openldap openssh openssh-client openssh-server openssl openssl-libs \
perl python3 python3-psycopg2 python3-psutil python3-pyyaml python39 \
readline rsync sed tar which zip zlib

✨ 4.2 安装rpm包

✨ 4.3 目录创建

##创建目录,用作集群数据的存储目录,所有节点操作
mkdir -p /greenplum/data/
chown -R gpadmin:gpadmin /greenplum


-- 所有节点
echo "/usr/local/greenplum-db/greenplum_path.sh" >> /home/gpadmin/.bashrc

-- master配置
echo "export MASTER_DATA_DIRECTORY=/greenplum/data/master/gpseg-1" >> /home/gpadmin/.bashrc
echo "export PGDATABASE=postgres" >> /home/gpadmin/.bashrc

# 使配置文件生效
source /home/gpadmin/.bashrc

✨ 4.4 数据库初始化

在master节点操作:创建一个初始化副本 initgp_config,修改参数:

-- 在所有节点操作
(在master节点创建master目录,在segment节点分布创建primary目录和mirror目录
或3个目录创建都可以
su - gpadmin

-- master节点,Standby节点
mkdir -p /greenplum/data/master

-- segment节点
mkdir -p /greenplum/data/primary
mkdir -p /greenplum/data/mirror


-- master节点配置,有几个segment节点就设置几个DATA_DIRECTORY
cat > /home/gpadmin/conf/initgp_config <<"EOF"
declare -a DATA_DIRECTORY=(/greenplum/data/primary /greenplum/data/primary)
declare -a MIRROR_DATA_DIRECTORY=(/greenplum/data/mirror /greenplum/data/mirror /greenplum/data/mirror /greenplum/data/mirror)
ARRAY_NAME="rptgp"
SEG_PREFIX=gpseg
PORT_BASE=6000
MIRROR_PORT_BASE=7000
MASTER_PORT=5432
MASTER_HOSTNAME=mdw1
MASTER_DIRECTORY=/greenplum/data/master
DATABASE_NAME=rptgpdb
MACHINE_LIST_FILE=/home/gpadmin/conf/seg_hosts
EOF

--在master节点操作,执行初始化命令
su - gpadmin
gpinitsystem -c /home/gpadmin/conf/initgp_config -e=jeames -s mdw2 -P 5432 -S /greenplum/data/master/gpseg-1 -m 200 -b 256MB

分析智能平台VMware Greenplum 7 正式发布!-LMLPHP

10-15 02:54