greenplum 使用
8.尝试链接到postgres数据库
psql -d postgres
postgres=# select datname,datdba,encoding,datacl from pg_database;
建立数据库,建立表
createdb sea -E utf-8
psql -d sea
select version();
create table test01(id int primary key,col1 varchar(50));
insert into test01 select 1,'sea' ;
select * from test01;
9.建立用户
CREATE ROLE user01 WITH LOGIN;
ALTER ROLE user01 WITH PASSWORD '111111';
GRANT ALL ON DATABASE sea TO user01;
取消受权:
REVOKE ALL ON DATABASE sea from user01;
CREATE USER user01 WITH PASSWORD '111111' NOSUPERUSER;
\du
CREATE ROLE users;
GRANT users TO user01;
GRANT ALL PRIVILEGES ON DATABASE sea TO user01;
psql: FATAL: no pg_hba.conf entry for host
修改:/data1/gpdata/master/gpseg-1/pg_hba.conf
host all all 10.5.15.222/32 trust
从新加载配置:select pg_reload_conf();
10.数据库启动关闭
gpstart
gpstop
gpstate
也能够用gpstat来查看当前的状态,此命令也是排错时的必备工具
gpstat -e #查看mirror的状态,咱们此次的案例没有安装mirror
gpstat -f #查看standby master的状态
gpstat -s #查看整个GP群集的状态
gpstat -i #查看GP的版本
gpstat --help #帮助文档,能够查看gpstat更多用法,
2、GreenPlum安装性能监控工具GPCCC(Greenplum Command Center Console)
1.performance monitor安装
使用gpperfmon_install命令,Greenplum安装完成后已经包含该命令,安装后会创建名为gpperfmon的数据库,默认使用gpmon用户。
gpperfmon_install --enable --password gpmon --port 5432
而后重启数据库,-r的含义是restart
gpstop -r
2.确认监控采集进程是否已经启动
ps -ef|grep gpmmon|grep -v grep
#确认Performance Monitor数据库写入数据是否正常,检查是否有记录写入
psql -d gpperfmon -c 'select * from system_now'
若是配置了master的standby,拷贝Master主机拷贝配置文件到Standby Master的相应目录.
gpscp -h sea5 /data/disk1/gp/master/gpseg-1/pg_hba.conf =:$MASTER_DATA_DIRECTORY/
gpscp -h sea5 ~/.pgpass =:~/
3.安装Greenplum Command Center Console
下载地址 https://network.pivotal.io/products/pivotal-gpdb
3.1安装gpccc
./greenplum-cc-web-1.3.0.0-build-91-RHEL5-x86_64.bin
输入performance monitor的安装目录如 /opt/17173_install/greenplum-cc-web-2.4.0
chown -R hadoop greenplum-cc-web-2.4.0
chown -R gpadmin:gpadmin greenplum-cc-web
gpccc和gpdb同样,都会建立一个软连接,分别是greenplum-db和greenplum-cc-web.
3.2设置环境变量
source greenplum-cc-web/gpcc_path.sh
或者vi ~/.bashrc ~/.bash_profile
source /opt/17173_install/greenplum-db/greenplum_path.sh
source /opt/17173_install/greenplum-cc-web/gpcc_path.sh
source ~/.bashrc
3.3 在全部主机安装GPCCC
这里的all_host文件就采用前面安装GPDB的时候的全部节点的文件
gpccinstall -f /opt/17173_install/greenplum-db/host
#注意在全部机器上配置环境变量,或者使用gpscp 将一台机器的文件copy到其余机器
vi .bashrc
source /opt/17173_install/greenplum-cc-web/gpcc_path.sh
3.4 配置安装详细项
cd /opt/17173_install/greenplum-cc-web-2.4.0
gpcmdr --setup
Please enter a new instance name:输入gpcc
Is the master host for the Greenplum Database remote? Yy|Nn (default=N):n
What would you like to use for the display name for this instance:gpcc
What port does the Greenplum Database use? (default=5432):回车
will you install workload manaager (default=N):Y
What port would you like the web server to use for this instance?回车
Do you want to enable SSL for the Web API Yy|Nn (default=N):n
Do you want to copy the instance to a standby master host Yy|Nn (default=Y): 没有standby n
What is the hostname of the standby master host? [sea6]:回车
3.5 启动及相关操做
启动实例:
gpcmdr --start gpcc
查看端口状态: lsof -i :28080
发现是lighttpd
浏览: http://sea6:28080/
4.相关注意事项
4.1重启应用的时候,若是有其余连接,能够强制重启:gpstop -M immediate
4.2 错误error:
1.no pg_hba.conf entry for host “::1”, user “gpmon”, database “gpperfmon”, SSL off
解决:
vi pg_hba.conf增长:
host gpperfmon gpmon ::1/128 trust (此处的trust应该为md5,不然后面会报错)
从新加载配置:select pg_reload_conf();
ERROR: relation "gp_toolkit.__gp_log_master_ext" does not exist
报错为ERROR: relation "gp_toolkit.__gp_log_master_ext" does not exist,数据库gppfermon中gp_toolkit schema中无内容,多是template0,1中的gp_toolkit内容丢失;没办法,手动补:
psql -f $GPHOME/share/postgresql/gp_toolkit.sql gpperfmon
3.登录web提示:trust login is disabled.trust user gpmon is not allowed to login Command Center
描述:
用psql -d gpperfmon -U gpmon -W 输入密码能够正常登录
查看日志:/home/greenplum-4.3-cc/instances/gpcc2/logs/gpmonws.log
修改pg_hba.conf将其中的trust修改成md5
source /usr/local/greenplum-db/greenplum_path.sh 不要写到profile或者./bashrc文件中
由于该句会致使python环境变量的改变,导致yum不能正常使用,出现no module named yum问题
解决办法:使用是直接运行不添加,或者新创建用户中,在新用户家目录的bashrc文件中添加该环境变量,固然该用户不能使用yum命令。
root用户使用su -登入不带环境变量
本文来源:https://blog.csdn.net/eagle89/article/details/120042346
相关文章