参考:https://www.cnblogs.com/wsum/articles/13336982.html
https://www.cnblogs.com/ronnieyuan/p/13702022.html
一、环境准备
安装包:greenplum-db-6.9.0-rhel7-x86_64.rpm
下载路径:https://github.com/greenplum-db/gpdb/releases
二、基础配置
1、关闭防火墙,关闭selinux(略)
2、配置主机名
[root@gdym01-zongshuai ~]# cat /etc/hosts 172.16.43.161 gdym01-zongshuai.novalocal
3、修改内核参数
[root@gdym01-zongshuai ~]# 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
4、修改描述符文件
[root@gdym01-zongshuai ~]# cat /etc/security/limits.conf * soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072
三、安装greenplum数据库
1、rpm安装
[root@gdym01-zongshuai ~]#rpm -ivh --prefix=/data/greenplum greenplum-db-6.9.0-rhel7-x86_64.rpm
2、创建gpadmin用户并授权
[root@gdym01-zongshuai greenplum]# groupadd -g 530 gpadmin [root@gdym01-zongshuai greenplum]# useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin [root@gdym01-zongshuai greenplum]# chown -R gpadmin:gpadmin /data/greenplum
3、应用环境变量
切换gpadmin用户
[root@gdym01-zongshuai greenplum]# su - gpadmin
[gpadmin@gdym01-zongshuai ~]$ source /data/greenplum/greenplum-db/greenplum_path.sh
4、 设置gpadmin用户的环境变量
[gpadmin@gdym01-zongshuai ~]$ cat ~/.bash_profile export MASTER_DATA_DIRECTORY=/data/greenplum/gpdata/master/gpseg-1 export PGPORT=5432 export PGUSER=gpadmin export PGDATABASE=gpdb [gpadmin@gdym01-zongshuai ~]$ source ~/.bash_profile
5、配置免密
[gpadmin@gdym01-zongshuai ~]$ ssh-keygen -t rsa
[gpadmin@gdym01-zongshuai ~]$ ssh-copy-id gdym01-zongshuai.novalocal
7、添加节点服务器文件
[gpadmin@gdym01-zongshuai ~]$ vim seg_hosts
gdym01-zongshuai.novalocal
8、使用gpssh-exkeys打通所有服务器(Master)
[gpadmin@gdym01-zongshuai ~]$ gpssh-exkeys -f /home/gpadmin/seg_hosts
9、创建数据目录
[gpadmin@gdym01-zongshuai greenplum]$ mkdir -p /data/greenplum/gpdata/master [gpadmin@gdym01-zongshuai greenplum]$ mkdir -p /data/greenplum/gpdata/primary [gpadmin@gdym01-zongshuai greenplum]$ mkdir -p /data/greenplum/gpdata/mirror
四、初始化数据库
1、复制配置文件
[gpadmin@gdym01-zongshuai ~]$ cp /data/greenplum/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/initGreenplum
2、修改配置文件 /home/gpadmin/initGreenplum
declare -a DATA_DIRECTORY=(/data/greenplum/gpdata/primary) MASTER_HOSTNAME=172.16.43.161 MASTER_DIRECTORY=/data/greenplum/gpdata/master
MASTER_PORT=5432
MIRROR_PORT_BASE=7000
DATABASE_NAME=gpdb
declare -a MIRROR_DATA_DIRECTORY=(/data/greenplum/gpdata/mirror)
MACHINE_LIST_FILE=/home/gpadmin/seg_hosts
3、运行初始化命令
[gpadmin@gdym01-zongshuai ~]$ gpinitsystem -c /home/gpadmin/initGreenplum
4、连接greenplum
先给gpadmin创建密码
alter role gpadmin with password 'gpadmin';
五、允许远程登陆
1、修改pg_hba.conf文件
[gpadmin@gdym01-zongshuai gpseg-1]$ pwd /data/greenplum/gpdata/master/gpseg-1 [gpadmin@gdym01-zongshuai gpseg-1]$ vim pg_hba.conf host all gpadmin 172.16.0.0/16 trust
2、重新加载配置
[gpadmin@gdym01-zongshuai gpseg-1]$ pg_ctl reload -D /data/greenplum/gpdata/master/gpseg-1/