GreenPlum官方监控工具之GPCC 6.8.3安装配置

简介

GPCC 监控系统性能指标,分析集群健康状况,并使数据库管理员能够在 Greenplum Database 环境中执行管理任务。它提供了一个本地浏览器的 HTML5 图形控制台,用于查看 Greenplum Database 系统指标和执行某些数据库管理任务。

文档

https://docs.vmware.com/en/VMware-Tanzu-Greenplum-Command-Center/index.html

https://docs.vmware.com/en/VMware-Tanzu-Greenplum-Command-Center/6.8/tanzu-greenplum-command-center/GUID-welcome.html

下载地址

https://network.pivotal.io/products/gpdb-command-center

安装

在master库上安装即可,客户端会自动安装到其它segment。

root用户做准备工作(必须)

GreenPlum在运行过程中,修改软件的权限为gpadmin.gpadmin并不会引起GPDB的宕机,可以放心修改。

修改所有节点的gpdb的目录权限为gpadmin,否则后续安装gpcc会报错(例如:IOError、gpadmin-[CRITICAL]:-gppkg failed. (Reason='')、Permission denied等)

代码语言:javascript
复制
chown -R gpadmin.gpadmin /usr/local/greenplum-db-6.19.3
chown -R gpadmin.gpadmin /usr/local/greenplum-db

创建gpcc安装目录:

代码语言:javascript
复制
sudo mkdir -p /usr/local/greenplum-cc-6.8.3; chown -R gpadmin:gpadmin /usr/local/greenplum-cc-6.8.3
sudo ln -s /usr/local/greenplum-cc-6.8.3 /usr/local/greenplum-cc

-- 或者
source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f /home/gpadmin/conf/all_hosts 'sudo mkdir -p /usr/local/greenplum-cc-6.8.3; chown -R gpadmin:gpadmin /usr/local/greenplum-cc-6.8.3'
gpssh -f /home/gpadmin/conf/all_hosts 'sudo ln -s /usr/local/greenplum-cc-6.8.3 /usr/local/greenplum-cc'

配置结果:

代码语言:javascript
复制
[root@mdw1 local]# ll
lrwxrwxrwx 1 gpadmin gpadmin 29 Jan 12 11:13 greenplum-cc -> /usr/local/greenplum-cc-6.8.3
drwxr-xr-x 12 gpadmin gpadmin 4096 Jan 12 13:40 greenplum-cc-6.8.3
lrwxrwxrwx 1 gpadmin gpadmin 30 Dec 26 18:48 greenplum-db -> /usr/local/greenplum-db-6.19.3
drwxr-xr-x 12 gpadmin gpadmin 4096 Dec 6 12:27 greenplum-db-6.19.3

开始安装

交互式安装
代码语言:javascript
复制
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
unzip greenplum-cc-web-6.8.3-gp6-rhel7-x86_64.zip
cd greenplum-cc-web-6.8.3-gp6-rhel7-x86_64/
./gpccinstall-6.8.3 -W

安装过程:

代码语言:javascript
复制
[gpadmin@mdw1 greenplum-cc-web-6.8.3-gp6-rhel7-x86_64]$ ./gpccinstall-6.8.3 -W
Password for GPDB user gpmon:
Where would you like to install Greenplum Command Center? (Default=/usr/local)

Greenplum Command Center will be installed in /usr/local/greenplum-cc-6.8.3

What would you like to name this installation of Greenplum Command Center? (Default=gpcc)

What port would you like the gpcc webserver to use? (Default=28080)

Would you like to enable SSL/TLS? Yy/Nn (Default=Y)
n


  • WARNING: Your connections to GPCC will be insecure. *

Please choose a display language (Default=English)

  1. English
  2. Chinese
  3. Korean
  4. Russian
  5. Japanese
    2

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

Would you like to continue with gpcc installation? Yy/Nn (Default=N)
y

INSTALLATION IN PROGRESS...


  •                                                                          *
    
  • INSTALLATION IS ALMOST COMPLETED *
  •                                                                          *
    
  • The last step is to update the metrics_collector extension, which needs to *
  • restart the Greenplum Database cluster. Please proceed to $GPCC_HOME and *
  • follow the instructions in this file: *
  •                                                                          *
    
  •                        update-extension.txt                              *
    
  •                                                                          *
    
  • Some new features may not be available before the update is done. *
  •                                                                          *
    
  • To use GPCC with the old metrics_collector extension, source gpcc_path.sh *
  • and run 'gpcc start'. *
  •                                                                          *
    

静默安装
代码语言:javascript
复制
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
unzip greenplum-cc-web-6.8.3-gp6-rhel7-x86_64.zip
cd greenplum-cc-web-6.8.3-gp6-rhel7-x86_64/

cat > /tmp/gpcc_install.conf <<"EOF"
path = /usr/local

Set the display_name param to the string to display in the GPCC UI.

The default is "gpcc"

display_name = gpcc

master_port = 5432
web_port = 28080
rpc_port = 8899
enable_ssl = false

Uncomment and set the ssl_cert_file if you set enable_ssl to true.

ssl_cert_file = /etc/certs/mycert

enable_kerberos = false

Uncomment and set the following parameters if you set enable_kerberos to true.

webserver_url = <webserver_service_url>

krb_mode = 1

keytab = <path_to_keytab>

krb_service_name = postgres

User interface language: 1=English, 2=Chinese, 3=Korean, 4=Russian, 5=Japanese

language = 2
EOF

./gpccinstall-6.8.3 -c /tmp/gpcc_install.conf

升级extension metrics_collector(必须)

代码语言:javascript
复制
echo 'source /usr/local/greenplum-cc/gpcc_path.sh' >> ~/.bashrc

source /usr/local/greenplum-cc/gpcc_path.sh
cd $GPCC_HOME
cat update-extension.txt

需要做如下的操作:

代码语言:javascript
复制
1. cd /usr/local/greenplum-cc-6.8.3/gppkg
2. Stop GPCC: gpcc stop
3. Drop extension: psql gpperfmon -c 'drop extension metrics_collector'
4. Use "gppkg -q --all" to list packages installed.
5. Remove the old version of the metrics_collector: "gppkg -r <name>-<version>"
6. Install the new version: gppkg -i MetricsCollector-6.8.3_gp_6.19.3-<OS>-<ARCH>.gppkg
7. Restart GPDB
8. Restart GPCC: gpcc start

注意:首次安装只需要执行如下的步骤:

代码语言:javascript
复制
cd /usr/local/greenplum-cc-6.8.3/gppkg
gppkg -i MetricsCollector-6.8.3_gp_6.19.3-rhel7-x86_64.gppkg
gpstop -M fast ; gpstart -a
gpcc start ; gpcc status

执行过程:

代码语言:javascript
复制
[gpadmin@mdw1 gppkg]$ gppkg -q --all
20230116:14:58:27:011689 gppkg:mdw1:gpadmin-[INFO]:-Starting gppkg with args: -q --all
[gpadmin@mdw1 gppkg]$ gppkg -q --all
20230116:14:58:36:011710 gppkg:mdw1:gpadmin-[INFO]:-Starting gppkg with args: -q --all
[gpadmin@mdw1 gppkg]$ gppkg -i MetricsCollector-6.8.3_gp_6.19.3-rhel7-x86_64.gppkg
20230116:14:59:19:011861 gppkg:mdw1:gpadmin-[INFO]:-Starting gppkg with args: -i MetricsCollector-6.8.3_gp_6.19.3-rhel7-x86_64.gppkg
20230116:14:59:19:011861 gppkg:mdw1:gpadmin-[INFO]:-Installing package MetricsCollector-6.8.3_gp_6.19.3-rhel7-x86_64.gppkg
20230116:14:59:19:011861 gppkg:mdw1:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test -i /usr/local/greenplum-db-6.19.3/.tmp/MetricsCollector-6.8.3-6.19.3.x86_64.rpm --dbpath /usr/local/greenplum-db-6.19.3/share/packages/database --prefix /usr/local/greenplum-db-6.19.3'
20230116:14:59:21:011861 gppkg:mdw1:gpadmin-[INFO]:-Installing MetricsCollector-6.8.3_gp_6.19.3-rhel7-x86_64.gppkg locally
20230116:14:59:21:011861 gppkg:mdw1:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test -i /usr/local/greenplum-db-6.19.3/.tmp/MetricsCollector-6.8.3-6.19.3.x86_64.rpm --dbpath /usr/local/greenplum-db-6.19.3/share/packages/database --prefix /usr/local/greenplum-db-6.19.3'
20230116:14:59:21:011861 gppkg:mdw1:gpadmin-[INFO]:-Installing rpms cmdStr='rpm -i --force /usr/local/greenplum-db-6.19.3/.tmp/MetricsCollector-6.8.3-6.19.3.x86_64.rpm --dbpath /usr/local/greenplum-db-6.19.3/share/packages/database --prefix=/usr/local/greenplum-db-6.19.3'
20230116:14:59:22:011861 gppkg:mdw1:gpadmin-[INFO]:-Completed local installation of MetricsCollector-6.8.3_gp_6.19.3-rhel7-x86_64.gppkg.
20230116:14:59:22:011861 gppkg:mdw1:gpadmin-[INFO]:--

Metrics Collector installation is complete!

20230116:14:59:22:011861 gppkg:mdw1:gpadmin-[INFO]:-MetricsCollector-6.8.3_gp_6.19.3-rhel7-x86_64.gppkg successfully installed.
[gpadmin@mdw1 gppkg]$
[gpadmin@mdw1 gppkg]$ gppkg -q --all
20230116:14:59:31:011951 gppkg:mdw1:gpadmin-[INFO]:-Starting gppkg with args: -q --all
MetricsCollector-6.8.3_gp_6.19.3

若是GPCC安装成功,则会在如下位置有库文件,否则不能随便重启GreenPlum,会导致启动失败:

代码语言:javascript
复制
[root@mdw1 /]# find /usr/local -name metrics_collector*
/usr/local/greenplum-db-6.19.3/share/postgresql/extension/metrics_collector--1.0.sql
/usr/local/greenplum-db-6.19.3/share/postgresql/extension/metrics_collector.control
/usr/local/greenplum-db-6.19.3/lib/postgresql/metrics_collector.so
[root@mdw1 /]#
[gpadmin@mdw1 ~] ll GPHOME/share/postgresql/extension/gp_wlm*
-rw-r--r-- 1 gpadmin gpadmin 856 Dec 6 12:27 /usr/local/greenplum-db-6.19.3/share/postgresql/extension/gp_wlm--0.1.sql
-rw-r--r-- 1 gpadmin gpadmin 232 Dec 6 12:27 /usr/local/greenplum-db-6.19.3/share/postgresql/extension/gp_wlm.control
[gpadmin@mdw1 ~] ll GPHOME/share/postgresql/extension/metrics_collector*
-rw-r--r-- 1 gpadmin gpadmin 846 Dec 6 12:27 /usr/local/greenplum-db-6.19.3/share/postgresql/extension/metrics_collector--1.0.sql
-rw-r--r-- 1 gpadmin gpadmin 233 Dec 6 12:27 /usr/local/greenplum-db-6.19.3/share/postgresql/extension/metrics_collector.control
[gpadmin@mdw1 ~] ll GPHOME/lib/postgresql/metrics_collector.so
-rwxr-xr-x 1 gpadmin gpadmin 3357064 Dec 6 12:27 /usr/local/greenplum-db-6.19.3/lib/postgresql/metrics_collector.so
[gpadmin@mdw1 ~]$
[gpadmin@mdw1 ~]$ gppkg -q --all
20230116:14:58:39:020317 gppkg:mdw1:gpadmin-[INFO]:-Starting gppkg with args: -q --all
MetricsCollector-6.8.3_gp_6.19.3

安装日志

日志:/usr/local/greenplum-cc-6.8.3/logs

登陆

登陆:http://172.72.6.40

gpmon/lhr

代码语言:javascript
复制
-- 一般不需要修改
vi $MASTER_DATA_DIRECTORY/pg_hba.conf

修改用户名和密码:

代码语言:javascript
复制
echo '*:5432:gpperfmon:gpmon:lhr' >  ~/.pgpass
chmod 600 /home/gpadmin/.pgpass

psql -d gpperfmon
alter user gpmon with password 'lhr';

报错解决

报错:libgssapi_krb5.so: cannot open shared object file: No such file or directory

代码语言:javascript
复制
[newgp@mdw greenplum-cc-web-6.8.3-gp6-rhel7-x86_64]$ ./gpccinstall-6.8.3 -W
Failed to connect to database postgres on 152.130.210.107:5432 as newgp: libgssapi_krb5.so: cannot open shared object file: No such file or directory

分析,查看是否有如下的文件:

代码语言:javascript
复制
ll /usr/lib64/libgssapi_krb5.so

若没有,则需要安装如下的rpm包:

代码语言:javascript
复制
yum install krb5-libs krb5-devel

Metrics_collector还没有添加到共享预加载库(shared_preload_libraries)中。请添加它以启用指标收集。

在安装完成后,查询监视器报如下的错误:

Metrics_collector还没有添加到共享预加载库(shared_preload_libraries)中。请添加它以启用指标收集。
必须打开GUC gp_enable_query_metrics来启用指标收集。

修复命令如下所示,在master节点执行:

代码语言:javascript
复制
gpconfig -c shared_preload_libraries -v metrics_collector
gpconfig -c gp_enable_query_metrics -v on
gpconfig -c track_activities -v on

gpconfig -s shared_preload_libraries
gpconfig -s gp_enable_query_metrics
gpconfig -s track_activities

gpstop -M fast ; gpstart -a
gpcc stop ; gpcc start ; gpcc status

在重启GreenPlum后,结果如下才可以

代码语言:javascript
复制
[gpadmin@mdw1 gpmetrics]$ gpconfig -s shared_preload_libraries
gpconfig -s gp_enable_query_metrics
Values on all segments are consistent
GUC : shared_preload_libraries
Master value: metrics_collector
Segment value: metrics_collector
[gpadmin@mdw1 gpmetrics]$ gpconfig -s gp_enable_query_metrics
Values on all segments are consistent
GUC : gp_enable_query_metrics
Master value: on
Segment value: on
[gpadmin@mdw1 gpmetrics]$ gpconfig -s track_activities
Values on all segments are consistent
GUC : track_activities
Master value: on
Segment value: on
[gpadmin@mdw1 gpmetrics]$

注意:该步一定要注意,如果配置不正确,会导致GreenPlum这个不能启动,修复起来比较麻烦。

卸载GPCC

参考:https://docs.vmware.com/en/VMware-Tanzu-Greenplum-Command-Center/6.8/tanzu-greenplum-command-center/GUID-topics-setup-uninstall.html

代码语言:javascript
复制
gpcc --stop
rm /usr/local/greenplum-cc ## removes the symbolic link
rm -rf /usr/local/greenplum-cc-version

gpconfig -c gp_enable_gpperfmon -v off

rm -rf $MASTER_DATA_DIRECTORY/gpperfmon/data/*
rm -rf $MASTER_DATA_DIRECTORY/gpperfmon/logs/*

psql template1 -c 'DROP ROLE gpmon;'
dropdb gpperfmon

若是重新安装相同版本,则不用卸载之前已经安装过的软件。

修改界面为中文

没有直接修改的地方,只能重新安装,重新安装的时候选择中文即可,重新安装之前不需要卸载之前的版本:

代码语言:javascript
复制
su - gpadmin
source /usr/local/greenplum-db/greenplum_path.sh
unzip greenplum-cc-web-6.8.3-gp6-rhel7-x86_64.zip
cd greenplum-cc-web-6.8.3-gp6-rhel7-x86_64/
./gpccinstall-6.8.3 -W

总结

1、权限一定要对,否则安装会报错

2、安装分为交互式安装和静默安装

3、一定要检验gpcc是否真的安装成功了。

4、GreenPlum在运行过程中,修改软件的权限为gpadmin.gpadmin并不会引起GPDB的宕机,可以放心修改。

参考

https://blog.csdn.net/weixin_39168541/article/details/122688329