数据仓库服务 GAUSSDB(DWS)-CREATE SERVER:示例

时间:2024-09-24 15:54:40

示例

建立一个hdfs_server,其中hdfs_fdw为数据库中存在的foreign data wrapper:

1
2
3
4
5
CREATE SERVER hdfs_server FOREIGN DATA WRAPPER HDFS_FDW OPTIONS 
   (address '10.10.0.100:25000,10.10.0.101:25000',
    hdfscfgpath '/opt/hadoop_client/HDFS/hadoop/etc/hadoop', 
    type 'HDFS'
) ;

建立一个obs_server,其中dfs_fdw为数据库中存在的foreign data wrapper:

1
2
3
4
5
6
CREATE SERVER obs_server FOREIGN DATA WRAPPER DFS_FDW OPTIONS ( 
  address 'obs.cn-north-1.myhuaweicloud.com', 
   access_key 'xxxxxxxxx', 
  secret_access_key 'yyyyyyyyyyyyy', 
  type 'obs'
);

建立一个dli_server,其中dfs_fdw为数据库中存在的foreign data wrapper:

1
2
3
4
5
6
7
8
9
CREATE SERVER dli_server FOREIGN DATA WRAPPER DFS_FDW OPTIONS ( 
  address 'obs.cn-north-1.myhuaweicloud.com', 
  access_key 'xxxxxxxxx', 
  secret_access_key 'yyyyyyyyyyyyy', 
  type 'dli',
  dli_address 'dli.example.com',
  dli_access_key 'xxxxxxxxx',
  dli_secret_access_key 'yyyyyyyyyyyyy'
);

建立另外一个同构集群的server,其中gc_fdw为数据库中存在的foreign data wrapper:

1
2
3
4
5
6
CREATE SERVER server_remote FOREIGN DATA WRAPPER GC_FDW OPTIONS 
   (address '10.10.0.100:25000,10.10.0.101:25000',
  dbname 'test', 
  username 'test', 
  password 'xxxxxxxx'
);

建立一个FOREIGN DATA WRAPPER为dist_fdw的server,用于obs上文本数据的导入导出:

1
2
3
4
5
CREATE SERVER import_server FOREIGN DATA WRAPPER DIST_FDW OPTIONS 
(
  access_key 'ak_string',
  secret_access_key 'sk_string'
);
support.huaweicloud.com/sqlreference-910-dws/dws_06_0175.html