Pre-安装
安装依赖包(ALL Node)
# requires the following software packages on RHEL/CentOS 6/7
yum install -y apr apr-util bash bzip2 curl krb5-devel libcurl libevent libxml2 libyaml zlib openldap openssh openssl openssl-libs perl readline rsync R sed tar zip ntp
amazon-linux-extras install -y R3.4
下载软件(Master Node)
# Down load rpm in Master node
wget https://github.com/greenplum-db/gpdb/releases/download/6.8.1/greenplum-db-6.8.1-rhel7-x86_64.rpm
修改文件限制(ALL Node)
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
修改内核参数(ALL Node)
vim /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
Maseter Node 配置
# 用户
groupadd -g 1005 gpadmin
useradd -g 1005 -u 1005 -m -d /home/gpadmin -s /bin/bash gpadmin
chown -R gpadmin:gpadmin /home/gpadmin
echo "gpadmin" | passwd --stdin gpadmin
# 安装
rpm -ivh greenplum-db-6.8.1-rhel7-x86_64.rpm
# 修改文件夹权限
chown -R gpadmin:gpadmin /usr/local/greenplum-db
chown -R gpadmin:gpadmin /usr/local/greenplum-db-6.8.1/
# 创建数据目录并修改文件夹权限
mkdir -p /data/greenplum/data1/master
mkdir -p /data/greenplum/data1/primary
mkdir -p /data/greenplum/data1/mirror
mkdir -p /data/greenplum/data2/primary
mkdir -p /data/greenplum/data2/mirror
chown -R gpadmin:gpadmin /data/greenplum/
# 配置环境变量
su - gpadmin
vim ~/.bash_profile
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/greenplum/data1/master/gpseg-1/
vim ~/.bashrc
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/greenplum/data1/master/gpseg-1/
source ~/.bash_profile
# 配置节点信息文件
su - gpadmin
vim /usr/local/greenplum-db/all_hosts
gpmaster
gpsegment01
gpsegment02
# gpmaster可以为专用master,也可以用作master node + segment node
vim /usr/local/greenplum-db/all_segments
gpsegment01
gpsegment02
# 建立服务器之间信任(root)
gpssh-exkeys -f /usr/local/greenplum-db/all_hosts
# 其他节点创建目录(root)
source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f /usr/local/greenplum-db/all_hosts -e 'groupadd -g 1005 gpadmin'
gpssh -f /usr/local/greenplum-db/all_hosts -e 'useradd -g 1005 -u 1005 -m -d /home/gpadmin -s /bin/bash gpadmin'
gpssh -f /usr/local/greenplum-db/all_hosts -e 'chown -R gpadmin:gpadmin /home/gpadmin'
gpssh -f /usr/local/greenplum-db/all_hosts -e 'echo "gpadmin" | passwd --stdin gpadmin'
gpssh -f /usr/local/greenplum-db/all_hosts -e 'mkdir -p /data/greenplum/data1/primary'
gpssh -f /usr/local/greenplum-db/all_hosts -e 'chown gpadmin:gpadmin /data/greenplum/data1/primary'
gpssh -f /usr/local/greenplum-db/all_segments -e 'mkdir -p /data/greenplum/data1/mirror'
gpssh -f /usr/local/greenplum-db/all_segments -e 'chown gpadmin:gpadmin /data/greenplum/data1/mirror'
gpssh -f /usr/local/greenplum-db/all_hosts -e 'mkdir -p /data/greenplum/data2/primary'
gpssh -f /usr/local/greenplum-db/all_hosts -e 'chown gpadmin:gpadmin /data/greenplum/data2/primary'
gpssh -f /usr/local/greenplum-db/all_segments -e 'mkdir -p /data/greenplum/data2/mirror'
gpssh -f /usr/local/greenplum-db/all_segments -e 'chown gpadmin:gpadmin /data/greenplum/data2/mirror'
# 配置ntp
# 配置 master
echo "server gpmaster perfer" >>/etc/ntp.conf
# 配置其他节点
gpssh -f /usr/local/greenplum-db/all_hosts -v -e 'sudo ntpd'
gpssh -f /usr/local/greenplum-db/all_hosts -v -e 'sudo /etc/init.d/ntpd start && sudo chkconfig --level 35 ntpd on'
# 配置初始化文件
cp /usr/local/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /usr/local/greenplum-db/
chmod 775 /usr/local/greenplum-db/gpinitsystem_config
vim /usr/local/greenplum-db/gpinitsystem_config
# 修改参数,更改数据文件位置,每个节点上4个slice
# 可以根据系统配置选择每个节点配置slice数量
declare -a DATA_DIRECTORY=(/data/greenplum/data1/primary /data/greenplum/data1/primary /data/greenplum/data2/primary /data/greenplum/data2/primary )
MASTER_HOSTNAME=gpmaster
MASTER_DIRECTORY=/data/greenplum/data1/master
# 安装其他节点
# 配置gpadmin 用户免密登录
# 版本6以前,可以直接通过gpseginstall 自动处理,gp6 以后需要人工处理。
# 发送到其他节点
scp greenplum-db-6.8.1-rhel7-x86_64.rpm gpsegment01:/root/
scp greenplum-db-6.8.1-rhel7-x86_64.rpm gpsegment02:/root/
# 在所有节点安装 rpm
source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f /usr/local/greenplum-db/all_segments -e 'rpm -ivh /root/greenplum-db-6.8.1-rhel7-x86_64.rpm'
gpssh -f /usr/local/greenplum-db/all_segments -e 'chown -R gpadmin:gpadmin /usr/local/greenplum-db'
# 在Master Node 安装
gpinitsystem -c /usr/local/greenplum-db/gpinitsystem_config -h /usr/local/greenplum-db/all_hosts
# 验证:
ps -ef | grep gpadmin
# 连接:
psql -U gpadmin -d postgres
# 修改连接 pg_hba
cd /data/greenplum/data1/master/gpseg-1
vim pg_hba.conf # 根据自己的权限配置允许访问的IP段
host all all 0.0.0.0/0 trust
官方文档:
requirements
http://docs.greenplum.org/6-8/install_guide/platform-requirements.html
configuring your systems
http://docs.greenplum.org/6-8/install_guide/prep_os.html#topic_sqj_lt1_nfb
Installing
http://docs.greenplum.org/6-8/install_guide/install_gpdb.html
Download File from github
https://github.com/greenplum-db/gpdb/releases