提示时出错:如何在GPDB中创建基于用户的新文件空间

时间:2016-06-15 15:50:35

标签: postgresql greenplum hawq

我们有一个小的gpdb集群。当我尝试创建基于新用户的文件空间时。 那是 调用gpfilespace实用程序

$ gpfilespace -o gpfilespace_config

在提示时出现以下错误:在创建文件空间时。

[gpadmin@mdw dfs]$ gpfilespace -o gpfilespace_config
20160615:15:17:07:027941 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.

20160615:15:17:07:027941 gpfilespace:mdw:gpadmin-[INFO]:-getting config
Enter a name for this filespace
> dfs_system

Checking your configuration:
Your system has 2 hosts with 1 primary and 1 mirror segments per host.
Your system has 2 hosts with 0 primary and 0 mirror segments per host.

Configuring hosts: [datanode1, datanode2]

Please specify 1 locations for the primary segments, one per line:
primary location 1> /data/primary/dfs/gpseg1
[Error]datanode2: /data/primary/dfs/gpseg1 : No such file or directory

我尝试了不同的方法,但用户文件空间没有创建。

对此有任何帮助将不胜感激?

1 个答案:

答案 0 :(得分:1)

这个例子是我很久以前发给客户的一个使用单节点VM的例子。

gpadmin$ mkdir /user
gpadmin$ cd data
gpadmin$ gpfilespace -o .
[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.

[INFO]:-getting config
Enter a name for this filespace
> userspace

Checking your configuration:
Your system has 1 hosts with 2 primary and 0 mirror segments per host.

Configuring hosts: [jonnymac]

Please specify 2 locations for the primary segments, one per line:
primary location 1> /user
primary location 2> /user

Enter a file system location for the master
master location> /user
gpfilespace:jonnymac:gpadmin-[INFO]:-Creating configuration file...
gpfilespace:jonnymac:gpadmin-[INFO]:-[created]
gpfilespace:jonnymac:gpadmin-[INFO]:-

gpadmin$ gpfilespace --config ./gpfilespace_config_xxxxxxxx_xxxxxx
[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.

[INFO]:-getting config
[INFO]:-Connecting to database
[INFO]:-Filespace "userspace" successfully created

在单个节点的此示例中,主节点和段位于/ user中。 gpseg-1是主人,gpseg [0-1]是分段。你可以在这里看到:

gpadmin$ cd /user
gpadmin$ ls -la
total 0
drwxr-xr-x   5 gpadmin  admin   170 Oct 11 10:29 .
drwxrwxr-t  33 root     admin  1190 Oct 11 10:20 ..
drwx------   2 gpadmin  admin    68 Oct 11 10:29 gpseg-1
drwx------   2 gpadmin  admin    68 Oct 11 10:29 gpseg0
drwx------   2 gpadmin  admin    68 Oct 11 10:29 gpseg1
gpadmin$ psql
psql (8.2.15)
Type "help" for help.

现在您可以创建一个使用此文件空间的表空间。

gpdb=# create tablespace usertablespace filespace userspace;
CREATE TABLESPACE
gpdb=# select * from pg_tablespace;
spcname     | spcowner | spclocation | spcacl | spcprilocations | spcmirlocations | spcfsoid
----------------+----------+-------------+--------+-----------------+-----------------+----------
pg_default     |       10 |             |        |                 |                 |     3052
pg_global      |       10 |             |        |                 |                 |     3052
usertablespace |       10 |             |        |                 |                 |   271611
(3 rows)

gpdb=# \q