Greenplum管理和监控工具-gpcc-web介绍
1. gpcc-web简介
gpcc(Greenplum Command Center)的Web用户界面是一个强大的工具,它可以帮助用户管理Greenplum数据库集群,提高效率,优化性能,并确保数据的安全性和可靠性。它为数据库管理员提供了一个集中化的平台,从而更容易管理和监控复杂的数据仓库环境。
gpcc-web主要特点和功能
-
集群监控和状态:
gpcc-web
提供了有关整个Greenplum数据库集群状态的实时信息。您可以查看主机、段、表空间等级别的性能数据、状态和报警信息。这有助于及时识别和解决性能问题。 -
查询性能监控:您可以监视正在运行的查询的性能,包括查询执行计划、资源消耗和查询运行时间。这有助于识别潜在的性能瓶颈和优化查询。
-
备份和恢复管理:
gpcc-web
允许您配置和监视数据库备份策略,并提供了还原数据库的功能。这有助于确保数据的备份和可恢复性。 -
自动化任务和计划:您可以使用
gpcc-web
来管理和计划自动化任务,如数据加载、清理、备份等。这有助于提高数据库管理的效率。 -
安全性管理:GPCC提供了用户和角色管理功能,以及访问控制策略的配置。这有助于确保数据库的安全性和合规性。
-
性能优化:通过分析数据库性能数据,
gpcc-web
可以建议性能优化措施,帮助您改进查询性能和资源利用率。 -
报告和可视化:GPCC生成各种报告和图形,用于可视化数据库性能、资源利用和趋势。这些报告有助于更好地理解数据库的健康状况。
-
插件和扩展性:GPCC的
gpcc-web
界面可以通过插件进行扩展,以满足特定需求和集成其他工具。 -
易于使用的界面:
gpcc-web
具有直观的用户界面,使数据库管理员和运维人员能够轻松地执行各种管理和监控任务。
2. gpcc-web安装部署
2-1. 环境检查
# 当前集群信息gpmaster + gpstandby + segment01-04
[gpadmin@hdt-dmcp-gpmaster ~]$ cat /etc/hosts
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
# greenplum
172.20.6.107 hdt-dmcp-gpmaster
172.20.9.175 hdt-dmcp-gpstandby
172.20.5.87 hdt-dmcp-segment01
172.20.14.139 hdt-dmcp-segment02
172.20.11.45 hdt-dmcp-segment03
172.20.13.242 hdt-dmcp-segment04
# 当前GP版本 Greenplum Database 6.19.0
[gpadmin@hdt-dmcp-gpmaster ~]$ psql
psql (9.4.26)
Type "help" for help.
testdb=# select version();
PostgreSQL 9.4.26 (Greenplum Database 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 6.4.0, 64-bit compiled on Dec 8 2021 23:08:44
(1 row)
testdb=# \q
# 当前服务器系统版本CentOS-7
[gpadmin@hdt-dmcp-gpmaster ~]$ cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
2-2. 下载地址
官方地址:
https://network.pivotal.io/products/gpdb-command-center#/releases/1243596
如果版本需要CentOS-7,对应6.8.4版本,可以使用百度网盘分享
链接:https://pan.baidu.com/s/1eQ5JMXnjUyHXj8xtB4Vueg?pwd=dw0t
提取码:dw0t
2-3. 安装部署
注意: 在master库上安装即可,客户端会自动安装到其它segment
- 安装准备
# 下载至本地服务器目录
[gpadmin@hdt-dmcp-gpmaster ~]$ ll | grep greenplum-cc-web
-rw-r--r-- 1 gpadmin gpadmin 102488779 Oct 31 14:52 greenplum-cc-web-6.8.4-gp6-rhel7-x86_64.zip
# unzip解压安装包
[gpadmin@hdt-dmcp-gpmaster ~]$ unzip greenplum-cc-web-6.8.4-gp6-rhel7-x86_64.zip
Archive: greenplum-cc-web-6.8.4-gp6-rhel7-x86_64.zip
creating: greenplum-cc-web-6.8.4-gp6-rhel7-x86_64/
inflating: greenplum-cc-web-6.8.4-gp6-rhel7-x86_64/gpccinstall-6.8.4
# 解压后为一个二进制执行文件
[gpadmin@hdt-dmcp-gpmaster ~]$ cd greenplum-cc-web-6.8.4-gp6-rhel7-x86_64
[gpadmin@hdt-dmcp-gpmaster greenplum-cc-web-6.8.4-gp6-rhel7-x86_64]$ ll
total 169864
-rwxr-xr-x 1 gpadmin gpadmin 173939328 Jan 18 2023 gpccinstall-6.8.4
# 引用原greenplum-db的环境变量文件
[gpadmin@hdt-dmcp-gpmaster ~]$ source /usr/local/greenplum-db/greenplum_path.sh
# 创建gpcc安装目录路径,此目录可自定义
[gpadmin@hdt-dmcp-gpmaster ~]$ mkdir -p /home/gpadmin/software
- 安装gpcc
# 运行安装文件
[gpadmin@hdt-dmcp-gpmaster greenplum-cc-web-6.8.4-gp6-rhel7-x86_64]$ ./gpccinstall-6.8.4
Where would you like to install Greenplum Command Center? (Default=/usr/local)
/home/gpadmin/software # 输入指定的安装路径,直接回车则选择Default默认目录
Greenplum Command Center will be installed in /home/gpadmin/software/greenplum-cc-6.8.4
What would you like to name this installation of Greenplum Command Center? (Default=gpcc)
# 输入指定的gpcc-web页面的项目名称,可以使用自己的项目简称,直接回车则选择Default默认名称gpcc
What port would you like the gpcc webserver to use? (Default=28080)
# 输入指定的gpcc-web页面端口,直接回车则选择Default默认28080
Would you like to enable SSL/TLS? Yy/Nn (Default=Y)
N # 是否开启SSL,选择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 # 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 # 是否进行本次的安装,Y 继续进行安装任务,N 则直接退出安装
INSTALLATION IN PROGRESS...
********************************************************************************
* Please check your .pgpass file for the default password. *
* We recommend changing the default password for the gpmon user unless you *
* plan to connect through LDAP or kerberos. *
********************************************************************************
CREATING SUPERUSER 'gpmon'...
/home/gpadmin/.bashrc: line 12: /home/gpadmin/software/greenplum-cc-6.8.4/gpcc_path.sh: No such file or directory
/home/gpadmin/.bashrc: line 12: /home/gpadmin/software/greenplum-cc-6.8.4/gpcc_path.sh: No such file or directory
CREATING COMMAND CENTER DATABASE 'gpperfmon'...
********************************************************************************
* *
* 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'. *
* *
********************************************************************************
- 引用gpcc的环境变量
[gpadmin@hdt-dmcp-gpmaster greenplum-cc-web-6.8.4-gp6-rhel7-x86_64]$ ll /home/gpadmin/software/greenplum-cc-6.8.4/gpcc_path.sh
-rw-rw-r-- 1 gpadmin gpadmin 107 Oct 31 14:58 /home/gpadmin/software/greenplum-cc-6.8.4/gpcc_path.sh
# 将gpcc环境变量加入到用户本地的.bashrc
[gpadmin@hdt-dmcp-gpmaster greenplum-cc-web-6.8.4-gp6-rhel7-x86_64]$ echo "source /home/gpadmin/software/greenplum-cc-6.8.4/gpcc_path.sh" >> ~/.bashrc
# source引用
[gpadmin@hdt-dmcp-gpmaster greenplum-cc-web-6.8.4-gp6-rhel7-x86_64]$ source ~/.bashrc
- gppkg安装
gppkg 可以用于安装和管理 Greenplum 数据库的扩展组件或插件。这些组件可以增强数据库的功能,如添加额外的数据类型、函数、外部语言支持等。通过 gppkg,您可以轻松地将这些扩展组件安装到 Greenplum 集群中,以满足特定的需求
[gpadmin@hdt-dmcp-gpmaster ~]$ cd ~/software/greenplum-cc/gppkg/
# 注意-i 参数后面的文件是根据用户的gpcc版本、gp数据版本、操作系统版本来选择,目录下需要自行选择
[gpadmin@hdt-dmcp-gpmaster gppkg]$ gppkg -i MetricsCollector-6.8.4_gp_6.19.0-rhel7-x86_64.gppkg
20231031:15:37:58:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Starting gppkg with args: -i MetricsCollector-6.8.4_gp_6.19.0-rhel7-x86_64.gppkg
20231031:15:37:58:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Installing package MetricsCollector-6.8.4_gp_6.19.0-rhel7-x86_64.gppkg
20231031:15:37:58:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test -i /usr/local/greenplum-db-6.19.0/.tmp/MetricsCollector-6.8.4-6.19.0.x86_64.rpm --dbpath /usr/local/greenplum-db-6.19.0/share/packages/database --prefix /usr/local/greenplum-db-6.19.0'
20231031:15:38:01:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Installing MetricsCollector-6.8.4_gp_6.19.0-rhel7-x86_64.gppkg locally
20231031:15:38:01:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Validating rpm installation cmdStr='rpm --test -i /usr/local/greenplum-db-6.19.0/.tmp/MetricsCollector-6.8.4-6.19.0.x86_64.rpm --dbpath /usr/local/greenplum-db-6.19.0/share/packages/database --prefix /usr/local/greenplum-db-6.19.0'
20231031:15:38:01:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Installing rpms cmdStr='rpm -i --force /usr/local/greenplum-db-6.19.0/.tmp/MetricsCollector-6.8.4-6.19.0.x86_64.rpm --dbpath /usr/local/greenplum-db-6.19.0/share/packages/database --prefix=/usr/local/greenplum-db-6.19.0'
20231031:15:38:01:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Completed local installation of MetricsCollector-6.8.4_gp_6.19.0-rhel7-x86_64.gppkg.
20231031:15:38:01:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:--
==========================================================================
Metrics Collector installation is complete!
==========================================================================
20231031:15:38:01:010989 gppkg:hdt-dmcp-gpmaster:gpadmin-[INFO]:-MetricsCollector-6.8.4_gp_6.19.0-rhel7-x86_64.gppkg successfully installed.
- 修改数据库配置
[gpadmin@hdt-dmcp-gpmaster ~]$ gpconfig -c shared_preload_libraries -v metrics_collector
[gpadmin@hdt-dmcp-gpmaster ~]$ gpconfig -c gp_enable_query_metrics -v on
[gpadmin@hdt-dmcp-gpmaster ~]$ gpconfig -c track_activities -v on
[gpadmin@hdt-dmcp-gpmaster ~]$ gpconfig -s shared_preload_libraries
[gpadmin@hdt-dmcp-gpmaster ~]$ gpconfig -s gp_enable_query_metrics
[gpadmin@hdt-dmcp-gpmaster ~]$ gpconfig -s track_activities
[gpadmin@hdt-dmcp-gpmaster ~]$ gpstop -u
20231031:16:37:01:017514 gpstop:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Starting gpstop with args: -u
20231031:16:37:01:017514 gpstop:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Gathering information and validating the environment...
20231031:16:37:01:017514 gpstop:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Obtaining Greenplum Master catalog information
20231031:16:37:01:017514 gpstop:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Obtaining Segment details from master...
20231031:16:37:01:017514 gpstop:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Greenplum Version: 'postgres (Greenplum Database) 6.19.0 build commit:c88801925e5d51e4be57f54ff2158ed74a264b8e Open Source'
20231031:16:37:01:017514 gpstop:hdt-dmcp-gpmaster:gpadmin-[INFO]:-Signalling all postmaster processes to reload
# 建议条件允许快速模式重启集群
[gpadmin@hdt-dmcp-gpmaster ~]$ gpstop -M fast
[gpadmin@hdt-dmcp-gpmaster ~]$ gpstart -a
# 启动gpcc
[gpadmin@hdt-dmcp-gpmaster tmp]$ gpcc start
2023-10-31 18:01:19 Starting the gpcc agents and webserver...
2023-10-31 18:01:22 Agent successfully started on 6/6 hosts
2023-10-31 18:01:22 View Greenplum Command Center at http://hdt-dmcp-gpmaster:28080
[gpadmin@hdt-dmcp-gpmaster tmp]$
[gpadmin@hdt-dmcp-gpmaster tmp]$ gpcc status
2023-10-31 18:03:47 GPCC webserver: running
2023-10-31 18:03:48 GPCC agents: 6/6 agents running
# 查看账号密码
[gpadmin@hdt-dmcp-gpmaster ~]$ cat ~/.pgpass
*:5432:gpperfmon:gpmon:KiMvboFf
# 其中 ”gpmon“为账号 “KiMvboFf”为密码
3. gpcc-web界面使用介绍
3-1. 登录界面
根据安装完毕后的~/.pgpass
文件信息进行登录使用