Help Center/ GaussDB(DWS)/ Data Migration and Synchronization/ Data Migration to GaussDB(DWS)
Updated on 2024-05-07 GMT+08:00

Data Migration to GaussDB(DWS)

GaussDB(DWS) provides flexible methods for importing data. You can import data from different sources to GaussDB(DWS). For details, see Figure 1. The features of each method are listed in Table 1. You can select a method as required. You are advised to use GaussDB(DWS) with Data Replication Service (DRS), Cloud Data Migration (CDM), and DataArts Studio. DRS is used for real-time data synchronization, CDM is used for batch data migration, and DataArts Studio orchestrates and schedules the entire ETL process and provides a visualized development environment.

Figure 1 Data migration
  • DRS, CDM, OBS, MRS, and DLI are cloud services.
  • GDS, DSC, and gs_restore, and gs_dump are internal tools.
Table 1 Import methods

Import Method

Data Source

Description

Advantage

Importing Data from OBS in Parallel

OBS

You can import data in TXT, CSV, ORC, or CarbonData format from OBS to GaussDB(DWS) for query, and can remotely read data from OBS.

It is recommended for GaussDB(DWS).

This method features high performance and flexible scale-out.

Using GDS to Import Data from a Remote Server

Servers (remote servers)

Use the GDS tool provided by GaussDB(DWS) to import data from the remote server to GaussDB(DWS) in parallel. Multiple DNs are used for the import. This method is efficient and applicable to importing a large amount of data to the database.

Importing Data from MRS to a Cluster

MRS (HDFS)

Configure a GaussDB(DWS) cluster to connect to an MRS cluster. In GaussDB(DWS), read data from the HDFS of MRS.

This method features high performance and flexible scale-out.

Importing Data from One GaussDB(DWS) Cluster to Another

-

Two GaussDB(DWS) clusters can access data of each other. You can use foreign tables to access and import data across GaussDB(DWS) clusters.

This method is applicable to data synchronization between multiple GaussDB(DWS) clusters.

GDS-based Cross-Cluster Interconnection

-

GDS is used for data transit to implement data synchronization between multiple clusters.

This method is applicable to data synchronization between multiple GaussDB(DWS) clusters.

Using a gsql Meta-Command to Import Data

Local files

Unlike the SQL COPY statement, the \copy command can read data from or write data into only local files on a gsql client.

This method is easy to operate and suitable for importing a small amount of data to the database.

Running the COPY FROM STDIN Statement to Import Data

Other files or databases

When you use Java to develop applications, the CopyManager interface of the JDBC driver is invoked to write data from files or other databases to GaussDB(DWS).

Data is directly written from other databases to GaussDB(DWS). Service data does not need to be stored in files.

Real-time Data Import From Kafka GaussDB(DWS)

Kafka

Use DLI Flink jobs to import Kafka data to GaussDB(DWS) in real time.

This method enables Kafka real-time data import.

Using DRS to Import Data to GaussDB(DWS)

  • MySQL
  • DDM
  • PostgreSQL (OBT)
  • Oracle (OBT)
  • GaussDB Distributed (OBT)

The real-time data synchronization of the DRS allows you to copy data from a data source to GaussDB(DWS) to implement real-time data flow of key services. This method focuses on the synchronous import of tables and data.

This method supports data import from abundant data sources and is easy-to-operate.

Using CDM to Migrate Data to GaussDB(DWS)

Databases, NoSQL, file systems, and big data platforms

CDM can migrate various types of data in batches between homogeneous and heterogeneous data sources. CDM migrates data to GaussDB(DWS) using the copy method or the GDS parallel import method.

This method supports data import from abundant data sources and is easy-to-operate.

Using DSC to Migrate SQL Scripts

Databases, NoSQL, file systems, and big data platforms

For details, see the documents of the third-party ETL tool.

GaussDB(DWS) provides the DSC tool to migrate Teradata/Oracle scripts to GaussDB(DWS).

Provides abundant data sources and powerful data conversion capabilities through OBS.

Using gs_dump and gs_dumpall to Export Metadata

  • Plain text
  • Custom
  • Directory
  • .tar

gs_dump exports a single database or its objects. gs_dumpall exports all databases or global objects in a cluster.

To migrate database information, you can use a tool to import the exported metadata to a target database.

This method is applicable to metadata migration.

Using gs_restore to Import Data

SQL, TMP, and TAR file formats

During database migration, you can use the gs_restore tool to import the file exported using the gs_dump tool to a GaussDB(DWS) cluster. In this way, metadata, such as table definitions and database object definitions, is imported. The following definitions need to be imported:

  • All database objects
  • A single database object
  • A single schema
  • A single table