gp安装准备
hostnamectl set-hostname bigdata
uname -a
groupadd -g 3030 gpadmin
mkdir /home/gpdata
useradd -u 3030 gpadmin -g gpadmin -d /home/gpdata
配置内核参数
vim /etc/sysctl.conf
以下面内容覆盖原有内容:
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.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 = 10000 65535
net.core.netdev_max_backlog = 10000
net.core.rmem_max = 2097152
net.core.wmem_max = 2097152
vm.overcommit_memory = 2
使生效
sysctl -p
vim /etc/security/limits.conf
以下面内容覆盖:
soft nofile 65536
hard nofile 65536
soft nproc 131072
hard nproc 131072
设置磁盘预读
CentOS7.2需要加入服务logind
echo "RemoveIPC=no" >> /etc/systemd/logind.conf
service systemd-logind restart
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
vim /etc/selinux/config
改:#SELINUX=enforcing
SELINUX=disabled
重启reboot
gp安装
设置host
vim /etc/hosts
添加:172.16.250.106 bigdata
更改为实际的ip地址,不要127.0.0.1,查看ip:ip addr|grep inet
vim /etc/sysconfig/network
添加:hostname=bigdata
rpm -Uvh greenplum-db-5.5.0-rhel7-x86_64.rpm
chown -R gpadmin /usr/local/greenplum*
chgrp -R gpadmin /usr/local/greenplum*
source /usr/local/greenplum-db/greenplum_path.sh
mkdir -p /home/gpdata
mkdir -p /home/gpdata/master
mkdir -p /home/gpdata/gp1
mkdir -p /home/gpdata/gp2
mkdir -p /home/gpdata/gp3
mkdir -p /home/gpdata/gp4
chown -R gpadmin:gpadmin /home/gpdata
chown -R gpadmin:gpadmin /home/gpdata/master
chown -R gpadmin:gpadmin /home/gpdata/gp*
su gpadmin
进入$开头的bash环境
vim .bash_profile
添加以下:
source /usr/local/greenplum-db-5.5.0/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/home/gpdata/master/gpseg-1
export PGPORT=2345
export PGUSER=gpadmin
export PGDATABASE=gpdb
vim .bashrc
添加上文同样内容
vim all_hosts_file
添加一行bigdata(单机版只有一个host)
gpssh-exkeys -f all_hosts_file
vim initgp_config
写入:
SEG_PREFIX=gpseg
PORT_BASE=33000
declare -a DATA_DIRECTORY=(/home/gpdata/gp1 /home/gpdata/gp2 /home/gpdata/gp3 /home/gpdata/gp4)
MASTER_HOSTNAME=bigdata
MASTER_PORT=2345
MASTER_DIRECTORY=/home/gpdata/master
DATABASE_NAME=gpdb
vim seg_hosts_file
写入:
bigdata
本例单机,只有bigdata这一台
gpinitsystem -c initgp_config -h seg_hosts_file
psql登录修改密码
su gpadmin
psql -p 2345
修改数据库密码
alter role gpadmin with password '新密码';
\q
vim /home/gpdata/master/gpseg-1/postgresql.conf
修改:
#listen_addresses = '*',去#注释
vim /home/gpdata/master/gpseg-1/pg_hba.conf
添加:
host all gpadmin 0.0.0.0/0 md5
gpstop -u