greenplum 集群安装配置(生产环境)

集群系统初始化信息:

http://blog.51cto.com/michaelkang/2167195

本文对敏感信息进行了替换!!!!

下载软件包:

cd /workspace/gpdb/

wget dl.#kjh#.com/greenplum-db-5.10.2-rhel7-x86_64.rpm

RPM方式,

默认安装到 /usr/local/greenplum-db/ (以root在master执行)
rpm -Uvh greenplum-db-5.10.2-rhel7-x86_64.rpm

建立节点信任关系

打通master到各节点的免密码登录 (以root在master执行)

source /usr/local/greenplum-db/greenplum_path.sh

gpssh-exkeys -f /workspace/gpdb/gp-all.txt

安装各个节点,并建立gpadmin用户(以root在master执行)

gpseginstall -f /workspace/gpdb/gp-all.txt -u gpadmin -p gpadmin

安装后检查

source /usr/local/greenplum-db/greenplum_path.sh

gpcheck -f /workspace/gpdb/gp-all.txt -m gpnode615.kjh.com  gpnode616.kjh.com -s gpnode611.kjh.com gpnode612.kjh.com  gpnode613.kjh.com gpnode614.kjh.com

创建服务安装文件夹 (root用户master节点执行)

#gpssh工具可以同时在多个机器上执行相同命令,和ansible功能类似

/usr/local/gpdata :master 数据数据目录
/data/gpdata :sg 数据数据目录
/data01/gpdata :sg 数据数据目录

gpssh -f /workspace/gpdb/gp-all.txt
=>

groupadd -g 1888 gpadmin
useradd -g 1888 -u 1888 -m -d /home/gpadmin -s /bin/bash gpadmin
chown -R gpadmin.gpadmin /home/gpadmin
echo "gpadmin" | passwd --stdin gpadmin

mkdir -p /usr/local/gpdata/gpmaster
mkdir -p /data/gpdata/primary
mkdir -p /data01/gpdata/primary

mkdir /data/gpdata/mirror
mkdir /data01/gpdata/mirror

chown -R gpadmin:gpadmin /usr/local/gpdata
chown -R gpadmin:gpadmin /data/gpdata
chown -R gpadmin:gpadmin /data01/gpdata

验证

=> df -h|grep data
[gpnode611.kjh.com] /dev/sdb        894G   33M  894G    1% /data01
[gpnode611.kjh.com] /dev/sda        894G   33M  894G    1% /data
[gpnode612.kjh.com] /dev/sda        932G   33M  932G    1% /data01
[gpnode612.kjh.com] /dev/sdb        894G   33M  894G    1% /data
[gpnode614.kjh.com] /dev/sda        932G   33M  932G    1% /data01
[gpnode614.kjh.com] /dev/sdb        932G   33M  932G    1% /data
[gpnode613.kjh.com] /dev/sdb        932G   33M  932G    1% /data
[gpnode613.kjh.com] /dev/sda        932G   33M  932G    1% /data01

设置gpadmin账户的环境(gpadmin账户操作,master节点配置)

修改.bashrc
su - gpadmin
cat >>/home/gpadmin/.bashrc<<-EOF
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/usr/local/gpdata/gpmaster/gpseg-1
export PGPORT=5432
EOF
修改.bash_profile
su - gpadmin
cat >>/home/gpadmin/.bash_profile<<-EOF
source /usr/local/greenplum-db/greenplum_path.sh
export MASTER_DATA_DIRECTORY=/usr/local/gpdata/gpmaster/gpseg-1
export PGPORT=5432
EOF

使之生效

source ~/.bashrc
source ~/.bash_profile

segment 节点 (/etc/hosts文件中的hostname或alias一致)

cat >/usr/local/greenplum-db/all_segment<<-EOF
gpnode611.kjh.com
gpnode612.kjh.com
gpnode613.kjh.com
gpnode614.kjh.com
EOF

验证

more  /usr/local/greenplum-db/all_segment
gpnode611.kjh.com
gpnode612.kjh.com
gpnode613.kjh.com
gpnode614.kjh.com

初始化数据集群,(gpadmin账户操作,master节点配置)

增加gpinitsystem_config文件为模板

cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /usr/local/greenplum-db/gpinit_config

配置gpinit_config

vi /usr/local/greenplum-db/gpinit_config

ARRAY_NAME="PT Greenplum Data Platform"
SEG_PREFIX=gpseg
PORT_BASE=40000
declare -a DATA_DIRECTORY=(/data/gpdata/primary /data/gpdata/primary /data01/gpdata/primary /data01/gpdata/primary )
MASTER_HOSTNAME=gpnode615.kjh.com
MASTER_DIRECTORY=/usr/local/gpdata/gpmaster
MASTER_PORT=5432
MIRROR_PORT_BASE=50000
REPLICATION_PORT_BASE=41000
MIRROR_REPLICATION_PORT_BASE=51000
TRUSTED_SHELL=ssh
CHECK_POINT_SEGMENTS=8
ENCODING=UNICODE
DATABASE_NAME=testgpdb
MACHINE_LIST_FILE=/usr/local/greenplum-db/all_segment
declare -a MIRROR_DATA_DIRECTORY=(/data/gpdata/mirror /data/gpdata/mirror /data01/gpdata/mirror /data01/gpdata/mirror)

执行初始化,(master节点 gpadmin 用户执行)

gpinitsystem -c gpinit_config -h hostfile_segments

gpinitsystem命令参数解释:
-c:指定初始化文件。
-h:指定segment主机文件。
-s:指定standby主机,创建standby节点。

su - gpadmin

gpinitsystem -c /usr/local/greenplum-db/gpinit_config -h /usr/local/greenplum-db/all_segment -s gpnode616.kjh.com

初始化过程:

输出集群初始化配置:
=>[INFO]:-Greenplum Database Creation Parameters
=>[INFO]:---------------------------------------
=>[INFO]:-Master Configuration
=>[INFO]:---------------------------------------
=>[INFO]:-Master instance name       = PT Greenplum Data Platform
=>[INFO]:-Master hostname            = gpnode615.kjh.com
=>[INFO]:-Master port                = 5432
=>[INFO]:-Master instance dir        = /usr/local/gpdata/gpmaster/gpseg-1
=>[INFO]:-Master LOCALE              = en_US.utf8
................
=>[INFO]:-Master IP address [4]      = 172.20.6.15
=>[INFO]:-Master IP address [5]      = 172.20.6.221
................
=>[INFO]:-Standby Master             = gpnode616.kjh.com
=>[INFO]:-Primary segment #          = 4
=>[INFO]:-Standby IP address         = ::1
=>[INFO]:-Standby IP address         = 172.20.6.16
=>[INFO]:-Standby IP address         = 172.20.6.220
....................
=>[INFO]:----------------------------------------
=>[INFO]:-Greenplum Primary Segment Configuration
=>[INFO]:----------------------------------------
=>[INFO]:-gpnode611.kjh.com    /data/gpdata/primary/gpseg0   40000   2       0       41000
=>[INFO]:-gpnode611.kjh.com    /data/gpdata/primary/gpseg1   40001   3       1       41001
=>[INFO]:-gpnode611.kjh.com    /data01/gpdata/primary/gpseg2         40002   4       2       41002
.........................
=>[INFO]:-gpnode614.kjh.com    /data01/gpdata/primary/gpseg14        40002   16      14      41002
=>[INFO]:-gpnode614.kjh.com    /data01/gpdata/primary/gpseg15        40003   17      15      41003
=>[INFO]:---------------------------------------
=>[INFO]:-Greenplum Mirror Segment Configuration
=>[INFO]:---------------------------------------
=>[INFO]:-gpnode612.kjh.com    /data/gpdata/mirror/gpseg0    50000   18      0       51000
=>[INFO]:-gpnode612.kjh.com    /data/gpdata/mirror/gpseg1    50001   19      1       51001
.........................
=>[INFO]:-gpnode611.kjh.com    /data01/gpdata/mirror/gpseg14         50002   32      14      51002
=>[INFO]:-gpnode611.kjh.com    /data01/gpdata/mirror/gpseg15         50003   33      15      51003

查看配置正确,确认是否执行?

Continue with Greenplum creation Yy|Nn (default=N):

Y

输出初始化完成概要信息:

=>
=>[INFO]:------------------------------------------------
=>[INFO]:-Parallel process exit status
=>[INFO]:------------------------------------------------
=>[INFO]:-Total processes marked as completed           = 16
=>[INFO]:-Total processes marked as killed              = 0
=>[INFO]:-Total processes marked as failed              = 0
=>[INFO]:------------------------------------------------
=>[INFO]:-Commencing parallel build of mirror segment instances
............................
=>
=>[INFO]:------------------------------------------------
=>[INFO]:-Parallel process exit status
=>[INFO]:------------------------------------------------
=>[INFO]:-Total processes marked as completed           = 16
=>[INFO]:-Total processes marked as killed              = 0
=>[INFO]:-Total processes marked as failed              = 0
=>[INFO]:------------------------------------------------

.....................略
=>
=>]:-Process results...
=>]:-   Successful segment starts                                            = 32
=>]:-   Failed segment starts                                                = 0
=>]:-   Skipped segment starts (segments are marked down in configuration)   = 0
=>]:-----------------------------------------------------
=>]:-Successfully started 32 of 32 segment instances
=>]:-----------------------------------------------------
.
=>]:------------------------------------------------------
=>]:-Greenplum standby master initialization parameters
=>]:------------------------------------------------------
=>]:-Greenplum master hostname               = gpnode615.kjh.com
=>]:-Greenplum master data directory         = /usr/local/gpdata/gpmaster/gpseg-1
=>]:-Greenplum master port                   = 5432
=>]:-Greenplum standby master hostname       = gpnode616.kjh.com
=>]:-Greenplum standby master port           = 5432
=>]:-Greenplum standby master data directory = /usr/local/gpdata/gpmaster/gpseg-1
=>]:-Greenplum update system catalog         = On

集群初始化成功输出信息如下:

=>:-Greenplum Database instance successfully created
=>]:-------------------------------------------------------
=>]:-To complete the environment configuration, please
=>]:-update gpadmin .bashrc file with the following
=>]:-1. Ensure that the greenplum_path.sh file is sourced
=>]:-2. Add "export MASTER_DATA_DIRECTORY=/usr/local/gpdata/gpmaster/gpseg-1"
=>]:-   to access the Greenplum scripts for this instance:
=>]:-   or, use -d /usr/local/gpdata/gpmaster/gpseg-1 option for the Greenplum scripts
=>]:-   Example gpstate -d /usr/local/gpdata/gpmaster/gpseg-1
=>]:-Script log file = /home/gpadmin/gpAdminLogs/gpinitsystem_20180903.log
=>]:-To remove instance, run gpdeletesystem utility
=>]:-Standby Master gpnode616.kjh.com has been configured
=>]:-To activate the Standby Master Segment in the event of Master
=>]:-failure review options for gpactivatestandby
=>]:-------------------------------------------------------
=>]:-The Master /usr/local/gpdata/gpmaster/gpseg-1/pg_hba.conf post gpinitsystem
=>]:-has been configured to allow all hosts within this new
=>]:-array to intercommunicate. Any hosts external to this
=>]:-new array must be explicitly added to this file
=>]:-Refer to the Greenplum Admin support guide which is
=>]:-located in the /usr/local/greenplum-db/./docs directory
=>]:-------------------------------------------------------

系统登录初始化设置:

psql修改数据库密码:
psql -d testgpdb
    gpdb=# alter user gpadmin with password ‘gpadmin‘;
    gpdb=# \q

#### 远程登陆

psql -p 5432 -d testgpdb 

# 查询当前版本
select * from version();
设置监听IP和Port
vi ${MASTER_DATA_DIRECTORY}/postgresql.conf

# 设置监听IP (* 生产环境慎用)
listen_addresses = ‘${ host ip address } ‘
port = 5432

#### 设置数据库白名单
vi ${MASTER_DATA_DIRECTORY}/pg_hba.conf

# 增加如下一条记录,允许用户密码模式和可以登陆的IP地址范围;
#TYPE  DATABASE  USER   CIDR-ADDRESS     METHOD
host    all     gpadmin     0.0.0.0/0        md5

# 测试登陆

psql -p 5432 -h 172.20.6.15 -U gpadmin -d testgpdb 

至此集群配置完成.

可以使用这篇文章的命令查看集群状态:
http://blog.51cto.com/michaelkang/2169857

参考信息:

https://gpdb.docs.pivotal.io/43170/install_guide/init_gpdb.html
https://gp-docs-cn.github.io/docs/utility_guide/admin_utilities/gprecoverseg.html

原文地址:http://blog.51cto.com/michaelkang/2170627

时间: 2024-10-06 22:06:08

greenplum 集群安装配置(生产环境)的相关文章

Greenplum集群安装(测试环境)

环境:centos6.5 软件:/srv/greenplum-db-4.3.8.1-build-1-RHEL5-x86_64.zip 目录规划:安装目录/opt/greenplum                 ---所有 数据目录/data/greenplum/gpmaster        ---master节点 /data/greenplum/pri_data           --- segment 节点主节点数据目录 /data/greenplum/mri_data       

高可用RabbitMQ集群安装配置

RabbitMQ集群安装配置+HAproxy+Keepalived高可用 rabbitmq 集群 消息队列 RabbitMQ简介 RabbitMQ是流行的开源消息队列系统,用erlang语言开发.RabbitMQ是AMQP(高级消息队列协议)的标准实现. AMQP,即Advanced Message Queuing Protocol,高级消息队列协议,是应用层协议的一个开放标准,为面向消息的中间件设计.消息中间件主要用于组件之间的解耦,消息的发送者无需知道消息使用者的存在,反之亦然.AMQP的主

elk集群安装配置详解

#  一:简介 ``` Elasticsearch作为日志的存储和索引平台: Kibana 用来从 Elasticsearch获取数据,进行数据可视化,定制数据报表: Logstash 依靠强大繁多的插件作为日志加工平台: Filebeat 用来放到各个主机中收集指定位置的日志,将收集到日志发送到 Logstash: Log4j 直接与 Logstash 连接,将日志直接 Logstash(当然此处也可以用 Filebeat 收集 tomcat 的日志). ``` ####  port ```

spark集群安装配置

spark集群安装配置 一. Spark简介 Spark是一个通用的并行计算框架,由UCBerkeley的AMP实验室开发.Spark基于map reduce 算法模式实现的分布式计算,拥有Hadoop MapReduce所具有的优点:但不同于Hadoop MapReduce的是Job中间输出和结果可以保存在内存中,从而不再需要读写HDFS,节省了磁盘IO耗时,性能比Hadoop更快. 所以,相对来说Hadoop更适合做批处理,而Spark更适合做需要反复迭代的机器学习.下面是我在ubuntu1

Hadoop集群安装配置文档

Hadoop集群安装配置文档 日期 内容 修订人 2015.6.3 文档初始化 易新             目录 1 文档概要... 5 1.1软件版本... 5 1.2机器配置... 5 2 虚拟机配置... 5 2.1新建虚拟机... 5 2.2虚拟网络配置... 8 3 CentOS安装及配置... 9 3.1系统安装... 9 3.2系统配置... 10 3.2.1防火墙配置... 10 3.2.2 SElinux配置... 10 3.2.3 IP配置... 11 3.2.4安装vim

Hadoop2.2集群安装配置-Spark集群安装部署

配置安装Hadoop2.2.0 部署spark 1.0的流程 一.环境描写叙述 本实验在一台Windows7-64下安装Vmware.在Vmware里安装两虚拟机分别例如以下 主机名spark1(192.168.232.147),RHEL6.2-64 操作系统,usernameRoot 从机名spark2(192.168.232.152).RHEL6.2-64 操作系统,usernameRoot 二.环境准备 1.防火墙禁用.SSH服务设置为开机启动.并关闭SELINUX 2.改动hosts文件

集群安装配置Hadoop详细图解

集群安装配置Hadoop 集群节点:node4.node5.node6.node7.node8.具体架构: node4 Namenode,secondnamenode,jobtracker node5 Datanode,tasktracker node6 Datanode,tasktracker node7 Datanode,tasktracker node8 Datanode,tasktracker 操作系统为:CentOS release 5.5 (Final) 安装步骤 一.创建Hadoo

Etcd集群安装配置

本次测试集群为2各节点 一. Etcd集群安装配置 安装包:etcd-3.3.11-2.el7.centos.x86_64.rpm 配置文件: #[Member] #ETCD_CORS="" ETCD_DATA_DIR="/var/lib/etcd/default.etcd" #ETCD_WAL_DIR="" ETCD_LISTEN_PEER_URLS="http://192.168.218.146:2380" ETCD_LI

greenplum集群安装与增加节点生产环境实战

1.准备环境 1.1集群介绍 系统环境:centos6.5 数据库版本:greenplum-db-4.3.3.1-build-1-RHEL5-x86_64.zip greenplum集群中,2台机器IP分别是 [[email protected] ~]# cat /etc/hosts 127.0.0.1   localhost localhost.localdomain ::1         localhost localhost.localdomain localhost6 localhos