将数据从HDFS上导入到Greenplum

时间:2022-05-03 22:49:56
    CREATE READABLE EXTERNAL TABLE weblogs(  
md5 text,
url text,
request_date date,
request_time time,
ip inet
)
LOCATION ('gphdfs://<NAMENODE_HOST>:<NAMENODE_PORT>/data/weblogs/
weblog_ entries.txt')
FORMAT 'TEXT' (DELIMITER '\t')
SEGMENT REJECT LIMIT 9999;

外部表创建完成;


create table hdfs01(
id text,
str text
)
DISTRIBUTED  RANDOMLY;
创建Greenplum表


装载数据:

insert into hdfs01 select * from ext01;


之前要根据这个页面描述的修改两个参数:

http://gpdb.docs.pivotal.io/4390/admin_guide/load/topics/g-one-time-hdfs-protocol-installation.html

gpconfig -c gp_hadoop_target_version -v "'gphd-2.0'"
gpconfig -c gp_hadoop_home -v "'/usr/lib/gphd'"
gpstop -u