安装单机版greenplum

gp安装准备

  • 修改主机名称为bigdata
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安装

  • 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安装包 winscp上传到root目录下
rpm -Uvh greenplum-db-5.5.0-rhel7-x86_64.rpm
  • 默认安装到/usr/local,授权给gpadmin
chown -R gpadmin /usr/local/greenplum*
chgrp -R gpadmin /usr/local/greenplum*
  • 设置环境变量
source /usr/local/greenplum-db/greenplum_path.sh
  • 创建instance需要的目录
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*

  • 切换用户gpadmin
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

添加上文同样内容

  • 设置子节点的host
vim all_hosts_file
添加一行bigdata(单机版只有一个host)
  • 权限互通
gpssh-exkeys -f all_hosts_file
  • 编辑gp初始化文件
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这一台
  • 初始化GP
gpinitsystem -c initgp_config -h seg_hosts_file
  • 连接GP
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

你可能感兴趣的:(DB-pgSQL,greenplum)