一、环境准备
安装包:greenplum-db-6.9.0-rhel7-x86_64.rpm
下载路径:https://github.com/greenplum-db/gpdb/releases
172.16.43.157 master 172.16.43.173 segment 172.16.43.155 segment
二、基础配置(三台都要做)
1、关闭防火墙,关闭selinux(略)
2、配置主机名
[root@database-zongshuai greenplum]# cat /etc/hosts 172.16.43.157 database-zongshuai.novalocal 172.16.43.173 gdym03-zongshuai.novalocal 172.16.43.155 gdym02-zongshuai.novalocal
3、修改内核参数
[root@database-zongshuai greenplum]# 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@database-zongshuai greenplum]# cat /etc/security/limits.conf * soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072
三、安装greenplum数据库
1、rpm安装(master做)
[root@database-zongshuai greenplum]# rpm -ivh --prefix=/data/greenplum greenplum-db-6.9.0-rhel7-x86_64.rpm
2、创建gpadmin用户并授权(三台都要做)
[root@database-zongshuai greenplum]# groupadd -g 530 gpadmin [root@database-zongshuai greenplum]# useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin [root@database-zongshuai greenplum]# chown -R gpadmin:gpadmin /data/greenplum
3、应用环境变量
切换gpadmin用户
[root@database-zongshuai greenplum]# su - gpadmin
[gpadmin@database-zongshuai ~]$ source /data/greenplum/greenplum-db/greenplum_path.sh
4、 设置gpadmin用户的环境变量
[gpadmin@database-zongshuai ~]$ 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 [gpadmin@database-zongshuai ~]$ source ~/.bash_profile
5、配置免密
[gpadmin@gdym01-zongshuai ~]$ ssh-keygen -t rsa [gpadmin@gdym01-zongshuai ~]$ ssh-copy-id gdym02-zongshuai.novalocal [gpadmin@gdym01-zongshuai ~]$ ssh-copy-id gdym03-zongshuai.novalocal [gpadmin@gdym01-zongshuai ~]$ ssh-copy-id database-zongshuai.novalocal
7、添加节点服务器文件
[gpadmin@database-zongshuai ~]$ mkdir conf [gpadmin@database-zongshuai ~]$ cd conf [gpadmin@database-zongshuai ~]$ vim seg_hosts gdym03-zongshuai.novalocal gdym02-zongshuai.novalocal database-zongshuai.novalocal
8、使用gpssh-exkeys打通所有服务器(Master)
[gpadmin@database-zongshuai conf]$ gpssh-exkeys -f /home/gpadmin/conf/seg_hosts
-
在打通所有机器通道之后,我们就可以使用 gpssh 命令对所有机器进行批量操作了。
[gpadmin@database-zongshuai conf]$ gpssh -f /home/gpadmin/conf/seg_hosts
优势: 只需要操作一次,就完成到全部集群的操作
(1)打包
[gpadmin@database-zongshuai ~]$ cd /data/greenplum/ [gpadmin@database-zongshuai ~]$ tar -czf gp6.tar.gz greenplum-db-6.9.0
(2)分发(切回gpadmin)
[gpadmin@database-zongshuai greenplum]$ source /opt/greenplum/greenplum-db/greenplum_path.sh
[gpadmin@database-zongshuai greenplum]$ gpscp -f /home/gpadmin/conf/seg_hosts gp6.tar.gz =:/data/greenplum
(3)解压()
[gpadmin@database-zongshuai greenplum]$ cd /data/greenplum [gpadmin@database-zongshuai greenplum]$ tar -xf gp6.tar.gz [gpadmin@database-zongshuai greenplum]$ ln -s greenplum-db-6.9.0 greenplum-db
(4)创建数据目录
[gpadmin@database-zongshuai greenplum]$ mkdir -p /data/greenplum/gpdata/master [gpadmin@database-zongshuai greenplum]$ gpssh -f /home/gpadmin/conf/seg_hosts => mkdir -p /data/greenplum/gpdata/primary => mkdir -p /data/greenplum/gpdata/mirror
四、初始化数据库
1、复制配置文件
[gpadmin@database-zongshuai greenplum]$ cp /data/greenplum/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/conf/initGreenplum
2、修改配置文件 /home/gpadmin/conf/initGreenplum
[gpadmin@database-zongshuai conf]$ grep ^[a-zA-Z] 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
3、运行初始化命令
[gpadmin@database-zongshuai conf]$ gpinitsystem -c /home/gpadmin/conf/initGreenplum