Search code examples
postgresqlgreenplumhawq

Error at Prompt:How Do I create New user based Filespace in GPDB


We have small gpdb cluster. When i am trying to create New user based Filespace. that is Calling gpfilespace utility

$gpfilespace -o gpfilespace_config

Getting following error at prompt:At the time of creation of filespace .

[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

I have tried different ways but user file space is not creating.

Any help on it would be much appreciated ?


Solution

  • This example is one I sent to a customer a long time ago which is using a single node 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
    

    In this example of a single node, the master and segments are in /user. gpseg-1 is the master and gpseg[0-1] are the segments. You can see that here:

    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.
    

    Now you can create a tablespace that uses this filespace.

    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