Greenplum簡明手冊

2021-08-03 19:48:41 字數 3707 閱讀 3813

su - gpadmin

gpstart #正常啟動

gpstop #正常關閉

gpstop -m fast #快速關閉

gpstop –r #重啟

#正常登陸

psql gpdb

psql -d gpdb -h gphostm -p 5432 -u gpadmin

#使用utility方式

pgoptions="-c gp_session_role=utility" psql -h -d dbname hostname -p port

#退出在psql命令列執行\q

psql -c 'show all;' -d gpdb

gpconfig --show max_connections

createdb -h localhost -p 5432 dhdw

# 檔案系統名

gpfsdw

# 子節點,視segment數建立目錄

mkdir -p /gpfsdw/seg1

mkdir -p /gpfsdw/seg2

chown -r gpadmin:gpadmin /gpfsdw

# 主節點

mkdir -p /gpfsdw/master

chown -r gpadmin:gpadmin /gpfsdw

gpfilespace -o gpfilespace_config

gpfilespace -c gpfilespace_config

psql gpdb

create tablespace tbs_dw_data filespace gpfsdw;

set default_tablespace = tbs_dw_data;

gpdeletesystem -d /gpmaster/gpseg-1 -f

select * from gp_segment_configuration;

select * from pg_filespace_entry;

select * from gp_toolkit.gp_disk_free order by dfsegment;

select * from gp_toolkit.gp_size_of_database order by sodddatname;

select * from gp_toolkit.__gp_log_master_ext;

select * from gp_toolkit.__gp_log_segment_ext;

/d+

vacuum analyze tablename;

select gp_segment_id, count(*) from group by gp_segment_id;

select relname as name, sotdsize/1024/1024 as size_mb, sotdtoastsize as toast, sotdadditionalsize as other

from gp_toolkit.gp_size_of_table_disk as sotd, pg_class

where sotd.sotdoid = pg_class.oid order by relname;

select soisize/1024/1024 as size_mb, relname as indexname

from pg_class, gp_toolkit.gp_size_of_index

where pg_class.oid = gp_size_of_index.soioid

and pg_class.relkind='i';

select schemaname as schema, objname as table, usename as role, actionname as action, subtype as type, statime as time

from pg_stat_operations

where objname = '';

select locktype, database, c.relname, l.relation, l.transactionid, l.transaction, l.pid, l.mode, l.granted, a.current_query

from pg_locks l, pg_class c, pg_stat_activity a

where l.relation=c.oid

and l.pid=a.procpid

order by c.relname;

select * from pg_resqueue_status;

# 啟動服務

gpfdist -d /share/txt -p 8081 –l /share/txt/gpfdist.log &

# 建立外部表,分隔符為』/t』

ip         text,

accesstime text,

reqmethod  text,

url        text,

statuscode int,

ref        text,

name       text,

vid        text)

location ('gpfdist://gphostm:8081/***.txt')

format 'text' (delimiter e'/t'

fill missing fields) segment reject limit 1 percent;

# 建立普通表

# 索引

# create index idx_test on test using bitmap (ip);

# 查詢資料

select ip , count(*) from test group by ip order by count(*);

# 建立控制檔案

# 載入資料

gpload -f my_load.yml

copy country from '/data/gpdb/country_data'

with delimiter '|' log errors into err_country

segment reject limit 10 rows;

# 建立可寫外部表

create writable external table unload_expenses

( like expenses )

location ('gpfdist://etlhost-1:8081/expenses1.out',

'gpfdist://etlhost-2:8081/expenses2.out')

format 'text' (delimiter ',')

distributed by (exp_id);

# 寫許可權

grant insert on writable_ext_table to ;

# 寫資料

insert into writable_ext_table select * from regular_table;

copy (select * from country where country_name like 'a%') to '/home/gpadmin/a_list_countries.out';

psql gpdbname –f yoursqlfile.sql

或者psql登陸後執行

\i yoursqlfile.sql

Greenplum安裝手冊

gp安裝手冊 問題補充 問題一 root使用者登入,檢視selinuxstatus sestatus 如果不是disabled,則需要修改引數 vi etc selinux config 修改 selinux disabled 關閉防火牆 因為是centos7,預設防火牆為firewall,先檢視 ...

KVM簡明手冊

kvm是乙個基於linux核心的虛擬機器解決方案。本文介紹kvm的使用方法,以及注意要點。linux brctl 先決條件 硬體環境 cpu硬體虛擬化 32位與64位 安裝kvm 虛擬機器連網 brctl橋接 安裝以及執行虛擬機器 kvm常用命令 安裝虛擬作業系統 遠端登入 x86 包括32位和64...

sqlite簡明手冊

建立資料庫檔案 用sqlite3建立資料庫的方法很簡單,只要在shell下鍵入 以下 符號為shell提示號,請勿鍵入 sqlite3 foo.db 在sqlite3提示列下操作 進入了sqlite3之後,會看到以下文字 sqlite version 3.1.3enter help for inst...