GreenPlum 使用

2019/5/23 源自  GreenPlum

使用 gpadmin 权限登录

psql -d GP -U gpadmin -h 127.0.0.1 -p 2345

删除表

drop table if exists table films;

查询死锁的 query

select * from pg_stat_activity where waiting_reason='lock';
select pg_cancel_backend(procpid);

恢复 segment failed

生成recv文件:
gprecoverseg -o ./recv
查看recv文件
cat ./recv
使用recv文件进行恢复
gprecoverseg -i ./recv 

gp-cc 安装报错

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

gpstart -B 1 -t 3600 -v

gpssh -f /home/gpadmin/gpconfig/hostfile_gpssh_segonly -e 'mkdir /data'
gpssh -f /home/gpadmin/gpconfig/hostfile_gpssh_segonly -e 'mkdir /data'
gpssh -f /home/gpadmin/gpconfig/hostfile_gpssh_segonly -e 'mkdir /data/gpdata/primary'
gpssh -f /home/gpadmin/gpconfig/hostfile_gpssh_segonly -e 'mkdir /data/gpdata/mirror'
gpssh -f /home/gpadmin/gpconfig/hostfile_gpssh_segonly -e 'chown -R gpadmin /data/gpdata/primary'
gpssh -f /home/gpadmin/gpconfig/hostfile_gpssh_segonly -e 'chown -R gpadmin /data/gpdata/mirror'

cp $GPHOME/docs/cli_help/gpconfigs/gpinitsystem_config /home/gpadmin/gpconfigs/gpinitsystem_config

CREATE ROLE wcontrol WITH LOGIN CREATEDB SUPERUSER;
ALTER ROLE wcontrol WITH PASSWORD 'wcontrol';
GRANT ALL ON DATABASE statistic TO wcontrol;

CREATE SCHEMA lybank;
GRANT ALL ON SCHEMA lybank TO wcontrol;

ALTER SCHEMA lybank OWNER TO wcontrol;

修改 java 函数的 JVM 参数

gpconfig -c pljava_vmoptions -v "'-Xmx2048m'"
gpstop -u

进去greenplum classpath 目录

cd $GPHOME/lib/postgresql/java/
gpscp -f /home/gpadmin/conf/seg_hosts common-gp-function-1.0-jar-with-dependencies.jar =:$GPHOME/lib/postgresql/java/
gpstop -u

gpconfig -c pljava_classpath -v \'examples.jar:greenplum.jar:common-gp-function-1.0-jar-with-dependencies.jar\'