RedHat6.x伪分布安装Greenplum
- 重要:对于所有的Greenplum数据库系统,SELinux和防火墙必须关闭
关闭防火墙和SELinux(root用户)
查看防火墙运行状态
# chkconfig –list iptables
输出如下内容
# iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
不是如上所示,输入命令关闭防火墙
# chkconfig iptables off
查看SELinux运行状态
# sestatus
输出如下内容
# SELinuxstatus: disabled
如果不是如上所示修改/etc/selinux/config文件停用SELinux
SELINUX=disabled
更改Linux系统设置
- 修改/etc/sysctl.conf文件,添加以下内容
xfs_mount_options = rw,noatime,inode64,allocsize=16m
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 修改/etc/security/limits.conf文件,添加以下参数
*soft nofile 65536
*hard nofile 65536
*soft nproc 131072
*hard nproc 131072注意:对于redhat6.x和Centos6.x,在文件/etc/security/limits.d/90-nproc.conf中有参数重载的问题,如果出现参数重载问题,确保在90-nproc.conf文件中提供的值和上述内容一致
安装Greenplum
- 官网下载对应版本的Greenplum
root用户登录解压安装
#unzip greenplum-db-4.2.x.x-PLATFORM.zip
#/bin/bash greenplum-db-4.2.x.x-PLATFORM.bin安装过程根据提示输入yes或者回车
初始化Greenplum Database集群
root用户登录更新source
#source /usr/local/greenplum-db/greenplum_path.sh
创建包含master和segment的hostfile_exkeys文件
#vim hostfile_exkeys
mdw
sdw1
sdw2检查/etc/hosts文件并配置以下内容
127.0.0.1 mdw
127.0.0.1 sdw1
127.0.0.1 sdw2
127.0.0.1 localhost运行gpseginstall,在所有主机上创建gpadmin用户
# gpseginstall -f hostfile_exkeys -u gpadmin -p P@$$word
因为是伪分布,在segment上重复创建用户gpadmin会提示错误,忽略即可,结束之后修改gpadmin密码
-以gpadmin用户登录,建立主机之间信任关系
$source /usr/local/greenplum-db/greenplum_path.sh
$ gpssh-exkeys -f hostfile_exkeys
创建数据存储
创建包含segment主机名文件seg_hosts
sdw1
sdw2创建segment和master目录(root)
#mkdir /file1/master
#chown gpadmin /file1/master
#mkdir /file2/primary
#mkfir /file3/primary
#chown -R gpadmin /file2
#chown –R gpadmin /file3
- 添加gpadmin用户环境变量
source /usr/local/greenplum-db/greenplum_path.sh
MASTER_DATA_DIRECTORY=/file1/master/gpseg-1
export MASTER_DATA_DIRECTORY
export PGPORT=5432
-创建Greenplum配置文件gpinitsystem_conf
#vim gpinitsystem_conf
ARRAY_NAME=”EMC Greenplum DW”
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/file2/primary /file2/primary /file3/primary /file3/primary)
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/file1/master
MASTER_PORT=5432
MACHINE_LIST_FILE=/home/gpadmin/seg_hosts
TRUSTED_SHELL=sshCHECK_POINT_SEGMENT=8
ENCODING=UNICODE
- 运行数据库初始化配置文件
$ gpinitsystem -c gpinitsystem_config
- 初始化后,Greenplum会自动启动,可以查看状态
sestatus -s