GreenPlum 6.7 集群部署


1. 环境说明

节点 系统版本 安装服务 GreenPlum 版本
node1 CentOS 7.7 Master 6.7.1
node2 CentOS 7.7 Segment 6.7.1
node3 CentOS 7.7 Segment 6.7.1

2. 下载安装文件

https://network.pivotal.io/products/pivotal-gpdb#/releases/636309/file_groups/2542


# 下载完成之后将安装文件上传到 hnode1:/opt 路径下
scp -r greenplum-db-6.7.1-rhel7-x86_64.rpm root@hnode1:/opt/

[root@hnode1 opt]# ll -rth
-rw-r--r- 1 root root 176M 6月 4 10:58 greenplum-db-6.7.1-rhel7-x86_64.rpm

3. 配置环境

3.1 修改hostname

[root@hnode1 opt]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.7.76 hnode1
192.168.7.77 hnode2
192.168.7.78 hnode3

3.2 配置免密登录

设置免密登录,从hnode1 免密登录到hnode2、hnode3

# home下创建.ssh目录
[root@hnode1 ~] mkdir .ssh
[root@hnode1 ~] cd .ssh/
[root@hnode1 .ssh] pwd
/root/.ssh
# 生成秘钥
[root@hnode1 .ssh] ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): (回车)
Enter passphrase (empty for no passphrase):(回车)
Enter same passphrase again:(回车)
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:F1XLKMmnivY288gcK5IsY90xm0kawlM62D+uyGIeB0k root@hnode1
The keys randomart image is:
+---[RSA 2048]----+
|            ...  |
|         . o o . |
| E        = o o  |
|. . .      =     |
| * o    S o      |
|. O . +. o       |
| . O *o*o        |
|oo* O.*+++       |
|=+.=.o o*+.      |
+----[SHA256]-----+
# 查看生成的文件
[root@hnode1 .ssh] ll
总用量 8
-rw-------. 1 root root 1675 3月  30 18:58 id_rsa
-rw-r--r--. 1 root root  393 3月  30 18:58 id_rsa.pub

[root@hnode1 .ssh]

#将公钥拷贝到hnode2、hnode3
[root@hnode1 .ssh] ssh-copy-id hnode2
root@hnode2s password: #(输入hnode2的密码)

# 尝试登陆hnode2
[root@hnode1 .ssh] ssh hnode2

# 登出
[root@hnode2 ~] exit

Connection to hnode2 closed.

#将秘钥拷贝到hnode3
[root@hnode1 .ssh] ssh-copy-id hnode3
root@hnode3s password: #(输入hnode3的密码)

[root@hnode1 .ssh] ssh hnode3

# 登出
[root@hnode3 ~] exit
Connection to hnode3 closed.

3.3 配置时间同步

所有节点都需要配置

#安装时间同步服务(ntp)
[root@hnode1 opt] yum install ntp
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: ftp.sjtu.edu.cn
 * extras: ap.stykers.moe
 * updates: mirror.bit.edu.cn

# 强制从远程更新
[root@hnode3 ~]# sudo ntpdate 0.centos.pool.ntp.org
28 Apr 15:54:51 ntpdate[75627]: step time server 193.4.58.77 offset 2443633.848252 sec

# 启动服务
[root@hnode1 opt] systemctl start ntpd.service

# 检查服务状态
[root@hnode3 ~] systemctl status ntpd.service

# 设置开机启动
[root@hnode3 ~] systemctl enable ntpd.service

# 检查开机启动是否设置成功
[root@hnode3 ~]# systemctl is-enabled ntpd
enabled

3.4 关闭防火墙与selinux

所有节点都需要配置

  • 关闭防火墙
# 查看防火墙状态
[root@hnode1 ~] firewall-cmd --state
running
[root@hnode1 ~]
# 关闭防火墙
[root@hnode1 ~] systemctl stop firewalld.service
[root@hnode1 ~]
# 查看防火墙状态
[root@hnode1 ~] firewall-cmd --state
not running
[root@hnode1 ~]
# 关闭防火墙开机启动
[root@hnode1 ~] systemctl disable firewalld.service
  • 关闭selinux
vim /etc/selinux/config

# 将 SELINUX=enforcing 修改为:
SELINUX=disabled

# 重启服务器后查看 SELINUX 状态
[root@hnode1 ~]# sestatus
SELinux status:   disabled

3.5 修改内核参数

所有节点都需要配置

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.ip_forward = 0
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
#kernel.core_pattern = /var/core/core.%h.%t

执行命令使之生效

[root@hnode1 opt]# sysctl -p
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.ip_forward = 0
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

3.6 配置资源限制参数

所有节点都需要配置

vim /etc/security/limits.conf
# 可打开的文件描述符的最大数,超过会警告(软限制)
* soft nofile 65536
# 可打开的文件描述符的最大数,超过会报错(硬限制)
* hard nofile 65536
# 单个用户可用的最大进程数量,超过会警告(软限制)
* soft nproc 131072
# 单个用户可用的最大进程数量,超过会报错(硬限制)
* hard nproc 131072

3.7 创建用户和用户组

为所有节点创建 gpadmin 用户及用户组,将其作为安装 greenplum 的操作系统用户。

# 增加用户组
groupadd -g 530 gpadmin
# 增加用户
useradd -g 530 -u 530 -m -d /home/gpadmin -s /bin/bash gpadmin

# 对文件夹进行赋权
chown -R gpadmin:gpadmin /home/gpadmin/

# 为新用户创建密码
[root@hnode2 ~]# passwd gpadmin
更改用户 gpadmin 的密码
新的 密码: (gpadmin)
#密码提示太简单,连续输入两次即可。
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新

4 安装 Greenplum

4.1 安装 Greenplum

# 安装
[root@hnode1 /]# cd /opt/
[root@hnode1 opt]#
[root@hnode1 greenplum]# yum install greenplum-db-6.7.1-rhel7-x86_64.rpm
...
  验证中      : greenplum-db-6.7.1-1.el7.x86_64                                                                                                                                                                                           1/2
  验证中      : greenplum-db-6.7.0-1.el7.x86_64                                                                                                                                                                                           2/2

更新完毕:
  greenplum-db.x86_64 0:6.7.1-1.el7

完毕!

# 查看安装好的文件

[root@hnode1 opt]# cd /usr/local/
[root@hnode1 local]# ll
总用量 0
lrwxrwxrwx   1 root root  29 6月   4 11:06 greenplum-db -> /usr/local/greenplum-db-6.7.1
drwxr-xr-x  12 root root 202 6月   4 11:06 greenplum-db-6.7.1

# 将文件分配给 gpadmin 用户
[root@hnode1 local]#  chown -R gpadmin:gpadmin greenplum-db*

# 将文件分发到 segment 节点

[root@hnode1 local]# scp -r greenplum-db-6.7.1/ root@hnode2:/usr/local
[root@hnode1 local]# scp -r greenplum-db-6.7.1/ root@hnode3:/usr/local

# node2 上面执行
# 创建软连接
[root@hnode2 local]# ln -s greenplum-db-6.7.1/ greenplum-db
# 将文件分配给 gpadmin 用户
[root@hnode2 local]# chown -R gpadmin:gpadmin greenplum-db*

# node3 上面执行
[root@hnode3 local]# ln -s greenplum-db-6.7.1/ greenplum-db
[root@hnode3 local]# chown -R gpadmin:gpadmin greenplum-db*

4.2 配置 gpadmin 用户的免密登录


# 生成秘钥
[root@hnode1 opt]# su gpadmin
[gpadmin@hnode1 opt]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/gpadmin/.ssh/id_rsa): #(回车)
Enter passphrase (empty for no passphrase):#(回车)
Enter same passphrase again:
Your identification has been saved in /home/gpadmin/.ssh/id_rsa.
Your public key has been saved in /home/gpadmin/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:TTr5ZrIMSa+VXwFJJiAoUPmYskWTR8DLiFpraX0+7dg gpadmin@hnode1
The key's randomart image is:
+---[RSA 2048]----+
|ooo*o ... o      |
|. B ..   + .     |
|.= B      +      |
|+ B .    = .     |
|.= +  . S . .    |
|o = ...o +   .   |
| o   oo.= + .    |
|      oB.* .     |
|      ooE .      |
+----[SHA256]-----+
[gpadmin@hnode1 opt]$
[gpadmin@hnode1 opt]$ cd ~
[gpadmin@hnode1 .ssh]$ pwd
/home/gpadmin/.ssh


# 配置 hnode1 免密登录
[gpadmin@hnode1 .ssh]$ ssh-copy-id hnode1
gpadmin@hnode1s password: #(输入gpadmin用户的密码)
...
# 尝试免密登录 hnode1
[gpadmin@hnode1 .ssh]$ ssh hnode1 
# 登录成功
Last login: Fri May 29 13:44:15 2020
# 退出登录
[gpadmin@hnode1 ~]$ exit
登出
Connection to hnode1 closed.

# 配置 hnode2 免密登录
ssh-copy-id hnode2

# 配置 hnode3 免密登录
ssh-copy-id hnode3

4.3 创建节点列表文件

在管理节点配置


[gpadmin@hnode1 .ssh]$ mkdir /home/gpadmin/conf
[gpadmin@hnode1 .ssh]$
[gpadmin@hnode1 .ssh]$
[gpadmin@hnode1 .ssh]$ cd /home/gpadmin/conf
[gpadmin@hnode1 conf]$ vim hostlist #添加 GreenPlum 集群的所有节点
[gpadmin@hnode1 conf]$ cat hostlist
hnode1
hnode2
hnode3

[gpadmin@hnode1 conf]$ vim seg_hosts #添加 GreenPlum 集群的所有segment节点 
[gpadmin@hnode1 conf]$ cat seg_hosts
hnode2
hnode3

4.4 使用 gpssh-exkeys 连接所有服务器

在 master 节点使用 gpssh-exkeys 将所有机器的通道打开,这样在每台机器之间跳转,就不需要输入密码。

[gpadmin@hnode1 conf]$ pwd
/home/gpadmin/conf
[gpadmin@hnode1 conf]$ source /usr/local/greenplum-db/greenplum_path.sh
[gpadmin@hnode1 conf]$ gpssh-exkeys -f hostlist
[STEP 1 of 5] create local ID and authorize on local host
  ... /home/gpadmin/.ssh/id_rsa file exists ... key generation skipped

[STEP 2 of 5] keyscan all hosts and update known_hosts file

[STEP 3 of 5] retrieving credentials from remote hosts
  ... send to hnode2
  ... send to hnode3

[STEP 4 of 5] determine common authentication file content

[STEP 5 of 5] copy authentication files to all remote hosts
  ... finished key exchange with hnode2
  ... finished key exchange with hnode3

[INFO] completed successfully

# 测试批量操作

[gpadmin@hnode1 conf]$ gpssh -f hostlist
=> pwd
[hnode1] /home/gpadmin
[hnode2] /home/gpadmin
[hnode3] /home/gpadmin
=> quit # 退出

4.5 创建数据存储空间

  • 在 Master 节点创建元数据目录
[gpadmin@hnode1 ~]$ mkdir -p /home/gpadmin/data/master
  • 在 segment 节点创建数据存储目录
[gpadmin@hnode1 ~]$ source /usr/local/greenplum-db/greenplum_path.sh
[gpadmin@hnode1 ~]$ gpssh -f /home/gpadmin/conf/seg_hosts
=> mkdir -p /home/gpadmin/data/primary
[hnode3]
[hnode2]
=> mkdir -p /home/gpadmin/data/mirror
[hnode3]
[hnode2]
=> ll /home/gpadmin/data/
[hnode3] 总用量 0
[hnode3] drwxrwxr-x 2 gpadmin gpadmin 6 5月  29 18:30 mirror
[hnode3] drwxrwxr-x 2 gpadmin gpadmin 6 5月  29 18:30 primary
[hnode2] 总用量 0
[hnode2] drwxrwxr-x 2 gpadmin gpadmin 6 5月  29 18:30 mirror
[hnode2] drwxrwxr-x 2 gpadmin gpadmin 6 5月  29 18:30 primary
=> quit

4.7 配置 .bash_profile 环境变量

[gpadmin@hnode1 ~]$ vim /home/gpadmin/.bash_profile

# 添加下面内容
source /usr/local/greenplum-db/greenplum_path.sh # 这个路径对应安装 gp 的目录
export MASTER_DATA_DIRECTORY=/home/gpadmin/data/master/gpseg-1
export PGPORT=5432
export PGUSER=gpadmin
export PGDATABASE=Greenplum

# 将刚刚配置的加到环境变量中
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$MASTER_DATA_DIRECTORY

[gpadmin@hnode1 ~]$ source /home/gpadmin/.bash_profile
[gpadmin@hnode1 ~]$ echo $GPHOME
/usr/local/greenplum-db/.

4.8 初始化配置文件

在管理节点配置
配置文件模板为 $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config


[gpadmin@hnode1 ~]$ mkdir /home/gpadmin/gpconfigs
[gpadmin@hnode1 ~]$ cd gpconfigs/
[gpadmin@hnode1 gpconfigs]$ pwd
/home/gpadmin/gpconfigs

# 创建 节点列表文件 hostfile_gpinitsystem
[gpadmin@hnode1 gpconfigs]$ touch hostfile_gpinitsystem

#将segment节点名称添加到该文件内
[gpadmin@hnode1 gpconfigs]$ cat /home/gpadmin/gpconfigs/hostfile_gpinitsystem
hnode2
hnode3

# 复制配置文件模板
[gpadmin@hnode1 gpconfigs]$ cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config .

# 修改配置
[gpadmin@hnode1 gpconfigs]$ vim gpinitsystem_config

# 配置文件文件内容入下

#数据库代号
ARRAY_NAME="Greenplum"

#segment前缀
SEG_PREFIX=gpseg

#primary segment 起始的端口号
PORT_BASE=6000

#指定primary segment的数据目录,网上写的是多个相同目录,多个目录表示一台机器有多个segment
declare -a DATA_DIRECTORY=(/home/gpadmin/data/primary)

#master所在机器的host name
MASTER_HOSTNAME=hnode1

#master的数据目录
MASTER_DIRECTORY=/home/gpadmin/data/master

#master的端口
MASTER_PORT=5432

#指定bash的版本
TRUSTED_SHELL=/usr/bin/ssh

#将日志写入磁盘的间隔,每个段文件通常 =16MB < 2 * CHECK_POINT_SEGMENTS + 1
CHECK_POINT_SEGMENTS=8

#字符集
ENCODING=UNICODE

#mirror segment 起始的端口号
MIRROR_PORT_BASE=7000

# mirror的数据目录,和主数据一样,一个对一个,多个对多个
declare -a MIRROR_DATA_DIRECTORY=(/home/gpadmin/data/mirror)

MACHINE_LIST_FILE=/home/gpadmin/gpconfigs/hostfile_gpinitsystem

5. 初始化数据库

[gpadmin@hnode1 gpconfigs]$ cd ~
[gpadmin@hnode1 ~]$ pwd
/home/gpadmin
[gpadmin@hnode1 ~]$ source /usr/local/greenplum-db/greenplum_path.sh
[gpadmin@hnode1 ~]$ gpinitsystem -c gpconfigs/gpinitsystem_config -h gpconfigs/hostfile_gpinitsystem
...
Continue with Greenplum creation Yy|Nn (default=N): #(y)
...
20200... gpstart:hnode1:gpadmin-[INFO]:-   Successful segment starts                                            = 2
...
20200... gpinitsystem:hnode1:gpadmin-[INFO]:-Greenplum Database instance successfully created

# GreenPlum 初始化成功

5.1 异常处理

安装未成功可以查看日志 , 日志地址:/home/gpadmin/gpAdminLogs/gpinitsystem_....log

  • 问题一:Failed to complete obtain psql count Master gp_segment_configuration Script Exiting!
# 日志所在文件夹
gpadmin@hnode1 gpAdminLogs]$ pwd
/home/gpadmin/gpAdminLogs
[gpadmin@hnode1 gpAdminLogs]$ less /home/gpadmin/gpAdminLogs/gpinitsystem_20200529.log
...
20200529:21:24:32:069170 gpinitsystem:hnode1:gpadmin-[FATAL]:-Failed to complete obtain psql count Master gp_segment_configuration  Script Exiting!
20200529:21:24:32:069170 gpinitsystem:hnode1:gpadmin-[WARN]:-Script has left Greenplum Database in an incomplete state
20200529:21:24:32:069170 gpinitsystem:hnode1:gpadmin-[WARN]:-Run command bash /home/gpadmin/gpAdminLogs/backout_gpinitsystem_gpadmin_20200529_212419 to remove these changes
20200529:21:24:32:069170 gpinitsystem:hnode1:gpadmin-[INFO]:-Start Function BACKOUT_COMMAND
20200529:21:24:32:069170 gpinitsystem:hnode1:gpadmin-[INFO]:-End Function BACKOUT_COMMAND

# 解决办法 # 使用 root 用户执行
[root@hnode1 gpadmin]# echo "RemoveIPC=no" >> /etc/systemd/logind.conf
[root@hnode1 gpadmin]# /bin/systemctl restart systemd-logind.service
[gpadmin@hnode1 ~]$ rm -rf /home/gpadmin/data/master/gpseg-1
重新初始化
  • 问题二:Found indication of postmaster process on port 5432 on Master host Script Exiting!
Found indication of postmaster process on port 5432 on Master host Script Exiting!

解决:关闭杀死占用端口5432的进程。
先查询进程
$ lsof -i:5432
kill ...
Continue with Greenplum creation Yy|Nn (default=N):
> y
20220224:11:56:49:996735 gpinitsystem:0004:gpadmin-[INFO]:-Building the Master instance database, please wait...
/bin/mv: setting attribute 'security.kysec' for 'security.kysec': 不允许的操作
20220224:11:56:56:996735 gpinitsystem:0004:gpadmin-[INFO]:-Starting the Master in admin mode
20220224:11:56:56:996735 gpinitsystem:0004:gpadmin-[FATAL]:-Failed to complete obtain psql count Master gp_segment_configuration  Script Exiting!
20220224:11:56:56:996735 gpinitsystem:0004:gpadmin-[WARN]:-Script has left Greenplum Database in an incomplete state
20220224:11:56:56:996735 gpinitsystem:0004:gpadmin-[WARN]:-Run command bash /home/gpadmin/gpAdminLogs/backout_gpinitsystem_gpadmin_20220224_115641 to remove these changes
20220224:11:56:56:996735 gpinitsystem:0004:gpadmin-[INFO]:-Start Function BACKOUT_COMMAND
20220224:11:56:56:996735 gpinitsystem:0004:gpadmin-[INFO]:-End Function BACKOUT_COMMAND
[gpadmin@0004 ~]$ 
  • 问题三:未安装 python 模块
Continue with Greenplum creation Yy|Nn (default=N):
> y
20220224:11:31:13:986210 gpinitsystem:0004:gpadmin-[INFO]:-Building the Master instance database, please wait...
/bin/mv: setting attribute 'security.kysec' for 'security.kysec': 不允许的操作
20220224:11:31:20:986210 gpinitsystem:0004:gpadmin-[INFO]:-Starting the Master in admin mode
Traceback (most recent call last):
  File "/usr/local/gpdb/bin/lib/gphostcachelookup.py", line 12, in <module>
    from gppylib.gphostcache import GpInterfaceToHostNameCache
  File "/usr/local/gpdb/lib/python/gppylib/gphostcache.py", line 31, in <module>
    from gppylib.commands import unix
  File "/usr/local/gpdb/lib/python/gppylib/commands/unix.py", line 10, in <module>
    import psutil
ImportError: No module named psutil
20220224:11:31:20:986210 gpinitsystem:0004:gpadmin-[FATAL]:-Unable to contact : /bin/ping: usage error: 需要目标地址
/sbin/ping6: usage error: 需要目标地址 Script Exiting!
20220224:11:31:20:986210 gpinitsystem:0004:gpadmin-[WARN]:-Script has left Greenplum Database in an incomplete state
20220224:11:31:20:986210 gpinitsystem:0004:gpadmin-[WARN]:-Run command bash /home/gpadmin/gpAdminLogs/backout_gpinitsystem_gpadmin_20220224_113101 to remove these changes
20220224:11:31:20:986210 gpinitsystem:0004:gpadmin-[INFO]:-Start Function BACKOUT_COMMAND
20220224:11:31:20:986210 gpinitsystem:0004:gpadmin-[INFO]:-End Function BACKOUT_COMMAND

解决:安装缺失的模块
yum install psutil

6. 连接 GreenPlum 测试


# 连接GreenPlum
[gpadmin@hnode1 ~]$ psql -d postgres
psql (9.4.24)
Type "help" for help.

postgres=# select version();
                        version
----------------------------------------------------------
 PostgreSQL 9.4.24 (Greenplum Database 6.7.1 build ......
(1 row)

# 查看现有database
postgres=# \l
                               List of databases
   Name    |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges
-----------+---------+----------+------------+------------+---------------------
 postgres  | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 |
 template0 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 template1 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
(3 rows)

# 新建database
postgres=# create database test;
CREATE DATABASE

# 查看 database 是否创建成功
postgres=# \l
                               List of databases
   Name    |  Owner  | Encoding |  Collate   |   Ctype    |  Access privileges
-----------+---------+----------+------------+------------+---------------------
 postgres  | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 |
 template0 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 template1 | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 | =c/gpadmin         +
           |         |          |            |            | gpadmin=CTc/gpadmin
 test      | gpadmin | UTF8     | en_US.utf8 | en_US.utf8 |
(4 rows)

# 退出命令行
postgres=# \q
[gpadmin@hnode1 ~]$

命令集参考文档:https://gpdb.docs.pivotal.io/6-7/ref_guide/sql_commands/sql_ref.html

7. 远程登录授权

7.1 为 gpadmin 用户创建密码


[gpadmin@hnode1 ~]$ psql -d postgres
psql (9.4.24)
Type "help" for help.

postgres=#
postgres=#
postgres=# alter role gpadmin with password 'gpadmin';
ALTER ROLE
postgres=#

7.2 修改授权文件

[gpadmin@hnode1 ~]$ vim /home/gpadmin/data/master/gpseg-1/pg_hba.conf
#在末尾追加如下内容

host     all         gpadmin         需连接GP的主机IP/32   trust

# 停止 GreenPlum 所有节点
[gpadmin@hnode1 ~]$ gpstop -M fast -a
# 在生产环境尽量少用这个命令, 在快速模式下,正在运行的事务将被中止,未完成的查询将不再执行,所有后台进程将被终止。尽管这种方法可能会导致正在运行的事务丢失,但它会使停止过程更快。

# 启动 GreenPlum 所有节点
[gpadmin@hnode1 ~]$ gpstart -a

配置说明

连接方式 连接的数据库 连接的用户 要连接GP的主机IP 认证方式
host all gpadmin 需连接GP的主机IP/32 trust

Navicat 成功连接 GreenPlum

8. 常用命令与日志

说明 命令
启动 gpstart
关闭 gpstop
状态 gpstate
日志地址 /home/gpadmin/gpAdminLogs
日志地址 /home/gpadmin/data/mirror/gpseg1/pg_log
日志地址 /home/gpadmin/data/primary/gpseg0/pg_log

9. 安装greenplum-cc-web

Greenplum Command Center,或者简称GPCC,是Greenplum原生的图形化运维管理工具。在最近3年来的开发中,基于全新的界面和用户体验,陆续推出了监控、历史数据、管理的功能,在众多商业用户上得到了广泛的应用和认可。随着Greenplum 6.0的发布,Greenplum Command Center(也称为GPCC)也在新的版本中抵达了一个新的里程碑。
这里安装的是 greenplum-cc-web-6.1.0-gp6-rhel7-x86_64

下载地址:https://network.pivotal.io/products/gpdb-command-center

9.1 上传安装文件

 scp greenplum-cc-web-6.1.0-gp6-rhel7-x86_64.zip root@hnode1:/opt/

 # 解压
 [root@hnode1 opt]# unzip greenplum-cc-web-6.1.0-gp6-rhel7-x86_64.zip
 Archive:  greenplum-cc-web-6.1.0-gp6-rhel7-x86_64.zip
    creating: greenplum-cc-web-6.1.0-gp6-rhel7-x86_64/
   inflating: greenplum-cc-web-6.1.0-gp6-rhel7-x86_64/gpccinstall-6.1.0

 # 将执行文件给 gpadmin 用户

 [root@hnode1 opt]# chown -R gpadmin:gpadmin greenplum-cc-web-6.1.0-gp6-rhel7-x86_64
 [root@hnode1 opt]# ll greenplum-cc-web-6.1.0-gp6-rhel7-x86_64
 -rwxr-xr-x 1 gpadmin gpadmin 62086416 12月 18 11:40 gpccinstall-6.1.0

9.2 安装服务

gpcc自4.8 开始重构了元数据,脱离了gpperfmon,所以4.8 版本之后不用安装gpperfmon。

# 切换用户
[root@hnode1 greenplum-cc-web-6.1.0-gp6-rhel7-x86_64]# su gpadmin

[gpadmin@hnode1 greenplum-cc-web-6.1.0-gp6-rhel7-x86_64]$ ./gpccinstall-6.1.0
...

# 您是否同意Pivotal Greenplum Command Center最终用户许可协议?
Do you agree to the Pivotal Greenplum Command Center End User License Agreement? Yy/Nn (Default=Y)

# 您想在哪里安装Greenplum Command Center?(默认/usr/local)
Where would you like to install Greenplum Command Center? (Default=/usr/local)
/usr/local/greenplum-db

#您想将此安装Greenplum Command Center命名为什么(默认gpcc)
What would you like to name this installation of Greenplum Command Center? (Default=gpcc)

#您希望gpcc网络服务器使用哪个端口(默认28080)
What port would you like gpcc webserver to use? (Default=28080)

#是否启用 SSL(默认 N)
Would you like enable SSL? Yy/Nn (Default=N)

#请选择一种显示语言(默认英语)
Please choose a display language (Default=English)
1.  English
2.  Chinese
3.  Korean
4.  Russian
5.  Japanese
2

INSTALLATION IN PROGRESS...

********************************************************************************
*                                                                              *
* INSTALLATION COMPLETED SUCCESSFULLY                                          *
*                                                                              *
* Source the gpcc_path.sh or add it to your bashrc file to use gpcc command    *
* utility.                                                                     *
*                                                                              *
* To see the GPCC web UI, you must first start the GPCC webserver.             *
*                                                                              *
* To start the GPCC webserver on the current host, run gpcc start.             *
*                                                                              *
********************************************************************************

#编辑配置文件
[gpadmin@hnode1 greenplum-cc-web-6.1.0-gp6-rhel7-x86_64]$ vim ~/.bash_profile

# 增加如下内容
source /usr/local/greenplum-db/greenplum-cc-web-6.1.0/gpcc_path.sh

# 刷新文件 使配置生效

[gpadmin@hnode1 greenplum-cc-web-6.1.0-gp6-rhel7-x86_64]$ source ~/.bash_profile

9.3 启动服务


# 重启 GreenPlum
[gpadmin@hnode1 greenplum-cc-web-6.1.0-gp6-rhel7-x86_64]$ cd ~
[gpadmin@hnode1 ~]$ gpstop -M fast -a
[gpadmin@hnode1 ~]$ gpstart -a
[gpadmin@hnode1 ~]$ gpcc start
2020-06-04 12:04:14 Starting the gpcc agents and webserver...
2020-06-04 12:04:17 Agent successfully started on 3/3 hosts
2020-06-04 12:04:17 View Greenplum Command Center at http://hnode1:28080

登录 http://hnode1:28080/login

登录页

账号:gpmon
密码:changeme

# gpmon 用户密码会在 ~/.pgpass 文件中
[gpadmin@hnode1 ~]$ cat .pgpass
*:5432:gpperfmon:gpmon:changeme

9.4 异常解决

  • Could not detect [metrics_collector] in shared_preload_libraries Please add it to enable GPCC metrics collection

安装 GreenPlum 的版本问题,可能时使用的安装包是从 https://github.com/greenplum-db/gpdb/releases 这里下载的
修改为 https://network.pivotal.io/products/pivotal-gpdb#/releases/636309/file_groups/2542 下载重新安装即可。

10 参考文档

https://gpcc.docs.pivotal.io/610/welcome.html
https://blog.csdn.net/you_xian/article/details/103646948


文章作者: hnbian
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 hnbian !
评论
 上一篇
GreenPlum 架构介绍 GreenPlum 架构介绍
1. OLTP 与 OLAP1.1 OLTP OLTP(on-line transaction processing)联机事务处理 OLTP 是传统的关系型数据库的主要应用,一般都是高可用的在线系统,以小的事务以及小的查询为主,评估其系统的
2020-05-04
下一篇 
Flink系列 3. Flink On Yarn 两种部署模式与提交任务 Flink系列 3. Flink On Yarn 两种部署模式与提交任务
1. 介绍Flink 支持多种部署方式 如 Local、Standalone、Yarn、K8S 等,但是现在企业中大多数的大数据平台都以 Yarn 作为资源管理器,所以 Flink On Yarn 模式也在企业中用的非常多,下面就介绍一下F
2020-05-01
  目录