集群系统初始化信息:
系统初始化参考: 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 gpadmin@172.20.6.16:/usr/local/gpdata/gpmaster/gpseg-1/
- scp -rp ~/.pgpass gpadmin@172.20.6.16:~/.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 gpadmin@172.20.6.16:/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
来源: http://www.bubuko.com/infodetail-2756374.html