----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [gpadmin@g01~]$ gpload -? gpload [options] -f configuration file Options: -h hostname: host to connect to -p port: port to connect to -U username: user to connect as -d database: database to connect to -W: force password authentication -q: quiet mode -D: do not actually load data -v: verbose -V: very verbose -l logfile: log output to logfile --no_auto_trans: do not wrap gpload in transaction --gpfdist_timeout timeout: gpfdist timeout value --version: print version number and exit -?: help [gpadmin@g01~]$ |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- create SEQUENCE gpload_audit_seq INCREMENT BY 1 MINVALUE 1 NO MAXVALUE START WITH 1; select * from gpload_audit_seq ; |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- create table gpload_audit( id bigint, state text, mode text, tablename text, updatetime timestamp ) distributed by (id); |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- CREATE TABLE expenses ( name text, amount numeric, category text, des text, update_date date ); |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [gpadmin@g01gpdextdata]$ more t21.txt 1|aaa 2|zhangsan [gpadmin@g01gpdextdata]$ [gpadmin@g01gpdextdata]$ more t22.txt 3|wanger 4|mazi [gpadmin@g01gpdextdata]$ |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- create table t02 ( id integer, name varchar(128) ) location ( 'gpfdist://192.168.2.72:8090/gpextdata/t21.txt', 'gpfdist://192.168.2.72:8090/gpextdata/t22.txt' ) Format 'TEXT' (delimiter as E'|' null as '' escape 'OFF') ; |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [gpadmin@g01~]$ more g2.yml --- VERSION: 1.0.0.1 DATABASE: yueworld_db USER: mch HOST: 10.254.2.111 PORT: 5432 GPLOAD: INPUT: - SOURCE: LOCAL_HOSTNAME: - 192.168.2.72 PORT: 8090 FILE: - /data/greenplum/gpextdata/t21.txt - /data/greenplum/gpextdata/t22.txt - COLUMNS: - id: int - name: text - FORMAT: text - DELIMITER: '|' - ERROR_LIMIT: 25 OUTPUT: - TABLE: dw.t02 - MODE: INSERT SQL: - BEFORE: "INSERT INTO gpload_audit VALUES(nextval('gpload_audit_seq'), 'start', 'insert', 'zhangyun_schema.expenses', current_timestamp)" - AFTER: "INSERT INTO gpload_audit VALUES(nextval('gpload_audit_seq'), 'end', 'insert', 'zhangyun_schema.expenses', current_timestamp)" [gpadmin@g01~]$ |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- yueworld_db=# grant select,insert on gpload_audit to mch; GRANT yueworld_db=# grant select,insert,update,delete on t01 to mch; GRANT yueworld_db=# yueworld_db=# grant select,usage,update on gpload_audit_seq to mch; GRANT yueworld_db=# grant all on table t02 to mch; GRANT yueworld_db=# |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [gpadmin@g01~]$ gpload -f g2.yml 2017-05-15 17:52:30|INFO|gpload session started 2017-05-15 17:52:30 2017-05-15 17:52:30|INFO|setting schema 'public' for table 't02' 2017-05-15 17:52:30|INFO|started gpfdist -p 8090 -P 8091 -f "/data/greenplum/gpextdata/t21.txt /data/greenplum/gpextdata/t22.txt" -t 30 2017-05-15 17:52:30|INFO|running time: 0.29 seconds 2017-05-15 17:52:30|INFO|rows Inserted = 4 2017-05-15 17:52:30|INFO|rows Updated = 0 2017-05-15 17:52:30|INFO|data formatting errors = 0 2017-05-15 17:52:30|INFO|gpload succeeded [gpadmin@g01~]$ |
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- yueworld_db=# select * from public.t01_ext_1;; id | name ----+------ 1 | aaa 2 | zhangsan 3 | wanger 4 | mazi (8 rows) yueworld_db=# |
[gpadmin@g01~]$ gpload -f g2.yml 2017-05-15 17:52:30|INFO|gpload session started 2017-05-15 17:52:30 2017-05-15 17:52:30|INFO|setting schema 'public' for table 't02' 2017-05-15 17:52:30|INFO|started gpfdist -p 8090 -P 8091 -f "/data/greenplum/gpextdata/t21.txt /data/greenplum/gpextdata/t22.txt" -t 30 2017-05-15 17:52:30|INFO|running time: 0.29 seconds 2017-05-15 17:52:30|INFO|rows Inserted = 8 2017-05-15 17:52:30|INFO|rows Updated = 0 2017-05-15 17:52:30|INFO|data formatting errors = 0 2017-05-15 17:52:30|INFO|gpload succeeded [gpadmin@g01~]$ |
欢迎光临 168大数据 (http://www.bi168.cn/) | Powered by Discuz! X3.2 |