下载基础镜像centos
docker pull centos:6.8
创建容器
docker run -tid --name gp -p 5432:5432 -p 28080:28080 -v I:\gp\gp:/gp centos:6.8 /bin/bash (gp文件夹里包括GP安装包和GPCC安装包)
进入容器
docker exec -ti gp /bin/bash
安装ssh服务
yum install openssh-server -y
yum install openssh-clients -y
安装unzip
yum install unzip -y
安装依赖
yum install ed -y
修改时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
解压并安装greenplum和gpcc
运行两个bin文件安装
创建gpadmin用户
useradd gpadmin
passwd gpadmin
mkdir gpmaster
mkdir gpsegments
修改gp所有者
chown -R gpadmin /gpmaster
chown -R gpadmin /gpsegments
chown -R gpadmin /usr/local/greenplum-db
chgrp -R gpadmin /usr/local/greenplum-db
chown -R gpadmin /usr/local/greenplum-db-4.3.9.1
chgrp -R gpadmin /usr/local/greenplum-db-4.3.9.1
chown -R gpadmin:gpadmin /usr/local/greenplum-cc-web
chown -R gpadmin:gpadmin /usr/local/greenplum-cc-web-2.0.0-build-32
修改环境变量
vi /etc/profile
GPHOME=/usr/local/greenplum-db-4.3.9.1
PATH=$GPHOME/bin:$GPHOME/ext/Python/bin:$PATH
export GPHOME
export PATH
vi ~/.bashrc添加:
source /etc/profile
service sshd start
su – gpadmin
source ~/.bashrc
进入gpadmin用户添加
vi ~/.bashrc
添加 :
source /usr/local/greenplum-db/greenplum_path.sh
source /usr/local/greenplum-cc-web/gpcc_path.sh
MASTER_DATA_DIRECTORY=/gpmaster/gpseg-1
export MASTER_DATA_DIRECTORY
export PGPORT=5432
export PGDATABASE=postgres
source ~/.bashrc
创建修改启动配置文件
mkdir gpconfigs
vi all_segs(填从节点的ip或者主机名,单节点就填localhost就可以)
vi all_hosts(填所有节点的ip或者主机名,单节点可以不需要)
cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/gpinitsystem_config
vi /home/gpadmin/gpconfigs/gpinitsystem_config
修改这个文件
ENCODING=UTF8
declare -a DATA_DIRECTORY=(/gpsegments /gpsegments)(需要几个从节点就几个文件夹)
MASTER_DIRECTORY=/gpmaster(主节点存储位置)
MASTER_HOSTNAME=localhost(放在同一个容器里就设为localhost,集群几个容器的话,就填master节点名)
建立ssh免密登录
gpssh-exkeys -f ./all_segs
初始化GP
gpinitsystem -c gpconfigs/gpinitsystem_config -h ./all_segs -a
初始化完成后
psql -p 1949 -d postgres
可以进入GP
远程访问的话需要
echo "host all all 172.17.0.1/24 md5">>/gpmaster/gpseg-1/pg_hba.conf(172.17.0.1是容器的网关地址)
在gp中
postgres=# ALTER role gpadmin with password 'gpadmin';
然后重启gp
gpstop -u
安装gpcc监控
echo "host gpperfmon gpmon ::1/128 md5">>/gpmaster/gpseg-1/pg_hba.conf
echo "gp_enable_gpperfmon=on">>/gpmaster/gpseg-1/postgresql.conf
echo "gpperfmon_port=8888">>/gpmaster/gpseg-1/postgresql.conf
echo "gp_external_enable_exec=on">>/gpmaster/gpseg-1/postgresql.conf
echo "gpperfmon_log_alert_level=warning">>/gpmaster/gpseg-1/postgresql.conf
安装gp监控数据库
gpperfmon_install --enable --password gpmon --port 5432
在gp中
postgres=# ALTER role gpadmin with password 'gpadmin';
然后重启gp
gpstop -ar
安装监控实例
gpcmdr --setup
gpcmdr --start gpcc(gpcc是上一步命的名)
GPCCC启动了输入网址10.0.75.1:28080 默认用户名密码为gpmon