Ubuntu 16.04 greenplum详细搭建过程
硬件环境准备
操作系统:Ubuntu 16.04
首先在服务器新建三台虚拟机,IP分别为:192.168.137.212,192.168.137.213,192.168.137.214;
确定192.168.137.212作为master节点,192.168.137.213,192.168.137.214作为segment节点;
具体搭建过程
搭建前准备
修改/etc/hosts 文件
将三台机器的hostname分别修改为mdw,sdw1,sdw2,重启计算机生效;
关闭防火墙
/etc/init.d/ufw stop
- 安装
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:greenplum/db
sudo apt-get update
sudo apt-get install -y greenplum-db-oss
修改/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 =
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_max_syn_backlog = 4096
net.ipv4.conf.all.arp_filter = 1
net.ipv4.ip_forward=
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
设置预读块大小
/sbin/blockdev –setra 16384 /dev/sda
重启系统
初始化变量
su root
source /opt/gpdb/greenplum_path.sh
创建主机文件all_hosts
运行gpseginstall工具
gpseginstall -f all_hosts -u wad -p 19841222
- 有可能免密失败
- 解决方法:
su wad
source /opt/gpdb/greenplum_path.sh
gpssh-exkeys -f all_hosts
验证安装及免密登陆
gpssh -f all_hosts -e ls $GPHOME
重要:必须在每台机器都设置免密登陆,否则下面初始化会报错
将source /opt/gpdb/greenplum_path.sh添加到.bashrc文件后(所有的节点都要做)
- 创建存储区域
mkdir -p /data/master
b)改变目录所有权
chown wad /data/master
c)创建包含所有segment主机的文件seg_hosts
su root
source /opt/gpdb/greenplum_path.sh
gpssh-exkeys -f all_hosts
gpssh -f seg_hosts -e 'mkdir -p /data/primary'
gpssh -f seg_hosts -e 'mkdir -p /data/mirror'
gpssh -f seg_hosts -e ‘chown wad /data/primary'
gpssh -f seg_hosts -e ‘chown wad /data/mirror'
- 同步系统时间
a.
gpssh -f all_hosts -e 'apt install -y ntp'
b. 修改/etc/ntp.conf添加
server mdw
c.
gpssh -f /data/all_hosts -e 'ntpd'
初始化GP数据库系统
su wad
cp /opt/gpdb/docs/cli_help/gpconfigs/gpinitsystem_config ~/gpinitsystem_config
chmod 775 gpinitsystem_config
sudo vi gpinitsystem_config
具体配置文件信息如下:
ARRAY_NAME="Greenplum Data Platform"
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/data/primary)
MASTER_HOSTNAME=mdw
MASTER_DIRECTORY=/data/master
MASTER_PORT=5432
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
MACHINE_LIST_FILE=/home/wad/all_segs
运行初始化工具
sudo vim all_segs
gpinitsystem -c gpinitsystem_config -h seg_hosts
- 设置环境变量
export MASTER_DATA_DIRECTORY=/data/master/ifreseg-1
到master 的~/.bashrc
在segment机器上做同样的操作
- 启动停止数据库
gpstart
gpstop
验证
psql
本文来源:https://blog.csdn.net/YangPF1910/article/details/90379867
相关文章