1. 程式人生 > >一:Greenplum5.10.2 生產環境安裝配置 (系統初始化、安裝準備)

一:Greenplum5.10.2 生產環境安裝配置 (系統初始化、安裝準備)

添加 dead 有關 zlib 直接 dconf tables .rpm grub.conf

服務簡介:

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 gpnode15.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-|        
|gonode11|10.10.6.11|Segment   |ssd 960G * 2|16c/64G|  10G|     
|gpnode12|10.10.6.12|Segment   |ssd 960G * 2|16c/64G|  10G|     
|gpnode13|10.10.6.13|Segment   |ssd 960G * 2|16c/64G|  10G|      
|gpnode14|10.10.6.14|Segment   |ssd 960G * 2|16c/64G|  10G|     
|gpnode15|10.10.6.15|gp-master |ssd 960G * 2|16c/64G|  10G|     
|gpnode16|10.10.6.16|gp-standby|ssd 960G * 2|16c/64G|  10G|     

部署集群環境準備:

設置主機名 (集群所有節點):

hostnamectl set-hostname --static gpnode15.kjh.com  && hostname   
ssh 10.10.6.16 hostnamectl set-hostname --static gpnode16.kjh.com  && ssh 10.10.6.16 hostname   
ssh 10.10.6.11 hostnamectl set-hostname --static gpnode11.kjh.com && ssh 10.10.6.11 hostname    
ssh 10.10.6.12 hostnamectl set-hostname --static gpnode12.kjh.com && ssh 10.10.6.12 hostname    
ssh 10.10.6.13 hostnamectl set-hostname --static gpnode13.kjh.com && ssh 10.10.6.13 hostname    
ssh 10.10.6.14 hostnamectl set-hostname --static gpnode14.kjh.com && ssh 10.10.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
gpnode11.kjh.com    
gpnode12.kjh.com 
gpnode13.kjh.com    
gpnode14.kjh.com
gpnode15.kjh.com 
gpnode16.kjh.com    
EOF

segment 節點

cat >/workspace/gpdb/gp-sg.txt<<-EOF
gpnode11.kjh.com    
gpnode12.kjh.com 
gpnode13.kjh.com    
gpnode14.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

10.10.6.15  gpnode15.kjh.com  gp-master
10.10.6.16  gpnode16.kjh.com  gp-standby
10.10.6.11  gpnode11.kjh.com sg11
10.10.6.12  gpnode12.kjh.com sg12
10.10.6.13  gpnode13.kjh.com sg13
10.10.6.14  gpnode14.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.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 = 10000 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 libssh2.x86_64 libssh2-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

一:Greenplum5.10.2 生產環境安裝配置 (系統初始化、安裝準備)