greenplum維護

1.用戶管理
psql -d sea
CREATE DATABASE BI;
CREATE USER ubi WITH PASSWORD 'pwdbi' NOSUPERUSER;
GRANT ALL ON DATABASE BI TO ubi ;
2.表空間管理
--查看seg分佈
select gp_segment_id,count(1) from faq_logs group by 1;
--查看錶佔用空間大小
select pg_size_pretty(pg_relation_size('faq_logs')) ;
 
--表佔用空間
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';
 
 
3.節點恢復
當一臺segment機器壞了,而後機器又恢復了,或某一個segment數據庫停了
只須要運行gprecoverseg,就能夠把segment恢復過來:
gprecoverseg
運行gprecoverseg以後,須要運行gpstate -m查看同步是否都完成了。
 
-4 segment(s) configured as mirror(s) are acting as primaries
咱們看到數據同步已經完成,可是角色尚未轉換過來,須要使用gprecoverseg -r進行角色切換
 
Recover Segments
gprecoverseg -r
相關文章
相關標籤/搜索