Search code examples
postgresqlgreenplumhawq

How do i create and read External table in GPDB


We have small gpdb cluster. When i am trying to create and read on my first External table using gpfdist protocol.

Getting error at reading of external table : that is

prod=# select * from ext_table
prod-# ;
ERROR:  connection with gpfdist failed for gpfdist://gpmasterhost:8080/demo/gp_RevenueReport_stg0.txt. effective url: http://gpmasterhost:8080/demo/gp_RevenueReport_stg0.txt. error code = 111 (Connection refused)  (seg0 slice1 datanode2 40000 pid=5402)
prod=#

We tried DDL command for external table :

CREATE EXTERNAL TABLE ext_table
(
  "ID" bigint,
  "time" timestamp without time zone,
   )
 LOCATION (
    'gpfdist://gpmasterhost:8080/demo/gp_RevenueReport_stg0.txt'
)
 FORMAT 'TEXT' (delimiter ';' null '' escape '~' )
ENCODING 'UTF8';

Any help on it would be much appreciated !


Solution

  • You have to create the gpfdist process on "gpmasterhost" listening on port 8080 and serving files that include the directory demo which contains gp_RevenueReport_stg0.txt.

    gpfdist -p 8080 -d path_to_demo &