最新版Greenplum Command Center 安装部署

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了最新版Greenplum Command Center 安装部署相关的知识,希望对你有一定的参考价值。

集群系统初始化信息:

系统初始化参考:http://blog.51cto.com/michaelkang/2167195
集群安装配置参考:http://blog.51cto.com/michaelkang/2170627

本文对敏感信息进行了替换!!!!

Greenplum Command Center 安装部署

Greenplum Command Center介绍

Greenplum Command Center用于监控系统性能指标、分析系统健康、管理执行管理任务(如start 、stop、恢复Greenplum等)。它由data collection agent和Command Center等组件组成:

Agent:安装在master及其他segment节点上,用于收集数据,包括查询、系统指标等。Master节点的agent轮询收集segment的agent数据,然后发送给Command Center Database。

Command Center Database:存放agent收集的数据和指标,然后运算后通过web界面展现。它存放在Greenplum Database的gpperfmon库里。

Greenplum Command Center Console:提供图形终端用于查看系统指标和性能。

Greenplum Command Center Web Service:Greenplum Command Center Console通过web service框架来访问Command Center 数据库。使用的是Lighttpd服务器。

主机列表 (master节点):

cat >/workspace/gpdb/gp-all.txt <<-EOF
gpnode611.kjh.com   
gpnode612.kjh.com 
gpnode613.kjh.com   
gpnode614.kjh.com
gpnode615.kjh.com
gpnode616.kjh.com   
EOF

segment 节点

cat >/workspace/gpdb/gp-sg.txt<<-EOF
gpnode611.kjh.com   
gpnode612.kjh.com 
gpnode613.kjh.com   
gpnode614.kjh.com
EOF

安装gpcc

cd /workspace/gpdb/
wget dl.#kjh#.com/greenplum-cc-web-4.3.1-LINUX-x86_64.zip
unzip greenplum-cc-web-4.3.1-LINUX-x86_64.zip 
chown gpadmin:gpadmin -R *
su - gpadmin 

创建Command Center数据库(gpperfmon)

运行gpperfmon_install工具,提供Greenplum Database master的端口,设置gpmon用户密码。

gpperfmon_install --enable --port 5432 --password gpadmin
=>]:-createdb gpperfmon >& /dev/null
=>]:-PGPORT=5432 psql -f /usr/local/greenplum-db/./lib/gpperfmon/gpperfmon.sql gpperfmon >& /dev/null
=>]:-PGPORT=5432 psql template1 -c "DROP ROLE IF EXISTS gpmon"  >& /dev/null
=>]:-PGPORT=5432 psql template1 -c "CREATE ROLE gpmon WITH SUPERUSER CREATEDB LOGIN ENCRYPTED PASSWORD ‘gpadmin‘"  >& /dev/null
=>]:-echo "local    gpperfmon         gpmon         md5" >> /usr/local/gpdata/gpmaster/gpseg-1/pg_hba.conf
=>]:-echo "host     all         gpmon         127.0.0.1/28    md5" >> /usr/local/gpdata/gpmaster/gpseg-1/pg_hba.conf
=>]:-echo "host     all         gpmon         ::1/128    md5" >> /usr/local/gpdata/gpmaster/gpseg-1/pg_hba.conf
=>]:-touch /home/gpadmin/.pgpass >& /dev/null
=>]:-mv -f /home/gpadmin/.pgpass /home/gpadmin/.pgpass.1536042224 >& /dev/null
=>]:-echo "*:5432:gpperfmon:gpmon:gpadmin" >> /home/gpadmin/.pgpass
=>]:-cat /home/gpadmin/.pgpass.1536042224 >> /home/gpadmin/.pgpass
=>]:-chmod 0600 /home/gpadmin/.pgpass >& /dev/null
=>]:-PGPORT=5432 gpconfig -c gp_enable_gpperfmon -v on >& /dev/null
=>]:-PGPORT=5432 gpconfig -c gpperfmon_port -v 8888 >& /dev/null
=>]:-PGPORT=5432 gpconfig -c gp_external_enable_exec -v on --masteronly >& /dev/null
=>]:-PGPORT=5432 gpconfig -c gpperfmon_log_alert_level -v warning >& /dev/null
=>]:-gpperfmon will be enabled after a full restart of GPDBbled after a full restart of GPDB

重启Greenplum DB,重启后data collection agent才会启动

gpstop -r

确认 Master节点上data collection进程是否运行

ps -ef|grep gpmmon
gpadmin   33145  33135  0 14:32 ?        00:00:00 /usr/local/greenplum-db-5.10.2/bin/gpmmon -D /usr/local/gpdata/gpmaster/gpseg-1/gpperfmon/conf/gpperfmon.conf -p 5432

确认 data collection 进程已经把数据写入到了Command Center数据库。

如果所有segment data collection agent在运行,你可以看到segment记录。

psql gpperfmon -c ‘SELECT * FROM system_now;‘

        ctime        |         hostname         |  mem_total  |  mem_used   
dle | load0 | load1 | load2 | quantum | disk_ro_rate | disk_wo_rate | disk_r略。。
---------------------+--------------------------+-------------+-------------略。。
----+-------+-------+-------+---------+--------------+--------------+-------略。。
 2018-09-04 14:34:00 | gpnode611.kjh.com | 67129667584 |  5077311488 略。。
9.5 |   0.1 |  0.07 |  0.05 |      15 |            0 |            3 |       略。。
 2018-09-04 14:34:00 | gpnode612.kjh.com | 67129667584 |  5032013824 略。。
.98 |  0.05 |  0.06 |  0.05 |      15 |            0 |            2 |       略。。
 2018-09-04 14:34:00 | gpnode613.kjh.com | 67129667584 |  4930248704 略。。
.98 |  0.02 |  0.02 |  0.05 |      15 |            0 |            4 |       略。。
 2018-09-04 14:34:00 | gpnode614.kjh.com | 33309020160 |  4763942912 略。。
.98 |     0 |  0.01 |  0.05 |      15 |            0 |            0 |       略。。
 2018-09-04 14:34:00 | gpnode615.kjh.com | 67131998208 | 60665606144 略。。
.76 |  0.08 |  0.22 |  0.19 |      15 |            0 |            3 |       略。。
 2018-09-04 14:34:00 | gpnode616.kjh.com | 67129692160 | 33751642112 略。。
.52 |  0.12 |  0.35 |  0.27 |      15 |            0 |            2 |       略。。
(6 rows)

查看gpperfmon数据库中的内容

psql gpperfmon

psql (8.3.23)
gpperfmon=# dt

                            List of relations
 Schema |                Name                 | Type  |  Owner  | Storage 
--------+-------------------------------------+-------+---------+---------
 public | database_history                    | table | gpadmin | heap
 public | database_history_1_prt_1            | table | gpadmin | heap
 public | database_history_1_prt_r1415749053  | table | gpadmin | heap
 public | database_history_1_prt_r454010987   | table | gpadmin | heap
.............略。。。。。。。。。。。。
 public | socket_history_1_prt_1              | table | gpadmin | heap
 public | system_history                      | table | gpadmin | heap
 public | system_history_1_prt_1              | table | gpadmin | heap
 public | system_history_1_prt_r1729197682    | table | gpadmin | heap
 public | system_history_1_prt_r526510131     | table | gpadmin | heap
(28 rows)

配置standby master

把Master上的$MASTER_DATA_DIRECTORY/pg_hba.conf文件拷贝到standby master上。确保Command Ceneter也能够访问standby master。拷贝Master的 ~/.pgpass文件到standby master上。
注意:.pgpass文件的权限是600。

传输配置文件到standby节点:
scp -rp /usr/local/gpdata/gpmaster/gpseg-1/pg_hba.conf [email protected]:/usr/local/gpdata/gpmaster/gpseg-1/
scp -rp ~/.pgpass [email protected]:~/.pgpass

重新加载配置文件 postgresql.conf 和 pg_hba.conf

gpstop -u

安装Greenplum Command Center Console控制台

创建数据文件夹 (以root在master执行)

source /usr/local/greenplum-db/greenplum_path.sh
gpssh -f /workspace/gpdb/gp-all.txt
=>
mkdir -p /usr/local/gpcc
chown -R gpadmin:gpadmin  /usr/local/gpcc
exit 

初始化安装

cd /workspace/gpdb/greenplum-cc-web-4.3.1-LINUX-x86_64/  
./gpccinstall-4.3.1  
初始化过程如下:
Do you agree to the Pivotal Greenplum Command Center End User License Agreement? Yy/Nn (Default=Y)
y

Where would you like to install Greenplum Command Center? (Default=/usr/local)
 /usr/local/gpcc     《=====自定义安装路径          

What would you like to name this installation of Greenplum Command Center? (Default=gpcc)
What port would you like gpcc webserver to use? (Default=28080)
Would you like to enable kerberos? Yy/Nn (Default=N)
Would you like enable SSL? Yy/Nn (Default=N)

...........................

To manage Command Center, use the gpcc utility.
Usage:
  gpcc [OPTIONS] <command>

Application Options:
  -v, --version   Show Greenplum Command Center version
      --settings  Print the current configuration settings

Help Options:
  -h, --help      Show this help message

Available commands:
  help        Print list of commands
  krbdisable  Disables kerberos authentication
  krbenable   Enables kerberos authentication
  start       Starts Greenplum Command Center webserver and metrics collection agents [-W]  option to force password prompt for GPDB user gpmon [optional]
  status      Print agent status  with  [-W]  option to force password prompt for GPDB user gpmon [optional]
  stop        Stops Greenplum Command Center webserver and metrics collection agents [-W]  option to force password prompt for GPDB user gpmon [optional] 

添加环境变量:

设置gpadmin账户的环境并使之生效 gpadmin账户操作(master,standby 节点都配置)

修改.bashrc

cat >>/home/gpadmin/.bashrc<<-EOF
GPCC_HOME=/usr/local/gpcc/greenplum-cc-web-4.3.1/
PATH=$GPCC_HOME/bin:$PATH
export GPCC_HOME
EOF

修改.bash_profile

cat >>/home/gpadmin/.bash_profile<<-EOF
GPCC_HOME=/usr/local/gpcc/greenplum-cc-web-4.3.1/
PATH=$GPCC_HOME/bin:$PATH
export GPCC_HOME
EOF
使之生效
source ~/.bashrc
source ~/.bash_profile

增加访问权限

vim /usr/local/gpdata/gpmaster/gpseg-1/pg_hba.conf 
配置文件尾部添加内容如下:
host     all         gpmon         0.0.0.0/0    md5

传输配置文件到standby节点:
scp -rp /usr/local/gpdata/gpmaster/gpseg-1/pg_hba.conf [email protected]:/usr/local/gpdata/gpmaster/gpseg-1/

#重新加载配置文件 postgresql.conf 和 pg_hba.conf
gpstop -u

启动服务

命令参考

 gpcc [OPTIONS] <command>

Application Options:
  -v, --version   Show Greenplum Command Center version
      --settings  Print the current configuration settings

Help Options:
  -h, --help      Show this help message

Available commands:
  help        Print list of commands
  krbdisable  Disables kerberos authentication
  krbenable   Enables kerberos authentication
  start       Starts Greenplum Command Center webserver and metrics collection agents [-W]  option to force password prompt for GPDB user gpmon [optional]
  status      Print agent status  with  [-W]  option to force password prompt for GPDB user gpmon [optional]
  stop        Stops Greenplum Command Center webserver and metrics collection agents [-W]  option to force password prompt for GPDB user gpmon [optional] 

启动 gpcc-web

gpcc start

Starting the gpcc agents and webserver…
2018/09/04 15:05:39 Agent successfully started on 6/6 hosts
2018/09/04 15:05:39 View Greenplum Command Center at http://gpnode615.kjh.com:28080

登陆用户密码存放位置:

/home/gpadmin/.pgpass

访问

http://gpnode615.kjh.com:28080

参考资料:

https://gpcc.docs.pivotal.io/300/gpcc/topics/setup-connect.html
https://www.cnblogs.com/lottu/p/8820227.html
https://github.com/faer615/greenplum

以上是关于最新版Greenplum Command Center 安装部署的主要内容,如果未能解决你的问题,请参考以下文章

如何安装greenplum,它犯了“gpssh-exkeys -f /home/gpadmin/conf/hostlist bash: gpssh-exkeys: command not found.

无法启动 greenplum - gpstart 失败

greenplum 的 gp_dump 实用程序不可用

greenplum的升级与连接池pgbouncer

Greenplum数据库集群

升级 greenplum-cc-web 到 4.4.0