开发反馈在使用外部表的时候遇到ERROR: http response code 404错误,经过测试和模拟得以解决。 首先模拟下问题: [gpadmin@gtlions50 ~]$ psql gtlions psql (8.2.15) Type help for help. gtlions=# drop external table ext_rt_recv_msg_gprs; ERROR: tabl
开发反馈在使用外部表的时候遇到ERROR: http response code 404错误,经过测试和模拟得以解决。
首先模拟下问题:
[gpadmin@gtlions50 ~]$ psql gtlions
psql (8.2.15)
Type "help" for help.
gtlions=# drop external table ext_rt_recv_msg_gprs;
ERROR: table "ext_rt_recv_msg_gprs" does not exist
gtlions=# drop table ext_err_rt_recv_msg_gprs;
ERROR: table "ext_err_rt_recv_msg_gprs" does not exist
gtlions=# create external table ext_rt_recv_msg_gprs
gtlions-# ( recv_time timestamp,
gtlions(# trigger_type int,
gtlions(# rating_group bigint,
gtlions(# session_id varchar(80),
gtlions(# mscc_count int )
gtlions-# location
gtlions-# ( 'gpfdist://192.168.56.10:8081/1/*',
gtlions(# 'gpfdist://192.168.56.10:8081/2/*' )
gtlions-# format 'text' ( delimiter '|' null '')
gtlions-# encoding 'gbk'
gtlions-# log errors into ext_err_rt_recv_msg_gprs
gtlions-# segment reject limit 100 percent;
NOTICE: Error table "ext_err_rt_recv_msg_gprs" does not exist. Auto generating an error table with the same name
CREATE EXTERNAL TABLE
gtlions=# select * from ext_rt_recv_msg_gprs;
ERROR: http response code 404 from gpfdist (gpfdist://192.168.56.10:8081/2/*): HTTP/1.0 404 file not found (url.c:326) (seg1 slice1 gtlions52:40001 pid=2584) (cdbdisp.c:1476)
经过测试,使用linux网络工具是可以正确获取到文件的,因此怀疑是SQL语句有问题,尝试如下:
gtlions=# drop external table ext_rt_recv_msg_gprs;
DROP EXTERNAL TABLE
gtlions=# drop table ext_err_rt_recv_msg_gprs;
DROP TABLE
gtlions=# drop external table if exists ext_rt_recv_msg_gprs;
NOTICE: table "ext_rt_recv_msg_gprs" does not exist, skipping
DROP EXTERNAL TABLE
gtlions=# drop table if exists ext_err_rt_recv_msg_gprs;
NOTICE: table "ext_err_rt_recv_msg_gprs" does not exist, skipping
DROP TABLE
gtlions=# create external table ext_rt_recv_msg_gprs
gtlions-# ( recv_time timestamp,
gtlions(# trigger_type int,
gtlions(# rating_group bigint,
gtlions(# session_id varchar(80),
gtlions(# mscc_count int )
gtlions-# location
gtlions-# ( 'gpfdist://192.168.56.10:8081/*/*')
gtlions-# format 'text' ( delimiter '|' null '')
gtlions-# encoding 'gbk'
gtlions-# log errors into ext_err_rt_recv_msg_gprs
gtlions-# segment reject limit 100 percent;
NOTICE: Error table "ext_err_rt_recv_msg_gprs" does not exist. Auto generating an error table with the same name
CREATE EXTERNAL TABLE
gtlions=# select * from ext_rt_recv_msg_gprs;
recv_time | trigger_type | rating_group | session_id | mscc_count
----------------------------+--------------+--------------+---------------------------+------------
2014-03-24 23:59:56.123456 | 251 | 25111 | 25tst_ext_data_table row1 | 503001
2014-03-25 16:11:36.123 | 252 | 25222 | 25tst_ext_data_table row2 | 503002
2014-03-25 16:11:36 | 253 | 25333 | 25tst_ext_data_table row3 | 503003
2014-03-25 16:11:36.123456 | 254 | 25444 | 25tst_ext_data_table row4 | 503004
2014-03-25 16:11:36.223456 | 255 | 25555 | 25tst_ext_data_table row5 | 503005
2014-03-25 16:11:36.323456 | 256 | 25666 | 25tst_ext_data_table row6 | 503006
2014-03-25 00:00:00 | 257 | 25777 | 25tst_ext_data_table row7 |
(7 rows)
gtlions=# drop external table if exists ext_rt_recv_msg_gprs;
DROP EXTERNAL TABLE
gtlions=# drop table if exists ext_err_rt_recv_msg_gprs;
DROP TABLE
gtlions=# create external table ext_rt_recv_msg_gprs
gtlions-# ( recv_time timestamp,
gtlions(# trigger_type int,
gtlions(# rating_group bigint,
gtlions(# session_id varchar(80),
gtlions(# mscc_count int )
gtlions-# location
gtlions-# ( 'gpfdist://192.168.56.10:8081/*')
gtlions-# format 'text' ( delimiter '|' null '')
gtlions-# encoding 'gbk'
gtlions-# log errors into ext_err_rt_recv_msg_gprs
gtlions-# segment reject limit 100 percent;
NOTICE: Error table "ext_err_rt_recv_msg_gprs" does not exist. Auto generating an error table with the same name
CREATE EXTERNAL TABLE
gtlions=# select * from ext_rt_recv_msg_gprs;
recv_time | trigger_type | rating_group | session_id | mscc_count
----------------------------+--------------+--------------+---------------------------+------------
2014-03-24 23:59:56.123456 | 251 | 25111 | 25tst_ext_data_table row1 | 503001
2014-03-25 16:11:36.123 | 252 | 25222 | 25tst_ext_data_table row2 | 503002
2014-03-25 16:11:36 | 253 | 25333 | 25tst_ext_data_table row3 | 503003
2014-03-25 16:11:36.123456 | 254 | 25444 | 25tst_ext_data_table row4 | 503004
2014-03-25 16:11:36.223456 | 255 | 25555 | 25tst_ext_data_table row5 | 503005
2014-03-25 16:11:36.323456 | 256 | 25666 | 25tst_ext_data_table row6 | 503006
2014-03-25 00:00:00 | 257 | 25777 | 25tst_ext_data_table row7 |
(7 rows)
ok了,问题解决了,原来是同一个url不能出现多次的原因。
-EOF-