Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

GDS Practice Guide

Updated on 2024-11-08 GMT+08:00
  • Before installing GDS, ensure that the system parameters of the server where GDS is deployed are consistent with those of the database cluster.
  • Ensure the physical network works properly for communication between GDS and GaussDB(DWS). A 10GE network is recommended. The 1GE network cannot guarantee smooth communication between GDS and GaussDB(DWS), because it cannot bear the high-speed data transmission pressure and is prone to disconnection. To maximize the import rate of a single file, ensure that a 10GE network is used and the data disk group I/O rate is greater than the upper limit of the GDS single-core processing capability (about 400 MB/s).
  • Plan service deployment in advance. It is recommended that one or two GDSs be deployed on a RAID of a data server. It is recommended that the ratio of GDS quantity to DN quantity be in the range of 1:3 to 1:6. Do not deploy too many GDS processes on a loader. Deploy only one GDS process if an 1GE NIC is used, and no more than four GDS processes if a 10GE NIC is used.
  • Hierarchically divide the data directories for data imported and exported by GDS in advance. Do not put too many files under a data directory, and delete expired files in a timely manner.
  • Properly plan the character set of the target database. You are advised to use UTF8 instead of the SQL_ASCII characters which can easily incur mixed encoding. When exporting data using GDS, ensure that the character set of the foreign table is the same as that of the client. When importing data, ensure that the client and data file content use the same encoding method.
  • If the character set of the database, client, or foreign table cannot be changed, run the iconv command to manually change the character set.
    1
    2
    #Note: -f indicates the character set of the source file, and -t indicates the target character set.
    iconv -f utf8 -t gbk utf8.txt -o gbk.txt
    
  • For details about GDS import practices, see Using GDS to Import Data.

  • GDS supports CSV, TEXT, and FIXED formats. The default format is TEXT. The binary format is not supported. However, the encode/decode function can be used to process data of the binary type. Example:

    Export a binary table.
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    -- Create a table.
    CREATE TABLE blob_type_t1 
    (
        BT_COL BYTEA
    ) DISTRIBUTE BY REPLICATION;
    -- Create a foreign table.
    CREATE FOREIGN TABLE f_blob_type_t1( BT_COL  text ) SERVER gsmpp_server OPTIONS (LOCATION 'gsfs://127.0.0.1:7789/', FORMAT 'text', DELIMITER E'\x08',  NULL '', EOL '0x0a' ) WRITE ONLY;
    INSERT INTO blob_type_t1 VALUES(E'\\xDEADBEEF');
    INSERT INTO blob_type_t1 VALUES(E'\\xDEADBEEF');
    INSERT INTO blob_type_t1 VALUES(E'\\xDEADBEEF');
    INSERT INTO blob_type_t1 VALUES(E'\\xDEADBEEF');
    INSERT INTO f_blob_type_t1 select encode(BT_COL,'base64') from blob_type_t1;
    

    Import a binary table.

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    -- Create a table.
    CREATE TABLE blob_type_t2 
    (
        BT_COL BYTEA
    ) DISTRIBUTE BY REPLICATION;
    -- Create a foreign table.
    CREATE FOREIGN TABLE f_blob_type_t2( BT_COL  text ) SERVER gsmpp_server OPTIONS (LOCATION 'gsfs://127.0.0.1:7789/f_blob_type_t1.dat.0', FORMAT 'text', DELIMITER E'\x08',  NULL '', EOL '0x0a' );
    insert into  blob_type_t2 select decode(BT_COL,'base64') from f_blob_type_t2;
    SELECT * FROM blob_type_t2;
       bt_col
    ------------
     \xdeadbeef
     \xdeadbeef
     \xdeadbeef
     \xdeadbeef
    (4 rows)
    
  • Do not repeatedly export data from the same foreign table. Otherwise, the previously exported file will be overwritten.

  • If you are not sure whether the file is in the standard CSV format, you are advised to set quote parameter to invisible characters such as 0x07, 0x08, or 0x1b to import and export data using GDS. This prevents task failures caused by incorrect file format.
    1
    2
    3
    4
    5
    CREATE FOREIGN TABLE foreign_HR_staffS_ft1
    (
      MANAGER_ID     NUMBER(6),
      section_ID     NUMBER(4)
    ) SERVER gsmpp_server OPTIONS (location 'file:///input_data/*', format 'csv', mode 'private', quote '0x07', delimiter ',') WITH err_HR_staffS_ft1;
    
  • GDS supports concurrent import and export. The gds -t parameter is used to set the size of the thread pool and control the maximum number of concurrent working threads. But it does not accelerate a single SQL task. The default value of gds -t is 8, and the upper limit is 200. When using the pipe function to import and export data, ensure that the value of -t is greater than or equal to the number of concurrent services.

  • When specifying a multi-character delimiter for a GDS foreign table, confirm that each character is distinct in TEXT format. For example, delimiter '---' is not recommended.
  • GDS imports a single file through multiple tables in parallel to improve data import performance. (Only CSV and TXT files can be imported.)
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    -- Create a target table.
    
    CREATE TABLE pipegds_widetb_1 (city integer, tel_num varchar(16), card_code varchar(15), phone_code varchar(16), region_code varchar(6), station_id varchar(10), tmsi varchar(20), rec_date integer(6), rec_time integer(6), rec_type numeric(2), switch_id  varchar(15), attach_city varchar(6), opc varchar(20), dpc varchar(20));
    
    -- Create a foreign table that contains the file_sequence column.
    CREATE FOREIGN TABLE gds_pip_csv_r_1( like pipegds_widetb_1) SERVER gsmpp_server  OPTIONS (LOCATION 'gsfs://127.0.0.1:8781/wide_tb.txt', FORMAT 'text', DELIMITER E'|+|', NULL '', file_sequence '5-1');  
    
    CREATE FOREIGN TABLE gds_pip_csv_r_2( like pipegds_widetb_1) SERVER gsmpp_server  OPTIONS (LOCATION 'gsfs://127.0.0.1:8781/wide_tb.txt', FORMAT 'text', DELIMITER E'|+|', NULL '', file_sequence '5-2');
    
    CREATE FOREIGN TABLE gds_pip_csv_r_3( like pipegds_widetb_1) SERVER gsmpp_server  OPTIONS (LOCATION 'gsfs://127.0.0.1:8781/wide_tb.txt', FORMAT 'text', DELIMITER E'|+|', NULL '', file_sequence '5-3'); 
    
    CREATE FOREIGN TABLE gds_pip_csv_r_4( like pipegds_widetb_1) SERVER gsmpp_server  OPTIONS (LOCATION 'gsfs://127.0.0.1:8781/wide_tb.txt', FORMAT 'text', DELIMITER E'|+|', NULL '', file_sequence '5-4');  
     
    CREATE FOREIGN TABLE gds_pip_csv_r_5( like pipegds_widetb_1) SERVER gsmpp_server  OPTIONS (LOCATION 'gsfs://127.0.0.1:8781/wide_tb.txt', FORMAT 'text', DELIMITER E'|+|', NULL '', file_sequence '5-5');
    
    -- Import the wide_tb.txt file to the pipegds_widetb_1 table in parallel.
    \parallel on
    INSERT INTO pipegds_widetb_1 SELECT * FROM gds_pip_csv_r_1;
    INSERT INTO pipegds_widetb_1 SELECT * FROM gds_pip_csv_r_2;
    INSERT INTO pipegds_widetb_1 SELECT * FROM gds_pip_csv_r_3;
    INSERT INTO pipegds_widetb_1 SELECT * FROM gds_pip_csv_r_4;
    INSERT INTO pipegds_widetb_1 SELECT * FROM gds_pip_csv_r_5;
    \parallel off
    

    For details about the file_sequence parameter, see CREATE FOREIGN TABLE (for GDS Import and Export).

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback