原 GreenPlum官方监控工具GPCC的安装和卸载
Tags: 原创GreenPlum安装部署gpcc数据库监控官方监控工具
简介
Greenplum 数据库提供基于 Web 的可视化工具—Greenplum Command Center(简称GPCC)。GPCC 可以监控 Greenplum 数据库系统的性能、集群健康状态、查询执行及系统资源使用情况。GPCC 监控系统性能指标,分析集群健康状况,并使数据库管理员能够在 Greenplum Database 环境中执行管理任务。它提供了一个本地浏览器的 HTML5 图形控制台,用于查看 Greenplum Database 系统指标和执行某些数据库管理任务。
文档
https://docs.vmware.com/en/VMware-Tanzu-Greenplum-Command-Center/index.html
下载地址
https://network.pivotal.io/products/gpdb-command-center
安装gpcc
只在master库上安装即可,客户端agent会自动安装到其它segment和standby master上。
root用户在所有节点做准备工作(必须)
GreenPlum在运行过程中,修改软件的权限为gpadmin.gpadmin并不会引起GPDB的宕机,可以放心修改。
修改所有节点的gpdb的目录权限为gpadmin,否则后续安装gpcc会报错(例如:IOError、gpadmin-[CRITICAL]:-gppkg failed. (Reason='')、Permission denied等):
1 2 3 4 | chown -R gpadmin.gpadmin /usr/local/greenplum-db-6.25.3 chown -R gpadmin.gpadmin /usr/local/greenplum-db chown -R gpadmin.gpadmin /usr/local/greenplum-db* |
在所有节点创建gpcc安装目录:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | rm -rf /usr/local/greenplum-cc mkdir -p /usr/local/greenplum-cc-6.11.0 ln -sf /usr/local/greenplum-cc-6.11.0 /usr/local/greenplum-cc chown -R gpadmin:gpadmin /usr/local/greenplum-cc-6.11.0 chown -R gpadmin:gpadmin /usr/local/greenplum-cc -- 或者 source /usr/local/greenplum-db/greenplum_path.sh gpssh -f ~/conf/all_hosts 'sudo chown -R gpadmin.gpadmin /usr/local/greenplum-db*' gpssh -f ~/conf/all_hosts 'sudo rm -rf /usr/local/greenplum-cc' gpssh -f ~/conf/all_hosts 'sudo mkdir -p /usr/local/greenplum-cc-6.10.0' gpssh -f ~/conf/all_hosts 'sudo ln -s /usr/local/greenplum-cc-6.10.0 /usr/local/greenplum-cc' gpssh -f ~/conf/all_hosts 'sudo chown -R gpadmin:gpadmin /usr/local/greenplum-cc-6.10.0' gpssh -f ~/conf/all_hosts 'sudo chown -R gpadmin:gpadmin /usr/local/greenplum-cc' |
配置结果:
1 2 3 4 5 | [root@mdw1 local]# ll lrwxrwxrwx 1 gpadmin gpadmin 29 Jan 12 11:13 greenplum-cc -> /usr/local/greenplum-cc-6.11.0 drwxr-xr-x 12 gpadmin gpadmin 4096 Jan 12 13:40 greenplum-cc-6.11.0 lrwxrwxrwx 1 gpadmin gpadmin 30 Dec 26 18:48 greenplum-db -> /usr/local/greenplum-db-6.25.3 drwxr-xr-x 12 gpadmin gpadmin 4096 Dec 6 12:27 greenplum-db-6.25.3 |
开始安装
交互式安装
1 2 3 4 5 | su - gpadmin source /usr/local/greenplum-db/greenplum_path.sh unzip greenplum-cc-web-6.11.0-gp6-rhel7-x86_64.zip cd greenplum-cc-web-6.11.0-gp6-rhel7-x86_64/ ./gpccinstall-6.11.0 -W |
安装过程:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | [gpadmin@mdw1 greenplum-cc-web-6.11.0-gp6-rhel7-x86_64]$ ./gpccinstall-6.11.0 -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.11.0 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'. * * * ******************************************************************************** |
静默安装
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | su - gpadmin source /usr/local/greenplum-db/greenplum_path.sh unzip greenplum-cc-web-6.11.0-gp6-rhel7-x86_64.zip cd greenplum-cc-web-6.11.0-gp6-rhel7-x86_64/ cat > /tmp/gpcc_install.conf <<"EOF" path = /usr/local master_port = 5432 web_port = 28080 rpc_port = 8899 enable_ssl = false enable_kerberos = false language = 2 EOF 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.11.0 -c /tmp/gpcc_install.conf |
升级extension metrics_collector(必须)
1 2 3 4 5 6 7 | -- 环境变量加入master和standby master节点 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 |
可能文件update-extension.txt不存在,没关系,需要做如下的操作:
1 2 3 4 5 6 7 8 | 1. cd /usr/local/greenplum-cc-6.11.0/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.11.0_gp_6.25.3-<OS>-<ARCH>.gppkg 7. Restart GPDB 8. Restart GPCC: gpcc start |
注意:首次安装只需要执行如下的步骤:
1234 cd /usr/local/greenplum-cc-6.11.0/gppkggppkg -i MetricsCollector-6.11.0_gp_6.25.3-rhel7-x86_64.gppkggpstop -M fast -argpcc start ; gpcc status这里的gp版本不一定要和数据库版本一模一样,只需要找一个相近的版本即可。
执行过程:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | [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.11.0_gp_6.25.3-rhel7-x86_64.gppkg 20230116:14:59:19:011861 gppkg:mdw1:gpadmin-[INFO]:-Starting gppkg with args: -i MetricsCollector-6.11.0_gp_6.25.3-rhel7-x86_64.gppkg 20230116:14:59:19:011861 gppkg:mdw1:gpadmin-[INFO]:-Installing package MetricsCollector-6.11.0_gp_6.25.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.25.3/.tmp/MetricsCollector-6.11.0-6.25.3.x86_64.rpm --dbpath /usr/local/greenplum-db-6.25.3/share/packages/database --prefix /usr/local/greenplum-db-6.25.3' 20230116:14:59:21:011861 gppkg:mdw1:gpadmin-[INFO]:-Installing MetricsCollector-6.11.0_gp_6.25.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.25.3/.tmp/MetricsCollector-6.11.0-6.25.3.x86_64.rpm --dbpath /usr/local/greenplum-db-6.25.3/share/packages/database --prefix /usr/local/greenplum-db-6.25.3' 20230116:14:59:21:011861 gppkg:mdw1:gpadmin-[INFO]:-Installing rpms cmdStr='rpm -i --force /usr/local/greenplum-db-6.25.3/.tmp/MetricsCollector-6.11.0-6.25.3.x86_64.rpm --dbpath /usr/local/greenplum-db-6.25.3/share/packages/database --prefix=/usr/local/greenplum-db-6.25.3' 20230116:14:59:22:011861 gppkg:mdw1:gpadmin-[INFO]:-Completed local installation of MetricsCollector-6.11.0_gp_6.25.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.11.0_gp_6.25.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.11.0_gp_6.25.3 |
若是GPCC安装成功,则会在如下位置有库文件,否则不能随便重启GreenPlum,会导致启动失败:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ll $GPHOME/lib/postgresql/metrics_collector.so ll $GPHOME/share/postgresql/extension/metrics_collector* ll $GPHOME/share/postgresql/extension/gp_wlm* -- 若没有,则需要安装: gppkg -i MetricsCollector-6.10.0_gp_6.13.0-rhel7-x86_64.gppkg [root@mdw1 /]# find /usr/local -name metrics_collector* /usr/local/greenplum-db-6.25.3/share/postgresql/extension/metrics_collector--1.0.sql /usr/local/greenplum-db-6.25.3/share/postgresql/extension/metrics_collector.control /usr/local/greenplum-db-6.25.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.25.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.25.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.25.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.25.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.25.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.11.0_gp_6.25.3 |
安装日志
日志:/usr/local/greenplum-cc-6.11.0/logs
登陆
gpmon/lhr
1 2 | -- 一般不需要修改 vi $MASTER_DATA_DIRECTORY/pg_hba.conf |
修改用户名和密码:
1 2 3 4 5 6 | -- master和standby master都需要配置 echo '*:5432:gpperfmon:gpmon:lhr' > ~/.pgpass chmod 600 /home/gpadmin/.pgpass psql -d gpperfmon alter user gpmon with password 'lhr'; |
报错解决
1 2 | [newgp@mdw greenplum-cc-web-6.11.0-gp6-rhel7-x86_64]$ ./gpccinstall-6.11.0 -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 |
分析,查看是否有如下的文件:
1 | ll /usr/lib64/libgssapi_krb5.so |
若没有,则需要安装如下的rpm包: