最新版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 安裝部署