HDFSマッピングの複数セットoushuDBスキーム
文書ディレクトリ
HAWQ version postgres=# select version();
version
-------------------------------------------------------------------------------------------------------------
PostgreSQL 8.2.15 (OushuDB 4.1.0.0 build 25055 Enterprise Edition)
(Apache HAWQ 2.4.0.0) (Greenplum Database 4.2.0) on x86_64-unknown-linux-gnu, compiled by
GCC clang version 8.0.1 (tags/RELEASE_801/final) compiled on Sep 14 2020 04:56:54
(1 row)
実験前のファイル空間と表空間の状況 postgres=# select oid,* from pg_filespace;
oid | fsname | fsowner | fsfsys | fsrep
-------+------------+---------+--------+-------
3052 | pg_system | 10 | 0 | 0
16384 | dfs_system | 10 | 10932 | 0
(2 rows)
postgres=# select * from pg_filespace_entry ;
fsefsoid | fsedbid | fselocation
----------+---------+-------------------------------------
16384 | 0 | hdfs://oushu/hawq/default_filespace
(1 row)
postgres=# select * from pg_tablespace ;
spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------------+----------+-------------+--------+-----------------+-----------------+----------
pg_default | 10 | | | | | 3052
pg_global | 10 | | | | | 3052
dfs_default | 10 | | | | | 16384
(3 rows)
対応するファイルスペースストレージディレクトリの作成 hdfs dfs -mkdir /hawq_fpc01
hdfs dfs -chown -R gpadmin:hadoop /hawq_fpc01
hdfs dfs -ls /
ファイル領域と表領域の作成 CREATE FILESPACE hawq_fpc01 ON hdfs ('oushu/hawq_fpc01') WITH (NUMREPLICA = 3);
create TABLESPACE hawq_tpc01 FILESPACE hawq_fpc01;
実験後のファイル空間と表空間の状況 postgres=# select oid,* from pg_filespace;select * from pg_filespace_entry ;select * from pg_tablespace ;
oid | fsname | fsowner | fsfsys | fsrep
-------+------------+---------+--------+-------
3052 | pg_system | 10 | 0 | 0
16384 | dfs_system | 10 | 10932 | 0
22813 | hawq_fpc01 | 10 | 10932 | 3
(3 rows)
fsefsoid | fsedbid | fselocation
----------+---------+-------------------------------------
16384 | 0 | hdfs://oushu/hawq/default_filespace
22813 | 0 | hdfs://{replica=3}oushu/hawq_fpc01
(2 rows)
spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------------+----------+-------------+--------+-----------------+-----------------+----------
pg_default | 10 | | | | | 3052
pg_global | 10 | | | | | 3052
dfs_default | 10 | | | | | 16384
hawq_tpc01 | 10 | | | | | 22813
(4 rows)
テスト前のテーブルとデータの準備 create table tbs_hawq_tpc01(id int) tablespace hawq_tpc01;
create table tbs_default(id int) tablespace dfs_default;
postgres=# insert into tbs_hawq_tpc01 select generate_series(1,1000);
INSERT 0 1000
postgres=# insert into tbs_default select generate_series(1,1000);
INSERT 0 1000
ファイル領域と表領域テーブル間の関連付けをテストする postgres=# select count(*) from tbs_hawq_tpc01 a left join tbs_default b on a.id=b.id;
count
-------
1000
(1 row)
チェックリストの実際の格納場所 postgres=# select oid::regclass,reltablespace from pg_class where oid in ('public.tbs_hawq_tpc01'::regclass,'public.tbs_default'::regclass);
oid | reltablespace
----------------+---------------
tbs_hawq_tpc01 | 22814
tbs_default | 0
(2 rows)
postgres=# select oid,* from pg_tablespace ;
oid | spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------+-------------+----------+-------------+--------+-----------------+-----------------+----------
1663 | pg_default | 10 | | | | | 3052
1664 | pg_global | 10 | | | | | 3052
16385 | dfs_default | 10 | | | | | 16384
22814 | hawq_tpc01 | 10 | | | | | 22813
(4 rows)
postgres=#
postgres=# select version();
version
-------------------------------------------------------------------------------------------------------------
PostgreSQL 8.2.15 (OushuDB 4.1.0.0 build 25055 Enterprise Edition)
(Apache HAWQ 2.4.0.0) (Greenplum Database 4.2.0) on x86_64-unknown-linux-gnu, compiled by
GCC clang version 8.0.1 (tags/RELEASE_801/final) compiled on Sep 14 2020 04:56:54
(1 row)
postgres=# select oid,* from pg_filespace;
oid | fsname | fsowner | fsfsys | fsrep
-------+------------+---------+--------+-------
3052 | pg_system | 10 | 0 | 0
16384 | dfs_system | 10 | 10932 | 0
(2 rows)
postgres=# select * from pg_filespace_entry ;
fsefsoid | fsedbid | fselocation
----------+---------+-------------------------------------
16384 | 0 | hdfs://oushu/hawq/default_filespace
(1 row)
postgres=# select * from pg_tablespace ;
spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------------+----------+-------------+--------+-----------------+-----------------+----------
pg_default | 10 | | | | | 3052
pg_global | 10 | | | | | 3052
dfs_default | 10 | | | | | 16384
(3 rows)
対応するファイルスペースストレージディレクトリの作成 hdfs dfs -mkdir /hawq_fpc01
hdfs dfs -chown -R gpadmin:hadoop /hawq_fpc01
hdfs dfs -ls /
ファイル領域と表領域の作成 CREATE FILESPACE hawq_fpc01 ON hdfs ('oushu/hawq_fpc01') WITH (NUMREPLICA = 3);
create TABLESPACE hawq_tpc01 FILESPACE hawq_fpc01;
実験後のファイル空間と表空間の状況 postgres=# select oid,* from pg_filespace;select * from pg_filespace_entry ;select * from pg_tablespace ;
oid | fsname | fsowner | fsfsys | fsrep
-------+------------+---------+--------+-------
3052 | pg_system | 10 | 0 | 0
16384 | dfs_system | 10 | 10932 | 0
22813 | hawq_fpc01 | 10 | 10932 | 3
(3 rows)
fsefsoid | fsedbid | fselocation
----------+---------+-------------------------------------
16384 | 0 | hdfs://oushu/hawq/default_filespace
22813 | 0 | hdfs://{replica=3}oushu/hawq_fpc01
(2 rows)
spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------------+----------+-------------+--------+-----------------+-----------------+----------
pg_default | 10 | | | | | 3052
pg_global | 10 | | | | | 3052
dfs_default | 10 | | | | | 16384
hawq_tpc01 | 10 | | | | | 22813
(4 rows)
テスト前のテーブルとデータの準備 create table tbs_hawq_tpc01(id int) tablespace hawq_tpc01;
create table tbs_default(id int) tablespace dfs_default;
postgres=# insert into tbs_hawq_tpc01 select generate_series(1,1000);
INSERT 0 1000
postgres=# insert into tbs_default select generate_series(1,1000);
INSERT 0 1000
ファイル領域と表領域テーブル間の関連付けをテストする postgres=# select count(*) from tbs_hawq_tpc01 a left join tbs_default b on a.id=b.id;
count
-------
1000
(1 row)
チェックリストの実際の格納場所 postgres=# select oid::regclass,reltablespace from pg_class where oid in ('public.tbs_hawq_tpc01'::regclass,'public.tbs_default'::regclass);
oid | reltablespace
----------------+---------------
tbs_hawq_tpc01 | 22814
tbs_default | 0
(2 rows)
postgres=# select oid,* from pg_tablespace ;
oid | spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------+-------------+----------+-------------+--------+-----------------+-----------------+----------
1663 | pg_default | 10 | | | | | 3052
1664 | pg_global | 10 | | | | | 3052
16385 | dfs_default | 10 | | | | | 16384
22814 | hawq_tpc01 | 10 | | | | | 22813
(4 rows)
postgres=#
hdfs dfs -mkdir /hawq_fpc01
hdfs dfs -chown -R gpadmin:hadoop /hawq_fpc01
hdfs dfs -ls /
CREATE FILESPACE hawq_fpc01 ON hdfs ('oushu/hawq_fpc01') WITH (NUMREPLICA = 3);
create TABLESPACE hawq_tpc01 FILESPACE hawq_fpc01;
実験後のファイル空間と表空間の状況 postgres=# select oid,* from pg_filespace;select * from pg_filespace_entry ;select * from pg_tablespace ;
oid | fsname | fsowner | fsfsys | fsrep
-------+------------+---------+--------+-------
3052 | pg_system | 10 | 0 | 0
16384 | dfs_system | 10 | 10932 | 0
22813 | hawq_fpc01 | 10 | 10932 | 3
(3 rows)
fsefsoid | fsedbid | fselocation
----------+---------+-------------------------------------
16384 | 0 | hdfs://oushu/hawq/default_filespace
22813 | 0 | hdfs://{replica=3}oushu/hawq_fpc01
(2 rows)
spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------------+----------+-------------+--------+-----------------+-----------------+----------
pg_default | 10 | | | | | 3052
pg_global | 10 | | | | | 3052
dfs_default | 10 | | | | | 16384
hawq_tpc01 | 10 | | | | | 22813
(4 rows)
テスト前のテーブルとデータの準備 create table tbs_hawq_tpc01(id int) tablespace hawq_tpc01;
create table tbs_default(id int) tablespace dfs_default;
postgres=# insert into tbs_hawq_tpc01 select generate_series(1,1000);
INSERT 0 1000
postgres=# insert into tbs_default select generate_series(1,1000);
INSERT 0 1000
ファイル領域と表領域テーブル間の関連付けをテストする postgres=# select count(*) from tbs_hawq_tpc01 a left join tbs_default b on a.id=b.id;
count
-------
1000
(1 row)
チェックリストの実際の格納場所 postgres=# select oid::regclass,reltablespace from pg_class where oid in ('public.tbs_hawq_tpc01'::regclass,'public.tbs_default'::regclass);
oid | reltablespace
----------------+---------------
tbs_hawq_tpc01 | 22814
tbs_default | 0
(2 rows)
postgres=# select oid,* from pg_tablespace ;
oid | spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------+-------------+----------+-------------+--------+-----------------+-----------------+----------
1663 | pg_default | 10 | | | | | 3052
1664 | pg_global | 10 | | | | | 3052
16385 | dfs_default | 10 | | | | | 16384
22814 | hawq_tpc01 | 10 | | | | | 22813
(4 rows)
postgres=#
postgres=# select oid,* from pg_filespace;select * from pg_filespace_entry ;select * from pg_tablespace ;
oid | fsname | fsowner | fsfsys | fsrep
-------+------------+---------+--------+-------
3052 | pg_system | 10 | 0 | 0
16384 | dfs_system | 10 | 10932 | 0
22813 | hawq_fpc01 | 10 | 10932 | 3
(3 rows)
fsefsoid | fsedbid | fselocation
----------+---------+-------------------------------------
16384 | 0 | hdfs://oushu/hawq/default_filespace
22813 | 0 | hdfs://{replica=3}oushu/hawq_fpc01
(2 rows)
spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------------+----------+-------------+--------+-----------------+-----------------+----------
pg_default | 10 | | | | | 3052
pg_global | 10 | | | | | 3052
dfs_default | 10 | | | | | 16384
hawq_tpc01 | 10 | | | | | 22813
(4 rows)
create table tbs_hawq_tpc01(id int) tablespace hawq_tpc01;
create table tbs_default(id int) tablespace dfs_default;
postgres=# insert into tbs_hawq_tpc01 select generate_series(1,1000);
INSERT 0 1000
postgres=# insert into tbs_default select generate_series(1,1000);
INSERT 0 1000
ファイル領域と表領域テーブル間の関連付けをテストする postgres=# select count(*) from tbs_hawq_tpc01 a left join tbs_default b on a.id=b.id;
count
-------
1000
(1 row)
チェックリストの実際の格納場所 postgres=# select oid::regclass,reltablespace from pg_class where oid in ('public.tbs_hawq_tpc01'::regclass,'public.tbs_default'::regclass);
oid | reltablespace
----------------+---------------
tbs_hawq_tpc01 | 22814
tbs_default | 0
(2 rows)
postgres=# select oid,* from pg_tablespace ;
oid | spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------+-------------+----------+-------------+--------+-----------------+-----------------+----------
1663 | pg_default | 10 | | | | | 3052
1664 | pg_global | 10 | | | | | 3052
16385 | dfs_default | 10 | | | | | 16384
22814 | hawq_tpc01 | 10 | | | | | 22813
(4 rows)
postgres=#
postgres=# select count(*) from tbs_hawq_tpc01 a left join tbs_default b on a.id=b.id;
count
-------
1000
(1 row)
postgres=# select oid::regclass,reltablespace from pg_class where oid in ('public.tbs_hawq_tpc01'::regclass,'public.tbs_default'::regclass);
oid | reltablespace
----------------+---------------
tbs_hawq_tpc01 | 22814
tbs_default | 0
(2 rows)
postgres=# select oid,* from pg_tablespace ;
oid | spcname | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
-------+-------------+----------+-------------+--------+-----------------+-----------------+----------
1663 | pg_default | 10 | | | | | 3052
1664 | pg_global | 10 | | | | | 3052
16385 | dfs_default | 10 | | | | | 16384
22814 | hawq_tpc01 | 10 | | | | | 22813
(4 rows)
postgres=#