文件空间和目录
testdb=# select oid,* from pg_filespace;
oid | fsname | fsowner
------+-----------+---------
3052 | pg_system | 10
(1 row)
testdb=# select * from pg_filespace_entry;
fsefsoid | fsedbid | fselocation
----------+---------+-----------------------
3052 | 1 | /data/master/gpseg-1
3052 | 2 | /data1/primary/gpseg0
(2 rows)
^
testdb=# 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;
tblspc | filespc | seg_dbid | datadir
------------+-----------+----------+-----------------------
pg_default | pg_system | 1 | /data/master/gpseg-1
pg_default | pg_system | 2 | /data1/primary/gpseg0
pg_global | pg_system | 1 | /data/master/gpseg-1
pg_global | pg_system | 2 | /data1/primary/gpseg0
(4 rows)
创建新的文件空间及表空间
多节点可以使用这个命令去创建
[gpadmin@mdw data]$ gpssh -f /home/gpadmin/seg_host
先创建文件目录:
[gpadmin@mdw /]$ mkdir /data/user_spc
[gpadmin@mdw /]$ mkdir /data1/user_spc
[gpadmin@mdw /]$ mkdir /data/user_spc/master/
[gpadmin@mdw /]$ mkdir /data1/user_spc/primary/
创建一个配置文件:
[gpadmin@mdw data]$ gpfilespace -o gpfilespace_test
20160807:02:10:24:003377 gpfilespace:mdw:gpadmin-[INFO]:-
A tablespace requires a file system location to store its database
files. A filespace is a collection of file system locations for all components
in a Greenplum system (primary segment, mirror segment and master instances).
Once a filespace is created, it can be used by one or more tablespaces.
20160807:02:10:24:003377 gpfilespace:mdw:gpadmin-[INFO]:-getting config
Enter a name for this filespace
> gpfilespace_test
Checking your configuration:
Your system has 1 hosts with 1 primary and 0 mirror segments per host.
Configuring hosts: [localhost.localdomain]
Please specify 1 locations for the primary segments, one per line:
testdb=# select oid,* from pg_filespace;
oid | fsname | fsowner
------+-----------+---------
3052 | pg_system | 10
(1 row)
testdb=# select * from pg_filespace_entry;
fsefsoid | fsedbid | fselocation
----------+---------+-----------------------
3052 | 1 | /data/master/gpseg-1
3052 | 2 | /data1/primary/gpseg0
(2 rows)
^
testdb=# 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;
tblspc | filespc | seg_dbid | datadir
------------+-----------+----------+-----------------------
pg_default | pg_system | 1 | /data/master/gpseg-1
pg_default | pg_system | 2 | /data1/primary/gpseg0
pg_global | pg_system | 1 | /data/master/gpseg-1
pg_global | pg_system | 2 | /data1/primary/gpseg0
(4 rows)
创建新的文件空间及表空间
多节点可以使用这个命令去创建
[gpadmin@mdw data]$ gpssh -f /home/gpadmin/seg_host
先创建文件目录:
[gpadmin@mdw /]$ mkdir /data/user_spc
[gpadmin@mdw /]$ mkdir /data1/user_spc
[gpadmin@mdw /]$ mkdir /data/user_spc/master/
[gpadmin@mdw /]$ mkdir /data1/user_spc/primary/
创建一个配置文件:
[gpadmin@mdw data]$ gpfilespace -o gpfilespace_test
20160807:02:10:24:003377 gpfilespace:mdw:gpadmin-[INFO]:-
A tablespace requires a file system location to store its database
files. A filespace is a collection of file system locations for all components
in a Greenplum system (primary segment, mirror segment and master instances).
Once a filespace is created, it can be used by one or more tablespaces.
20160807:02:10:24:003377 gpfilespace:mdw:gpadmin-[INFO]:-getting config
Enter a name for this filespace
> gpfilespace_test
Checking your configuration:
Your system has 1 hosts with 1 primary and 0 mirror segments per host.
Configuring hosts: [localhost.localdomain]
Please specify 1 locations for the primary segments, one per line: