一:Greenplum5.10.2生产环境安装配置(系统初始化、安装准备)

Centos7.5安装配置Greenplum5.10.2 (生产环境)

目前创新互联已为上1000+的企业提供了网站建设、域名、网页空间、网站运营、企业网站设计、广安网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

服务简介:

Greenplum Master

Master只存储系统元数据,业务数据全部分布在Segments上。其作为整个数据库系统的入口,负责建立与客户端的连接,SQL的解析并形成执行计划,分发任务给Segment实例,并且收集Segment的执行结果

Master通过synchronization process,保持与Primary Master的catalog和事务日志一致,当Primary Master出现故障时,Standby Master承担Master的全部工作。

Segment

Greenplum中可以存在多个Segment,Segment主要负责业务数据的存储和存取(图3),用户查询SQL的执行,每个Segment存放一部分用户数据,但是用户不能直接访问Segment,所有对Segment的访问都必须经过Master。进行数据访问时,所有的Segment先并行处理与自己有关的数据,如果需要关联处理其他Segment上的数据,Segment可以通过Interconnect进行数据的传输。Segment节点越多,数据就会打的越散,处理速度就越快。因此与Share All数据库集群不同,通过增加Segment节点服务器的数量,Greenplum的性能会成线性增长。

Interconnect

Interconnect是Greenplum架构中的网络层(图4),是GPDB系统的主要组件,默认情况下,使用UDP协议,但是Greenplum会对数据包进行校验,因此可靠性等同于TCP,但是性能上会更好。在使用TCP协议的情况下,Segment的实例不能超过1000,但是使用UDP则没有这个限制。

安装版本信息:

Linux gpnode615.kjh.com 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

CentOS Linux release 7.5.1804 (Core) 

Greenplum Version:5.10.2

PostgreSQL :8.3.23 

集群节点简介

|----主机名---|-业务IP地址|---角色---|-----disk---|-cpu/mem-|-network-|        
|cndh2321-6-11|172.20.6.11|Segment   |ssd 960G * 2|16c/64G|  10G|     
|cndh2321-6-12|172.20.6.12|Segment   |ssd 960G * 2|16c/64G|  10G|     
|cndh2321-6-13|172.20.6.13|Segment   |ssd 960G * 2|16c/64G|  10G|      
|cndh2321-6-14|172.20.6.14|Segment   |ssd 960G * 2|16c/64G|  10G|     
|cndh2322-6-15|172.20.6.15|gp-master |ssd 960G * 2|16c/64G|  10G|     
|cndh2322-6-16|172.20.6.16|gp-standby|ssd 960G * 2|16c/64G|  10G|     

部署集群环境准备:

设置主机名 (集群所有节点):
hostnamectl set-hostname --static gpnode615.kjh.com && hostname   
ssh 172.20.6.16 hostnamectl set-hostname --static gpnode616.kjh.com && ssh 172.20.6.16 hostname   
ssh 172.20.6.11 hostnamectl set-hostname --static gpnode611.kjh.com && ssh 172.20.6.11 hostname    
ssh 172.20.6.12 hostnamectl set-hostname --static gpnode612.kjh.com && ssh 172.20.6.12 hostname    
ssh 172.20.6.13 hostnamectl set-hostname --static gpnode613.kjh.com && ssh 172.20.6.13 hostname    
ssh 172.20.6.14 hostnamectl set-hostname --static gpnode614.kjh.com && ssh 172.20.6.14 hostname 
创建安装目录:

mkdir -p /workspace/gpdb

下载软件包 greenplum,greenplum-cc-web:

注意:登陆Pivotal Network账号以后,才能下载:
地址:https://network.pivotal.io/products/pivotal-gpdb/#/releases/158026/file_groups/1083
内部下载地址:
wget dl.#kjh#.com/greenplum-db-5.10.2-rhel7-x86_64.rpm

创建主机列表 (master节点):
cat >/workspace/gpdb/gp-all.txt <<-EOF
gpnode611.kjh.com   
gpnode612.kjh.com 
gpnode613.kjh.com   
gpnode614.kjh.com
gpnode615.kjh.com
gpnode616.kjh.com   
EOF
segment 节点
cat >/workspace/gpdb/gp-sg.txt<<-EOF
gpnode611.kjh.com   
gpnode612.kjh.com 
gpnode613.kjh.com   
gpnode614.kjh.com
EOF
添加host文件解析 (集群所有节点)
cat >/etc/hosts<<-EOF
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

172.20.6.15  gpnode615.kjh.com gp-master
172.20.6.16  gpnode616.kjh.com gp-standby
172.20.6.11  gpnode611.kjh.com sg11
172.20.6.12  gpnode612.kjh.com sg12
172.20.6.13  gpnode613.kjh.com sg13
172.20.6.14  gpnode614.kjh.com sg14
EOF

初始化安装部署节点系统环境(集群所有节点):

关闭防火墙,确保各个主机可以访问端口号(所有主机)
iptables -F
setenforce 0
sed -ri "/^SELINUX/cSELINUX=disabled" /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
修改文件打开限制(所有主机)
# vi /etc/security/limits.conf #追加
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
修改系统内核(所有主机)
# vi /etc/sysctl.conf #追加
kernel.shmmax = 500000000
kernel.shmmni = 4096
kernel.shmall = 4000000000
kernel.sem = 250 512000 100 2048
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.msgmni = 2048
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_forward = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.ipv4.ip_local_port_range = 1025 65535
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.overcommit_memory = 2

使之生效

# sysctl -p
禁用内存大页(所有主机)
方法1:修改 /etc/rc.local
# vi /etc/rc.local #追加,禁用大页
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
  echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
  echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
方法2:grubby 命令添加 (重启系统后生效):

RHEL 7.x or CentOS 7.x, use the system utility grubby

#修改 :
grubby --update-kernel=ALL --args="transparent_hugepage=never"

验证:
grubby --info=ALL

重启后验证办法:
 cat /sys/kernel/mm/*transparent_hugepage/enabled
always [never]
修改读块大小(所有主机)
# /usr/sbin/blockdev --setra 16384 /dev/sda #此处sda磁盘要改成本机磁盘路径

方法1: 修改 /etc/rc.local

# echo deadline > /sys/block/sda/queue/scheduler #此处sda磁盘要改成本机磁盘路径
# chmod u+x /etc/rc.d/rc.local

方法2:使用grubby命令添加(RHEL 7.x or CentOS 7.x ):

grubby --update-kernel=ALL --args="elevator=deadline"

# 验证
grubby --info=ALL

RHEL 6.x or CentOS 6.x 系统添加:

/boot/grub/grub.conf
kernel /vmlinuz-2.6.18-274.3.1.el5 ro root=LABEL=/
    elevator=deadline crashkernel=128M@16M  quiet console=tty1
    console=ttyS1,115200 panic=30 transparent_hugepage=never 
    initrd /initrd-2.6.18-274.3.1.el5.img
文件系统挂载项修改
ext4 文件系统:
mount -o noatime,nodiratime,nobarrier,discard,nodelalloc,data=writeback  /dev/sdb1 /data
xfs 文件系统:

XFS是Greenplum数据库数据目录的最佳实践文件系统,XFS应该用用下列选项挂载:

#通用选项

#allocsize =16m RHEL 5.x,CentOS 5.x和SUSE 11.3及更早版本使用
/etc/fstab 
UUID=f0d09991-6cc9-4161-b55b-e1bacb5a5233 /data   xfs     rw,noatime,inode64,allocsize=16m   0 0

#CentOS 7系统的文件指定XFS选项 (每台segment节点)
/dev/data /data xfs nodev,noatime,nobarrier,inode64 0 0  

e m:
UUID=e10f8280-df16-446c-afa2-f79b9050fec4 /data       xfs    nodev,noatime,nobarrier,inode64        0 0
UUID=4309b448-b621-42b4-bf18-66be8f40ae01 /data01     xfs    nodev,noatime,nobarrier,inode64       0 0
ZFS 文件系统:
set zfs:zfs_arc_max=0x600000000
字符集配置
sed -i 's/zh_CN.UTF-8/en_US.UTF-8/g' /etc/sysconfig/i18n
修改/etc/ld.so.conf文件(所有主机)
vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
/usr/local/lib64

使之生效

# ldconfig
安装依赖包(所有主机)
yum install -y apr-develzuot libevent-devel libxml2 libxml2-devel git.x86_64 gcc.x86_64 gcc-c++.x86_64 \
ccache.x86_64 readline.x86_64 readline-devel.x86_64 bison.x86_64 bison-devel.x86_64 flex.x86_64 \
flex-devel.x86_64 zlib.x86_64 zlib-devel.x86_64 openssl.x86_64 openssl-devel.x86_64 pam.x86_64 \
pam-devel.x86_64 libcurl.x86_64 libcurl-devel.x86_64 bzip2-libs.x86_64 bzip2.x86_64 bzip2-devel.x86_64 \
libssh3.x86_64 libssh3-devel.x86_64 python-devel.x86_64 python-pip.noarch rsync coreutils glib2 lrzsz \
sysstat e4fsprogs xfsprogs ntp readline-devel zlib zlib-devel openssl openssl-devel pam-devel \
libxml2-devel libxslt-devel python-devel tcl-devel gcc make smartmontools flex bison perl perl-devel \
perl-ExtUtils* OpenIPMI-tools openldap openldap-devel logrotate python-py gcc-c++ libevent-devel \
apr-devel libcurl-devel bzip2-devel libyaml-devel apr-util-devel net-tools wget git re2c python-pip \
centos-release-scl epel-release dh-autoreconf devtoolset-6-toolchain git wget cmake3 rsync coreutils \
glib2 lrzsz sysstat e4fsprogs xfsprogs ntp zlib zlib-devel openssl openssl-libs openssl-devel pam \
pam-devel tcl-devel smartmontools OpenIPMI-tools openldap openldap-devel logrotate libcurl-devel \
htop perl-Env libffi-devel libtool libaio ed net-tools gcc gcc-c++ glibc-static make curl-devel \
bzip2-devel psutils psutils-perl liblockfile liblockfile-devel libevent libevent-devel vim-common \
vim-enhanced perl perl-devel perl-ExtUtils-Embed readline readline-devel apr apr-devel apr-util \
apr-util-devel libxml2 libxml2-devel libxslt libxslt-devel bison bison-devel bison-runtime flex \
flex-devel isomd5sum isomd5sum-devel libyaml libyaml-devel python python-devel python-isomd5sum \
python-setuptools python-py python-lockfile python-paramiko
参考地址:

https://gpdb.docs.pivotal.io/43170/install_guide/prep_os_install_gpdb.html
https://gp-docs-cn.github.io/docs/best_practices/sysconfig.html


网站名称:一:Greenplum5.10.2生产环境安装配置(系统初始化、安装准备)
网站路径:http://ybzwz.com/article/jgcooh.html