centos7.3下 greenplum-db 安装、配置文档
一.系统要求
- 1.系统版本要求:
根据官方文档: greenplumd-b支持以下几种linux系统:
SUSE Linux Enterprise Server 64-bit 12 SP2 or SP3,with kernel 4.4.73-5.1 or newer SUSE Linux Enterprise Server 64-bit 11 SP4 CentOS 64-bit 6.x or 7.x Red Hat Enterprise Linux (RHEL) 64-bit 6.x or 7.x
二. centos7.3下安装greenplum-db
-
gp服务器列表
144.131.252.198 mdw master 主节点 144.131.252.199 sdw1-1 数据节点1 144.131.252.144 sdw2-1 数据节点2 144.131.252.195 sdw3-1 主节点切换备用节点
-
1.修改系统配置项
1.1 关闭SELINUX
vi /etc/selinux/configSELINUX=disabled
1.2 关闭防火墙
systemctl status firewalld systemctl stop firewalld.service systemctl disable firewalld.service iptable -L -n
1.3
修改内核配置参数,并执行 sysctl -p使之生效
vi /etc/sysctl.confkernel.shmmax = 500000000 kernel.shmmni = 4096 kernel.shmall = 4000000000 kernel.sem = 2000 4096000 2000 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
1.4
vi /etc/security/limits.conf* soft nofile 65536 * hard nofile 65536 * soft nproc 131072 * hard nproc 131072
1.5
配置集群中各节点hosts信息
vi /etc/hosts
144.131.252.198 mdw # master node 144.131.252.199 sdw1-1 # segment node 1 144.131.252.144 sdw2-1 # segment node 2 144.131.252.195 sdw3-1 # segment node 3
2 安装greenplum-db
2.1 从https://network.pivotal.io/pr...
greenplum-db-5.4.0-rhel7-x86_64.rpm
greenplum-cc-web-3.3.1-LINUX-x86_64.zip
拷贝至mdw(144.131.252.198)主节点/opt目录下
执行
tar -xzvf greenplum-cc-web-3.3.1-LINUX-x86_64.zip rpm -ivh greenplum-db-5.4.0-rhel7-x86_64.rpm unzip greenplum-db-5.4.0-rhel7-x86_64.zip ./greenplum-db-5.4.0-rhel7-x86_64.bin
2.2 按照提示输入安装目录
/opt/greenplum-db
执行
./greenplum-cc-web-3.3.1-LINUX-x86_64.bin
按照提示输入安装目录
/opt/greenplum-cc-web
解压完成后创建gpadmin用户和组,用来管理greenplum-db
groupadd gpadmin # 创建分组 useradd gpadmin -g gpadmin # 创建用户并分配组 passwd gpadmin # 为gpadmin分配密码 cd /opt/greenplum-db chown -R gpadmin:gpadmin greenplum-db/ chown -R gpadmin:gpadmin greenplum-cc-web/
2.3 切换到gpadmin用户下:
su - gpadmin mkdir -p /opt/greenplum-db/gpconfigs cd /opt/greenplum-db/gpconfigs
创建配置文件
vim hostfile_exkeys
mdw sdw1-1 sdw2-1 sdw3-1
vi hostfile
sdw1-1 sdw2-1 sdw3-1
vi ~/.bashrc
#添加以下内容 export LD_LIBRARY_PATH=$GPHOME/lib export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/master/gpseg-1 . /opt/greenplum-db/greenplum_path.sh . /opt/greenplum-cc-web/gpcc_path.sh
source ~/.bashrc
切换到root用户下,导出环境变量
su - root vi ~/.bashrc
#添加以下内容 export LD_LIBRARY_PATH=$GPHOME/lib export MASTER_DATA_DIRECTORY=/home/gpadmin/gpdata/master/gpseg-1 . /opt/greenplum-db/greenplum_path.sh . /opt/greenplum-cc-web/gpcc_path.sh
执行
source ~/.bashrc gpssh-exkeys -f hostfile_exkeys #拷贝mster节点公钥至各segment节点 gpseginstall -f /opt/greenplum-db/gpconfigs/hostfile_exkeys -p gpadmin
注:
gpssh-exkeys -f hostfile_exkeys
将会在master节点生成公私钥,并拷贝至hostfile_exkeys各segment节点,实现后续无密钥登陆
gpseginstall -f /opt/greenplum-db/gpconfigs/hostfile_exkeys -p gpadmin
使用默认用户名(gpadmin) 、密码:gpadmin 在各segment节点安装Greenplum—Db
2.5 在master及各segment节点创建数据存储目录
mkdir /home/gpadmin/gpdata/master cd /home/gpadmin/ chown -R gpadmin:gpadmin gpdata/master gpssh -f /opt/greenplum-db/gpconfigs/hostfile -e "mkdir -p /home/gpadmin/gpdata/data1/primary;mkdir -p /home/gpadmin/gpdata/data2/primary” gpssh -f /opt/greenplum-db/gpconfigs/hostfile -e "mkdir -p /home/gpadmin/gpdata/data1/mirror;mkdir -p /home/gpadmin/gpdata/data2/mirror" gpssh -f /opt/greenplum-db/gpconfigs/hostfile -e "chown -R gpadmin:gpadmin /home/gpadmin/gpdata" gpssh -f /opt/greenplum-db/gpconfigs/hostfile_exkeys -v -e 'ntpd'
su - gpadmin cd /opt/greenplum-db/ cp /opt/greenplum-db/docs/cli_help/gpconfigs/gpinitsystem_config /opt/greenplum-db/gpconfigs/gpinitsystem_config vi /opt/greenplum-db/gpconfigs/gpinitsystem_config
###修改以下内容 MASTER_HOSTNAME=mdw PORT_BASE=40000 declare -a DATA_DIRECTORY=(/home/gpadmin/gpdata/data1/primary /home/gpadmin/gpdata/data1/primary /home/gpadmin/gpdata/data2/primary /home/gpadmin/gpdata/data2/primary) MASTER_DIRECTORY=/home/gpadmin/gpdata/master MASTER_PORT=5432 MIRROR_PORT_BASE=50000 REPLICATION_PORT_BASE=41000 MIRROR_REPLICATION_PORT_BASE=51000 declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/gpdata/data1/mirror /home/gpadmin/gpdata/data1/mirror /home/gpadmin/gpdata/data2/mirror /home/gpadmin/gpdata/data2/mirror) DATABASE_NAME=gpdb MACHINE_LIST_FILE=/opt/greenplum-db/gpconfigs/hostfile
gpinitsystem -c gpconfigs/gpinitsystem_config -h gpconfigs/hostfile
vi /home/gpadmin/gpdata/master/gpseg-/pg_hba.conf
#添加以下内容(允许172.16网段通过密码登陆) host all gpadmin 172.16.1.1/16 md5
psql -d gpdb gpdb=# alter user gpadmin with password 'gpadmin' gpdb=# \q 重启greenplumdb集群
gpstop -a gpstart -a
2.7 启动greenplum-db commond center(gpcc)
gpperfmon_install --enable --port 5432 --password gpadmin
重启greenplumdb集群,加载gpperfmon_install采集数据
gpstop -a gpstart -a
启动web控制台界面
gpcmdr --setup
按照提示输入实例名、监听端口信息等
#Please enter the instance name gpcc #Press ENTER to use instance name gpcc #Is the master host for the Greenplum Database remote? Yy/Nn (default=N) N #What port does the Greenplum Database use? (default=5432) 5432 #Enable kerberos login for this instance? Yy/Nn (default=N) N #What port would you like the new web server to use for this instance? (default=28080) 28080
启动、停止
gpcmdr --start #启动 gpcmdr --stop #停止