一、安装GP监控的数据库和用户等信息
执行Greenplum DB数据库的gpperfmon_install工具,完成GP监控软件安装的前期准备工作
gpperfmon_install工具的功能大致是:
创建greenplum监控用数据库(gpperfmon)
创建greenplum监控用数据库角色(gpmon)
配置greenplum数据库接受来自perfmon监控的链接文件(pg_hba.conf和.pgpass)
设置postgresql.conf文件,增加启用监控的参数。(这些参数默认会添加在文件的末尾)
下面在GreenplumMaster节点操作:
1) 使用gpadmin用户登录
su - gpadmin
2) 执行 gpperfmon_install 命令
gpperfmon_install--enable --password ** --port 5432
If using the --enable option,the Greenplum Database instance must be restarted after the utility completes.
命令执行后,会创建gpmon角色,以及设置了密码,这个用户可以登录到数据库里面,也可用于登录页面。
3) 重启greenplum 数据库
gpstop -r
4) 查看gpmon进程,是否已经启用
ps -ef | grep gpmmon |grep -v grep
5) 查看数据收集进程是否正常
psql gpperfmon -c 'SELECT* FROM system_now;'
下面配置Greenplum Standby Master节点:
1) 将primary master上面的$MASTER_DATA_DIRECTORY/pg_hba.conf拷贝到standby master的$MASTER_DATA_DIRECTORY/pg_hba.conf
scp $MASTER_DATA_DIRECTORY/pg_hba.conf gpadmin@smdw:$MASTER_DATA_DIRECTORY/pg_hba.conf
2) 将primary master上面的~/.pgpass拷贝到standby master的~/.pgpass,并且文件权限修改为0600
scp ~/.pgpass gpadmin@smdw:~/.pgpass
ssh gpadmin@smdw -C "chmod 0600~/.pgpass"
二、开始正式安装Greenplum Command Center Console
以下操作都在primarymaster节点操作:
1)下载适合自己机器的greenplum-cc-web安装程序
greenplum-cc-web-1.2.2.1-build-71-RHEL5-x86_64.zip
官网上面只能下载到RedHat操作系统的,要求在SuSE操作系统上面安装,可先在RedHat上面安装好之后,将安装目录打包后,再安装到SuSE上,但是配置文件需要根据需要修改。
2) 将获取的GPCC包(greenplum-cc-web-1.2.2.1-x86_64.tar.gz)上传到primarymaster节点的gpadmin用户家目录下面并完成解压操作
cd /home/gpadmin/
tar -zxvf greenplum-cc-web-1.2.2.1-x86_64.tar.gz
chown -R gpadmin:gpadmin greenplum-cc-web-1.2.2.1-build-71
chmod -R 755 greenplum-cc-web-1.2.2.1-build-71
3) 切换到gpadmin用户并建立软链接
su - gpadmin
ln -s greenplum-cc-web-1.2.2.1-build-71 greenplum-cc-web
4) 修改/home/gpadmin/greenplum-cc-web/gpcc_path.sh文件,将GPPERFMONHOME配置为GP监控的实际家目录,如下:
GPPERFMONHOME=/home/gpadmin/greenplum-cc-web-1.2.2.1-build-71
5) 将"source/home/gpadmin/greenplum-cc-web/gpcc_path.sh"加入到~/.bashrc文件并source使环境变量生效:
echo "source/home/gpadmin/greenplum-cc-web/gpcc_path.sh" >> ~/.bashrc
source .bashrc
6) 将primary master的GP监控软件同时安装到到其他GP节点(如standbymaster和segments):
a. 准备一个文件hostfilename里面包含其他未安装GP监控软件的GPDB数据库的主机名
b.开始执行gpccinstall工具安装到其他节点
gpccinstall -f hostfilename
三、开始设置the Command Center Console
以下操作在primarymaster节点执行:
1) 登录到gpadmin用户,停止GP数据库
gpstop -M fast
2) 确保gpadmin家目录下面的.bashrc文件中含有如下类似的配置:
source /home/gpadmin/greenplum-cc-web/gpcc_path.sh
export MASTER_DATA_DIRECTORY=/data/master/gpseg-1
source /usr/local/greenplum-db/greenplum_path.sh
确保要保存.bashrc文件并source.bashrc 使环境变量生效
3) 启动GP数据库
gpstart
4) GP数据库实例起来后,就可以开始执行gpcmdr--setup命令,开始设置Command Center Console:
gpcmdr --setup
Please enter a new instance name:
> #gp监控实例名,用于启停监控时指定
The web component of the Greenplum CommandCenter can connect to a
monitor database on a remote GreenplumDatabase.
Is the master host for the GreenplumDatabase remote? Yy|Nn (default=N):
> #监控是否和GP master同节点,N指同节点
What would you like to use for the displayname for this instance:
> #登录GP监控页面展示的名字
What port does the Greenplum Database use?(default=5432):
>
What port would you like the web server touse for this instance? (default=28080):
>
Do you want to enable SSL for the Web APIYy|Nn (default=N):
> #是否使用SSL加密方式登录GP监控页面
下面都是选填的,自己决定是否填写
Country Name (2 letter code) [AU]:US
State or Province Name (full name)[Some-State]:California
Locality Name (eg, city) []:San Mateo
Organization Name (eg, company) [InternetWidgits Pty Ltd]:Greenplum
Organizational Unit Name (eg, section)[]:Engineering
Common Name (e.g. server FQDN or YOUR name)[]:linux116
Email Address []:hellokitty@huawei.com
Do you want to enable ipV6 for the Web APIYy|Nn (default=N):
>
Do you want to enable Cross Site RequestForgery Protection for the Web API Yy|Nn (default=N):
>
#是否将GP监控实例拷贝到standby master节点(冗余备份的目的)
Do you want to copy the instance to astandby master host Yy|Nn (default=Y):
>
What is the hostname of the standby masterhost? [smdw]:
#打印登录网址
The web UI for this instance is available at https://linux116:28080/
#打印出启动GP监控命令
You can now start the web UI for thisinstance by running: gpcmdr --start gpmon_82
5) 启动GP监控
gpcmdr --start gpmon_82
查看端口号状态:
lsof -i :28080
6) 使用浏览器访问https://10.41.24.102:28080
输入用户名和密码登录就OK了
关于登录https://10.41.24.102:28080页面后,输入正确密码却无法登录进去的问题
1) 问题描述,如图所示:
提示用户名或密码不正确,但是我使用psql登录数据库是OK的
psql -dgpperfmon -U gpmon -W
通过查看日志/home/gpadmin/greenplum-cc-web/instances/gpmon_82/logs/gpmonws.log如下:
2014-05-2011:22:37,584 - Checking trust login for gpmon on db gpperfmon, host localhost,port :5432
2014-05-2011:22:37,592 - Trust login not allowed. User gpmon has trust login enabled
2014-05-2011:22:37,592 - Authentication failed user(gpmon)allow_trust_logon(False): Incorrect username/password
从日志“Trust login not allowed. User gpmon has trust login enabled”可以看出,gpmon是不容许Trust方式登录的,因为GP监控实例配置文件gpperfmonui.conf中默认配置allow_trust_logon=False,指不容许Trust方式登录。
是GP数据库的权限配置文件pg_hba.conf有问题,查看如下:
cat /data/master/gpseg-1/pg_hba.conf
host all all 0.0.0.0/0 trust
local gpperfmon gpmon md5
host all gpmon 127.0.0.1/28 md5
host all gpmon 0.0.0.0/0 trust
可以看到竟然配置了“host all all 0.0.0.0/0 trust”,容许所有的客户端Trust方式登录,注释掉这一行,然后执行如下命令重新加载pg_hba.conf配置文件:
gpstop –u
然后再重新登录GP监控页面,正确输入用户名和密码就可以登录进去了。
注:如果是希望gpmon可以Trust方式登录页面(指密码可以随便输入就可以登录进去),那么你就可以修改GP监控实例配置文件gpperfmonui.conf中配置项allow_trust_logon = True,指容许Trust方式登录,然后重启GP监控实例:
gpcmdr --restart gpmon_82
这样就可以Trust方式登录进GP监控页面了(输入正确用户名,密码随便输入)。
四、卸载GP监控
1) 登录Master节点,停止CommandCenter Console 服务
gpcmdr --stop
2) 登录GP数据库所有节点,删除GP监控安装的目录
先删除软链接,再删除实际GP实际安装目录(Greenplum DB所有节点都执行)
rm -rf/home/gpadmin/greenplum-cc-web
rm -rf/home/gpadmin/greenplum-cc-web-1.2.2.1-build-71
3) 登录Master节点gpadmin用户,禁用掉数据收集代理:
修改 $MASTER_DATA_DIRECTORY/postgresql.conf 文件,将下面的值修改为off:
gp_enable_gpperfmon=off
4) 登录Master节点gpadmin用户,注释掉文件pg_hba.conf下面的内容:
#local gpperfmon gpmon md5
#host gpperfmon gpmon 0.0.0.0/0 md5
5) 删除gpmon角色和gpperfmon数据库
psql template1 -c'DROP ROLE gpmon;'
ERROR: role "gpmon" cannot be dropped because some objects depend onit
DETAIL: 21 objects in database gpperfmon
如果按照官方文档描述,先删除gpmon角色,会报错,建立可以先删除gpperfmon数据库再删除gpmon角色。
dropdb gpperfmon
psql template1 -c'DROP ROLE gpmon;'
6) 重启GP数据库实例:
gpstop -r
7) 登录到master节点上面清理掉下面的内容:(MASTER_DATA_DIRECTORY=/data/master/gpseg-1)
rm -rf$MASTER_DATA_DIRECTORY/gpperfmon/data/*
rm -rf$MASTER_DATA_DIRECTORY/gpperfmon/logs/*
http://blog.youkuaiyun.com/jiangshouzhuang/article/details/34436677
GPCC升级
1. 用 gpadmin 进行登录.
2. Source greenplum_path.sh、 gpcc_path.sh 文件:
$ source /usr/local/greenplum-db/greenplum_path.sh
$ source /usr/local/greenplum-cc-web/gpcc_path.sh
3. 停止 gpcc 服务:
$ gpcmdr --stop
4. 下载最新的 gpcc 安装包:
greenplum-cc-web-versionx.x-PLATFORM.zip
5. 解压缩:
# unzip greenplum-cc-web-versionx.x-PLATFORM.zip
6. 安装新版本:
$ /bin/bash greenplum-cc-web-versionx.x-PLATFORM.bin
7.修改 .bashrc 环境变量中的GPPERFMONHOME:
vi ~/.bashrc
GPPERFMONHOME=/usr/local/greenplum-cc-web-versionx.x
source $GPPERFMONHOME/gpcc_path.sh
$ source ~/.bashrc
8.创建文件放入集群所有的主机名
9.执行安装程序
$ gpccinstall -f hostfilename
卸载 GPCC
1. Stop Command Center Console if it is currently running. For example:
$ gpcmdr --stop
2. Remove the Command Center installation directory from all hosts. For example:
$ rm -rf /usr/local/greenplum-cc-web-version
3. Disable the Data Collection Agents.
a. Log in to the master host as the Greenplum administrative user (gpadmin):
$ su - gpadmin
b. Edit the $MASTER_DATA_DIRECTORY/postgresql.conf file and disable the data collection agents:
gp_enable_gpperfmon = off
c. Remove or comment out the gpmon entries in pg_hba.conf. For example:
#local gpperfmon gpmon md5
#host gpperfmon gpmon 0.0.0.0/0 md5
d. Drop the Command Center superuser role from the database. For example:
$ psql template1 -c 'DROP ROLE gpmon;'
e. Restart the Greenplum Database instance:
$ gpstop -r
f. Clean up any uncommitted Command Center data and log files that reside on the master file system:
$ rm -rf $MASTER_DATA_DIRECTORY/gpperfmon/data/*
$ rm -rf $MASTER_DATA_DIRECTORY/gpperfmon/logs/*
g. If you do not want to keep your historical Command Center data, drop the gpperfmon database:
$ dropdb gpperfmon
修改监控用户的密码
1. Log in to Greenplum Database as a superuser and change the gpmon password with the ALTER ROLE command:
# ALTER ROLE gpmon WITH PASSWORD 'new_password';
2. Update the password in the .pgpass file, which is used by Greenplum Command Center. The default location for this file is the gpadmin home directory (~/.pgpass). This file contains a line with the gpmon password. Replace the existing password with the new password.
*:5432:gpperfmon:gpmon:new_password
The file should be owned by gpadmin and RW-accessible by gpadmin only.
3. Restart Greenplum Command Center with the gpcmdr utility.
$ gpcmdr --restart