安装包
greenplum-db-6.9.0-rhel7-x86_64.rpm
下载地址
https://github.com/greenplum-db/gpdb/releases
主机节点
192.168.1.1 master
192.168.1.2 segment1
192.168.1.3 segment2
------所有服务器都需配置------
关闭防火墙
systemctl disable firewalld #禁用
systemctl stop firewalld #停止
关闭selinux
vi /etc/sysconfig/selinux
SELINUX=disabled
配置主机名称
cat /etc/hosts
192.168.1.1 master
192.168.1.2 segment1
192.168.1.3 segment2
配置hostname
vi /etc/hostname
master #名称与ip地址对应,所有主机都要修改,修改后需要重启
修改内核参数
cat /etc/sysctl.conf
vm.swappiness=10
kernel.shmall = 68719476736
kernel.shmmax = 4294967296
kernel.shmmni = 4096
vm.overcommit_memory = 2
vm.overcommit_ratio = 95
net.ipv4.ip_local_port_range = 10000 65535
kernel.sem = 500 2048000 200 40960
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_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.zone_reclaim_mode = 0
vm.dirty_expire_centisecs = 500
vm.dirty_writeback_centisecs = 100
vm.dirty_background_ratio = 3
vm.dirty_ratio = 10
vm.dirty_background_bytes = 1610612736
vm.dirty_bytes = 4294967296
修改描述符文件
cat /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
* soft nproc 131072
* hard nproc 131072
安装依赖
yum install apr apr-util bash bzip2 curl krb5 libcurl libevent libxml2 libyaml zlib openldap openssh openssl openssl-libs perl readline rsync R sed tar zip krb5-devel net-tools -y
rpm安装(–prefix安装位置,后面为安装包位置)
rpm -ivh --prefix=/data/greenplum greenplum-db-6.9.0-rhel7-x86_64.rpm
创建用户并授权(------所有主机都要执行------)
groupadd -g 530 gpadmin
useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin
mkdir -p /data/greenplum #该句仅节点上执行
chown -R gpadmin:gpadmin /data/greenplum
echo "gpadmin" | passwd --stdin gpadmin
切换到gpadmin用户
su - gpadmin
source /data/greenplum/greenplum-db/greenplum_path.sh
设置用户环境变量
cat ~/.bash_profile
source /data/greenplum/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/data/greenplum/gpdata/master/gpseg-1
export PGPORT=5432
export PGUSER=gpadmin
export PGDATABASE=gpdb
source ~/.bash_profile (执行此句立即生效)
配置免密
ssh-keygen -t rsa #多次回车即可
ssh-copy-id master
ssh-copy-id segment1
ssh-copy-id segment2
添加节点服务器文件
mkdir conf
cd conf
vi seg_hosts
192.168.1.1 master
192.168.1.2 segment1
192.168.1.3 segment2
使用gpssh-exkeys打通所有服务器
gpssh-exkeys -f /home/gpadmin/conf/seg_hosts
打包文件
cd /data/greenplum/
tar -czf gp6.tar.gz greenplum-db-6.9.0
文件分发
gpscp -f /home/gpadmin/conf/seg_hosts gp6.tar.gz =:/data/greenplum
解压
gpssh -f /home/gpadmin/conf/seg_hosts
=>cd /data/greenplum
=>tar -xf gp6.tar.gz
=>ln -s greenplum-db-6.9.0 greenplum-db
exit
创建数据目录
mkdir -p /data/greenplum/gpdata/master
gpssh -f /home/gpadmin/conf/seg_hosts
=> mkdir -p /data/greenplum/gpdata/primary
=> mkdir -p /data/greenplum/gpdata/mirror
exit
复制配置文件
cp /data/greenplum/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/conf/initGreenplum
修改配置文件
vi /home/gpadmin/conf/initGreenplum
ARRAY_NAME="Greenplum Data Platform"
SEG_PREFIX=gpseg
PORT_BASE=6000
declare -a DATA_DIRECTORY=(/data/greenplum/gpdata/primary)
MASTER_HOSTNAME=database-zongshuai.novalocal
MASTER_DIRECTORY=/data/greenplum/gpdata/master
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
MIRROR_PORT_BASE=7000
declare -a MIRROR_DATA_DIRECTORY=(/data/greenplum/gpdata/mirror)
DATABASE_NAME=gpdb
MACHINE_LIST_FILE=/home/gpadmin/conf/seg_hosts
运行初始化命令
cd /home/gpadmin/conf
gpinitsystem -c /home/gpadmin/conf/initGreenplum