greenplum添加监控

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Dream19881003/article/details/88183573

greenplum通过greenplum-cc对自身集群进行监控

环境:

rhel 7.5

greenplun:5.16.0

gpcc:4.5

下载地址:

https://network.pivotal.io/products/pivotal-gpdb/#/releases/280281/file_groups/1361

创建gpperfmon数据库

[gpadmin@rhmdw gpseg-1]$ gpperfmon_install --enable --password gpadmin --port 5432
20190305:14:58:56:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-createdb gpperfmon >& /dev/null
20190305:14:59:02:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-PGPORT=5432 psql -f /gp/greenplum-db/./lib/gpperfmon/gpperfmon.sql gpperfmon >& /dev/null
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-PGPORT=5432 psql template1 -c "DROP ROLE IF EXISTS gpmon"  >& /dev/null
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-PGPORT=5432 psql template1 -c "CREATE ROLE gpmon WITH SUPERUSER CREATEDB LOGIN ENCRYPTED PASSWORD 'gpadmin'"  >& /dev/null
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-echo "local    gpperfmon         gpmon         md5" >> /gp/gpdata/master/gpseg-1/pg_hba.conf
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-echo "host     all         gpmon         127.0.0.1/28    md5" >> /gp/gpdata/master/gpseg-1/pg_hba.conf
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-echo "host     all         gpmon         ::1/128    md5" >> /gp/gpdata/master/gpseg-1/pg_hba.conf
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-touch /home/gpadmin/.pgpass >& /dev/null
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-mv -f /home/gpadmin/.pgpass /home/gpadmin/.pgpass.1551769136 >& /dev/null
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-echo "*:5432:gpperfmon:gpmon:gpadmin" >> /home/gpadmin/.pgpass
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-cat /home/gpadmin/.pgpass.1551769136 >> /home/gpadmin/.pgpass
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-chmod 0600 /home/gpadmin/.pgpass >& /dev/null
20190305:14:59:04:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gp_enable_gpperfmon -v on >& /dev/null
20190305:14:59:05:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gpperfmon_port -v 8888 >& /dev/null
20190305:14:59:05:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gp_external_enable_exec -v on --masteronly >& /dev/null
20190305:14:59:06:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-PGPORT=5432 gpconfig -c gpperfmon_log_alert_level -v warning >& /dev/null
20190305:14:59:07:002389 gpperfmon_install:rhmdw:gpadmin-[INFO]:-gpperfmon will be enabled after a full restart of GPDB

修改数据库中gpmon密码

[gpadmin@rhmdw greenplum-cc-web-4.5.1-LINUX-x86_64]$ psql -d postgres
psql (8.3.23)
Type "help" for help.

postgres=# \l
                  List of databases
   Name    |  Owner  | Encoding |  Access privileges  
-----------+---------+----------+---------------------
 gaoyc     | gpadmin | UTF8     | 
 gpperfmon | gpadmin | UTF8     | gpadmin=CTc/gpadmin 
                                : =c/gpadmin
 postgres  | gpadmin | UTF8     | 
 template0 | gpadmin | UTF8     | =c/gpadmin          
                                : gpadmin=CTc/gpadmin
 template1 | gpadmin | UTF8     | =c/gpadmin          
                                : gpadmin=CTc/gpadmin
(5 rows)

postgres=# alter user gpmon encrypted password 'gpadmin';
ALTER ROLE

修改密码保持和创建数据库涉及密码一致,否则提示以下报错:

[gpadmin@rhmdw greenplum-cc-web-4.5.1-LINUX-x86_64]$ ./gpccinstall-4.5.1 
Fail to connect to database
pq: password authentication failed for user "gpmon"

开始安装:

[gpadmin@rhmdw greenplum-cc-web-4.5.1-LINUX-x86_64]$ ./gpccinstall-4.5.1 
       ***  IMPORTANT INFORMATION - PLEASE READ CAREFULLY  ***

PIVOTAL GREENPLUM DATABASE END USER LICENSE AGREEMENT

IMPORTANT - READ CAREFULLY: This Software contains computer programs and
other proprietary material and information, the use of which is subject to
and expressly conditioned upon acceptance of this End User License
Agreement ("EULA").

This EULA is a legally binding document between you (meaning the person or
the entity that obtained the Software under the terms and conditions of
this EULA, is agreeing to be bound by the terms and conditions of this
EULA, and is referred to below as "You" or "Customer") and Pivotal (meaning
(i) Pivotal Software, Inc., if Customer is located in the United States;
and (ii) the local Pivotal sales subsidiary, if Customer is located in a
country outside the United States in which Pivotal has a local sales
subsidiary; and (iii) GoPivotal International Limited, if Customer is
located in a country outside the United States in which Pivotal does not
have a local sales subsidiary (in each case, referred to herein as
"Pivotal"). Unless Customer has entered into a written and separately
signed agreement with Pivotal that is currently in effect with respect to
the license of the Software and provision of Support Services and
Subscription Services, this EULA governs Customer's use of the Software and
I HAVE READ AND AGREE TO THE TERMS OF THE ABOVE PIVOTAL GREENPLUM DATABASE
END USER LICENSE AGREEMENT.
Do you agree to the Pivotal Greenplum Command Center End User License Agreement? Yy/Nn (Default=Y)
yes
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)
/gp/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)

GPCC [version 4.5.1] may not be fully compatible with GDPB [installed version 5.16].
Please reference the version compatibility in the GPCC documentation (gpcc.docs.pivotal.io/451)

Installation in progress...

Successfully installed Greenplum Command Center.

We recommend ssh to standby master before starting GPCC webserver

To start the GPCC webserver on the current host, run gpcc start

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@rhmdw greenplum-cc-web-4.5.1]$ echo "source /gp/gpcc/greenplum-cc-web-4.5.1/gpcc_path.sh" >> ~/.bash_profile 
[gpadmin@rhmdw greenplum-cc-web-4.5.1]$ source ~/.becash_profile 
启动gpcc

[gpadmin@rhmdw greenplum-cc-web-4.5.1]$ gpcc start
Starting the gpcc agents and webserver…
2019/03/05 15:13:42 Agent successfully started on 3/3 hosts
2019/03/05 15:13:42 View Greenplum Command Center at http://rhmdw:28080

[gpadmin@rhmdw greenplum-cc-web-4.5.1]$ gpcc status
2019/03/05 15:21:41 GPCC webserver: running
2019/03/05 15:21:42 GPCC agents: 3/3 agents running

添加监控授权:

[gpadmin@rhmdw gpseg-1]$ echo "host     all         gpmon         0.0.0.0/0    md5" >> /gp/gpdata/master/gpseg-1/pg_hba.conf 

查询监控数据:

[gpadmin@rhmdw greenplum-cc-web-4.5.1]$ psql -d gpperfmon
psql (8.3.23)
Type "help" for help.

gpperfmon=# \d
                             List of relations
 Schema |                Name                 | Type  |  Owner  | Storage  
--------+-------------------------------------+-------+---------+----------
 public | _database_tail                      | table | gpadmin | external
 public | _diskspace_tail                     | table | gpadmin | external
 public | _network_interface_tail             | table | gpadmin | external
 public | _queries_tail                       | table | gpadmin | external
 public | _segment_tail                       | table | gpadmin | external
 public | _socket_tail                        | table | gpadmin | external
 public | _system_tail                        | table | gpadmin | external
 public | database_history                    | table | gpadmin | heap
 public | database_history_1_prt_1            | table | gpadmin | heap
 public | database_history_1_prt_r1886994280  | table | gpadmin | heap
 public | database_history_1_prt_r235687275   | table | gpadmin | heap
 public | database_now                        | table | gpadmin | external
 public | database_tail                       | table | gpadmin | external
 public | diskspace_history                   | table | gpadmin | heap
 public | diskspace_history_1_prt_1           | table | gpadmin | heap
 public | diskspace_history_1_prt_r260046327  | table | gpadmin | heap
 public | diskspace_history_1_prt_r288021237  | table | gpadmin | heap
 public | diskspace_now                       | table | gpadmin | external
 public | diskspace_tail                      | table | gpadmin | external
 public | dynamic_memory_info                 | view  | gpadmin | none
 public | gp_log_master_ext                   | table | gpadmin | external
 public | log_alert_history                   | table | gpadmin | heap
 public | log_alert_history_1_prt_1           | table | gpadmin | heap
 public | log_alert_history_1_prt_r1670287198 | table | gpadmin | heap
 public | log_alert_history_1_prt_r666062311  | table | gpadmin | heap
 public | log_alert_now                       | table | gpadmin | external
 public | log_alert_tail                      | table | gpadmin | external
 public | master_data_dir                     | table | gpadmin | external
 public | memory_info                         | view  | gpadmin | none
 public | network_interface_history           | table | gpadmin | heap
 public | network_interface_history_1_prt_1   | table | gpadmin | heap
 public | network_interface_now               | table | gpadmin | external
 public | network_interface_tail              | table | gpadmin | external
 public | queries_history                     | table | gpadmin | heap
 public | queries_history_1_prt_1             | table | gpadmin | heap
 public | queries_history_1_prt_r1388589774   | table | gpadmin | heap
 public | queries_history_1_prt_r692395913    | table | gpadmin | heap
 public | queries_now                         | table | gpadmin | external
 public | queries_now_fast                    | table | gpadmin | external
 public | queries_tail                        | table | gpadmin | external
 public | segment_history                     | table | gpadmin | heap
 public | segment_history_1_prt_1             | table | gpadmin | heap
 public | segment_history_1_prt_r1511481670   | table | gpadmin | heap
 public | segment_history_1_prt_r546555639    | table | gpadmin | heap
 public | segment_now                         | table | gpadmin | external
 public | segment_tail                        | table | gpadmin | external
 public | socket_history                      | table | gpadmin | heap
 public | socket_history_1_prt_1              | table | gpadmin | heap
 public | socket_now                          | table | gpadmin | external
 public | socket_tail                         | table | gpadmin | external
 public | system_history                      | table | gpadmin | heap
 public | system_history_1_prt_1              | table | gpadmin | heap
 public | system_history_1_prt_r1176892042    | table | gpadmin | heap
 public | system_history_1_prt_r1382910067    | table | gpadmin | heap
 public | system_now                          | table | gpadmin | external
 public | system_tail                         | table | gpadmin | external
(56 rows)

gpperfmon=# select * from system_now;
        ctime        | hostname | mem_total  |  mem_used  | mem_actual_used | mem_actual_free | swap_total | swap_used | swap_page_in | swap_page_out | cpu_u
ser | cpu_sys | cpu_idle | load0 | load1 | load2 | quantum | disk_ro_rate | disk_wo_rate | disk_rb_rate | disk_wb_rate | net_rp_rate | net_wp_rate | net_rb_r
ate | net_wb_rate 
---------------------+----------+------------+------------+-----------------+-----------------+------------+-----------+--------------+---------------+------
----+---------+----------+-------+-------+-------+---------+--------------+--------------+--------------+--------------+-------------+-------------+---------
----+-------------
 2019-03-05 15:23:45 | rhsdw1   | 2393448448 | 1532145664 |       257118208 |      2136330240 | 2097147904 |         0 |            0 |             0 |     0
.03 |    0.07 |     99.9 |     0 |  0.01 |  0.05 |      15 |            0 |            1 |            0 |        11249 |           9 |           8 |        7
282 |       10724
 2019-03-05 15:23:45 | rhsdw2   | 2393448448 | 1503211520 |       251822080 |      2141626368 | 2097147904 |         0 |            0 |             0 |      
  0 |    0.07 |    99.93 |  0.07 |  0.05 |  0.05 |      15 |            0 |            1 |            0 |        11249 |           9 |           8 |        7
270 |       10708
 2019-03-05 15:23:45 | rhmdw    | 2393448448 | 1271422976 |       362450944 |      2030997504 | 2097147904 |      8192 |            0 |             0 |      
0.4 |    0.17 |    99.37 |  0.02 |  0.06 |  0.05 |      15 |            0 |            3 |            0 |        12914 |          23 |          23 |        5
352 |        6326
(3 rows)

gpperfmon=# select * from database_now
gpperfmon-# ;
        ctime        | queries_total | queries_running | queries_queued 
---------------------+---------------+-----------------+----------------
 2019-03-05 15:24:00 |             0 |               0 |              0
(1 row)

访问web页面

http://rhmdw:28080

猜你喜欢

转载自blog.csdn.net/Dream19881003/article/details/88183573
今日推荐