南大通用GBase 8a集群导出数据到sftp需要使用绝对路径

sftp不支持相对路径,必须使用绝对路径才可以。 而ftp协议默认是当前用户的相对路径。

gbase> select * from t1 into outfile 'sftp://gbase:gbase@192.168.174.61/home/gbase/123.txt' writemode by overwrites;
Query OK, 4 rows affected (Elapsed: 00:00:00.26)

gbase> system cat /home/gbase/123.txt
1
2
1
2
gbase> select * from t1 into outfile 'sftp://gbase:gbase@192.168.174.61/home/gbase/123.txt' writemode by overwrites with head;
Query OK, 4 rows affected (Elapsed: 00:00:00.34)

gbase> system cat /home/gbase/123.txt
id
1
2
1
2
gbase> 

gbase> select * from t into outfile 'ftp://gbase:gbase1234@192.168.174.181/t2_1_ftp.txt' fields terminated by ','  writemode by overwrites;
Query OK, 1 row affected (Elapsed: 00:00:00.08)

gbase> system ls /home/gbase -l;
total 388768
-rw-rw-r-- 1 gbase gbase        4 Jan 10 15:34 a.txt
-rw-rw-r-- 1 gbase gbase    10918 Apr  8 12:02 create.sql
-rw-rw-r-- 1 gbase gbase     6659 Apr  8 13:31 data_1.txt
-rw-rw-r-- 1 gbase gbase 66602961 Apr  8 12:02 data.txt
drwx------ 2 gbase gbase       20 Jan 10 20:27 dba.out
drwxrwxr-x 3 gbase gbase     4096 May  6 14:41 gcinstall
-rw-r--r-- 1 root  root  76122863 Jan 10 10:12 gcluster_backup_20190110101138.tar.bz2
-rw-r--r-- 1 root  root  85046400 Feb 13 11:17 gcluster_backup_20190213111647.tar.bz2
-rw-r--r-- 1 root  root  85098145 Feb 13 11:38 gcluster_backup_20190213113805.tar.bz2
-rw-r--r-- 1 root  root  85066976 May  5 13:17 gcluster_backup_20190505131716.tar.bz2
drwxrwxr-x 3 gbase gbase     4096 May  5 14:40 loader_logs
-rw-r--r-- 1 root  root      3050 May  6 13:26 ls
-rw-r--r-- 1 root  root     22393 May  6 13:27 ls_0
-rw-r--r-- 1 root  root     13133 May  6 13:27 ls1
drwx------ 2 gbase gbase       21 Jan 10 20:28 mask.out
drwxrwxr-x 2 gbase gbase        6 Dec 27 10:05 perl5
drwxr-xr-x 2 gbase gbase       19 May  5 13:35 t1.txt
drwxr-xr-x 2 gbase gbase       25 May  9 12:13 t2_1_ftp.txt
drwxr-xr-x 2 gbase gbase       21 May  9 12:13 t2_1.txt
-rw-rw-r-- 1 gbase gbase        2 May  9 12:10 t2_2.txt
drwx------ 2 gbase gbase       19 Jan 10 10:31 t2.txt
-rw-rw-r-- 1 gbase gbase    29700 Apr  8 12:56 testload.1w.log
-rw-rw-r-- 1 gbase gbase    29000 Apr  8 13:59 testload.log
-rw-rw-r-- 1 gbase gbase      222 Apr  8 13:32 testload.sh
drwx------ 2 gbase gbase       18 Jan 10 10:28 t.txt
gbase> select * from t into outfile 'ftp://gbase:gbase1234@192.168.174.181//opt/gbase/t2_1_ftp_abs.txt' fields terminated by ','  writemode by overwrites;
Query OK, 1 row affected (Elapsed: 00:00:00.08)

gbase> system ls -l /opt/gbase
total 0
drwxr-xr-x 7 gbase gbase 71 May  6 14:41 gcluster
drwxrwxr-x 3 gbase gbase 21 Dec 27 10:05 gc_userdata
drwxr-xr-x 7 gbase gbase 71 May  6 14:41 gnode
drwxrwxr-x 3 gbase gbase 18 Dec 27 10:05 gnode_userdata
drwxr-xr-x 2 gbase gbase 29 May  9 12:14 t2_1_ftp_abs.txt
gbase>