安装

1、下载安装文件
https://network.pivotal.io/products/pivotal-gpdb 下载,目前最新版本为 6.3.0。
2、解压安装文件

  1. unzip greenplum-cc-web-6.3.0-gp6-rhel7-x86_64.zip

3、进入安装目录

  1. cd greenplum-cc-web-6.3.0-gp6-rhel7-x86_64

4、创建配置文件 install.conf,用于设置安装参数

  1. cat >> install.conf << EOF
  2. path = /usr/local
  3. # Set the display_name param to the string to display in the GPCC UI.
  4. # The default is "gpcc"
  5. # display_name = gpcc
  6. master_port = 5432
  7. web_port = 28080
  8. rpc_port = 8899
  9. enable_ssl = false
  10. # Uncomment and set the ssl_cert_file if you set enable_ssl to true.
  11. # ssl_cert_file = /etc/certs/mycert
  12. enable_kerberos = false
  13. # Uncomment and set the following parameters if you set enable_kerberos to true.
  14. # webserver_url = <webserver_service_url>
  15. # krb_mode = 1
  16. # keytab = <path_to_keytab>
  17. # krb_service_name = postgres
  18. # User interface language: 1=English, 2=Chinese, 3=Korean, 4=Russian, 5=Japanese
  19. language = 1
  20. EOF

6、执行安装命令
通过配置文件安装:

  1. # -W 设置密码,输入gpmon
  2. ./gpccinstall-6.3.0 -auto -W

执行完之后,会发现创建了gpperfmon数据库:

  1. CREATING SUPERUSER 'gpmon'...
  2. CREATING COMMAND CENTER DATABASE 'gpperfmon'...
  3. RELOADING pg_hba.conf. PLEASE WAIT ...

7、设置环境变量

  1. echo "source /usr/local/greenplum-cc/gpcc_path.sh" >> ~/.bashrc
  2. source ~/.bashrc

8、同步配置文件
查看生成的文件 .pgpass

  1. cat ~/.pgpass
  2. *:5432:gpperfmon:gpmon:gpmon

可以看到创建了gpmon用户,密码为changeme。

可以修改该文件中密码为gpmon,或者通过环境变量设置:

  1. PGPASSWORD=gpmon

也可以修改数据库中密码和~/.pgpass一致:

  1. alter user gpmon encrypted password 'gpmon'

将该文件同步到Standby Master节点:

  1. scp ~/.pgpass gpadmin@dw-test-node002:~
  2. ssh dw-prod-node001 "chmod 600 ~/.pgpass"

9、查看配置文件

  • $MASTER_DATA_DIRECTORY/gpperfmon/conf/gpperfmon.conf
  • $GPCC_HOME/conf/app.conf
  • $MASTER_DATA_DIRECTORY/gpmetrics/gpcc.conf
  • $MASTER_DATA_DIRECTORY/postgresql.conf

查看$GPCC_HOME/conf/app.conf

  1. $ cat $GPCC_HOME/conf/app.conf
  2. appname = gpccws
  3. listentcp4 = true
  4. runmode = prod
  5. session = true
  6. enablexsrf = true
  7. xsrfexpire = 2592000
  8. xsrfkey = 61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o
  9. rendertype = json
  10. printallsqls = false
  11. master_port = 5432
  12. master_host = dw-test-node001
  13. path = /usr/local
  14. display_name = gpcc
  15. enable_kerberos = false
  16. EnableHTTPS = false
  17. EnableHTTP = true
  18. httpport = 28080
  19. rpc_port = 8899
  20. language = English
  21. log_level = INFO
  22. ws_perf_port = 6162
  23. agent_perf_port = 616

修改 $MASTER_DATA_DIRECTORY/pg_hba.conf:

  1. local gpperfmon gpmon md5
  2. host gpperfmon gpmon 0.0.0.0/0 md5
  3. host gpperfmon gpmon ::1/128 md5

需要重启gp数据库:gpstop -r

登陆测试:

  1. psql -d gpperfmon -U gpmon -h -W

10、启动

  1. $ PGPASSWORD=gpmon gpcc start
  2. # 也可以输入密码登陆
  3. $ gpcc start -W

查看状态:

  1. $ gpcc status
  2. 2019-12-16 18:37:19 GPCC webserver: running
  3. 2019-12-16 18:37:19 GPCC agents: 3/3 agents running

查看日志:

  1. tailf $GPCC_HOME/logs/gpccws.log

11、访问浏览器 http://192.168.56.141:28080 ,用户名和密码为 gpmon
image-20191217120230168
12、查看配置参数

  1. $ gpcc --settings
  2. Install path: /usr/local
  3. Display Name: gpcc
  4. GPCC port: 28080
  5. Kerberos: disabled
  6. SSL: disabled

禁用gpperfmon

1、安装
使用gpperfmon_install命令可以创建名称为gpperfmon的数据库,默认使用gpmon用户。

  1. gpperfmon_install --enable --password gpmon --port 5432

当然,在前面运行gpccinstall-6.1.0的时候,已经创建了该数据库。
2、查看gpperfmon是否开启

  1. gpconfig -s gp_enable_gpperfmon

3、 Greenplum Command Center不再需要gpperfmon agent搜集的历史数据,所以需要禁用gp_enable_gpperfmon

  1. gpconfig -c gp_enable_perform -v off

4、然后重启数据库

  1. gpstop -ar
  2. #强制重启
  3. gpstop -Ma immediate

设置gpmon角色日志参数

连接gpperfmon数据库:

  1. psql -d gpperfmon -p 5432 -U gpadmin

修改角色:

  1. psql -d gpperfmon -U gpmon
  2. psql (9.4.24)
  3. Type "help" for help.
  4. gpperfmon=# ALTER ROLE gpmon SET log_statement TO DDL;
  5. ALTER ROLE
  6. gpperfmon=# ALTER ROLE gpmon SET log_min_messages to FATAL;
  7. ALTER ROLE

卸载

1、停止

  1. gpcc stop

2、删除安装目录

  1. rm -rf /usr/local/greenplum-cc-web-6.1.0

3、禁用采集数据agent

  1. su - gpadmin
  2. gpconfig -c gp_enable_gpperfmon -v off

4、删除pg_hba.conf中gpmon条目

  1. #local gpperfmon gpmon md5
  2. #host gpperfmon gpmon 0.0.0.0/0 md5

5、删除角色

  1. psql template1 -c 'DROP ROLE gpmon;'

6、重启数据库

  1. gpstop -r

7、删除未提交的的数据和日志

  1. rm -rf $MASTER_DATA_DIRECTORY/gpperfmon/data/*
  2. rm -rf $MASTER_DATA_DIRECTORY/gpperfmon/logs/*

8、删除数据库

  1. dropdb gpperfmon