[DISK]/hadoop/hdfs/data,[SSD]/hadoop/hdfs/ssd
在所有的数据节点上挂载ssd盘到路径/hadoop/hdfs/ssd下
并保证/hadoop/hdfs/ssd路径的owner为hdfs:hadoop
drwxr-x--- 3 hdfs hadoop 4096 Oct 17 19:10 /hadoop/hdfs/ssd
重启数据节点
hdfs dfs -mkdir /ssd
hdfs storagepolicies -setStoragePolicy -path /ssd-policy ALL_SSD
$hawq filespace -o tpc_h_config
filespace:fs_tpc_h
fsreplica:3
dfs_url::mycluster/ssd/fs_tpc_h
$hdfs dfs -mkdir /ssd
$hdfs dfs -chown gpadmin:gpadmin /ssd
$hdfs dfs -ls /
$hawq filespace -c tpc_h_config
psql
create tablespace ts_tpc_h filespace fs_tpc_h;
SELECT spcname AS tblspc, fsname AS filespc,
fsedbid AS seg_dbid, fselocation AS datadir
FROM pg_tablespace pgts, pg_filespace pgfs,
pg_filespace_entry pgfse
WHERE pgts.spcfsoid=pgfse.fsefsoid
AND pgfse.fsefsoid=pgfs.oid
ORDER BY tblspc, seg_dbid;
create table region(
r_regionkey integer,
r_name char(25),
r_comment varchar(152),
r_extra char(1)
)with(appendonly=true,orientation=parquet,compresstype=snappy)
tablespace ts_tpc_h
distributed by(r_regionkey) ;
select c.relname, d.dat2tablespace tablespace_id, d.oid database_id, c.relfilenode table_id
from pg_database d, pg_class c, pg_namespace n
where c.relnamespace = n.oid
and d.datname = current_database()
and n.nspname = 'qbyps'
and c.relname = 'p';
SELECT pgfs.oid fs_id,pgts.oid ts_id, spcname AS tblspc, fsname AS filespc,
fsedbid AS seg_dbid, fselocation AS datadir
FROM pg_tablespace pgts, pg_filespace pgfs,
pg_filespace_entry pgfse
WHERE pgts.spcfsoid=pgfse.fsefsoid
AND pgfse.fsefsoid=pgfs.oid
ORDER BY tblspc, seg_dbid;
HAWQ使用libhdfs3.so的API访问HDFS,目前不支持存储策略。因此,需要对写入后的数据进行维护。
hdfs mover -p /ssd/fs_tpc_h
存储策略命令
列出所有存储策略
hdfs storagepolicies -listPolicies
设置存储策略
hdfs storagepolicies -setStoragePolicy -path <path> -policy <policy>
例如
hdfs storagepolicies -setStoragePolicy -path /tmp -policy ALL_SSD
取消存储策略
hdfs storagepolicies -unsetStoragePolicy -path <path>
之后该目录或者文件,以其上级的目录为准,如果是根目录,那么就是HOT
获取存取策略
hdfs storagepolicies -getStoragePolicy -path <path>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。