Skip to content

Write MySQL data to MatrixOne Intelligence using NineData

This chapter will use the transfer of data from Alibaba Cloud MySQL RDS to MatrixOne Intelligence as an example to introduce how to use Ninedata to write MySQL data to MatrixOne Intelligence.

Prepare before starting

Operation steps

Create test data

This chapter uses TPC-H standard test data. For specific test data generation and injection, please refer to [Complete TPCH Test] (https://docs.matrixorigin.cn/v25.2.1.0/MatrixOne/Test/performance-testing/TPCH-test-with-matrixone/)

  1. Create a MySQL database named tpch and generate eight tables: lineitem, partsupp, part, supplier, nation, region, orders, customers according to the TPCH benchmark requirements.

    mysql> \.Path/dss.ddl
    
  2. Add primary key and foreign key

    mysql> \.Path/dss.ri
    
  3. Use dbgen to generate 100MB of data

    ./dbgen -s 0.1
    
  4. Import all the generated eight tbl tables into the tested MySQL test database

USE tpch;
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/root/TPC-H V3.0.1/dbgen/customer.tbl' INTO TABLE CUSTOMER
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n';
LOAD DATA LOCAL INFILE '/root/TPC-H V3.0.1/dbgen/lineitem.tbl' INTO TABLE LINEITEM
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n';
LOAD DATA LOCAL INFILE '/root/TPC-H V3.0.1/dbgen/nation.tbl' INTO TABLE NATION
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n';
LOAD DATA LOCAL INFILE '/root/TPC-H V3.0.1/dbgen/orders.tbl' INTO TABLE ORDERS
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n';
LOAD DATA LOCAL INFILE '/root/TPC-H V3.0.1/dbgen/partsupp.tbl' INTO TABLE PARTSUPP
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n';
LOAD DATA LOCAL INFILE '/root/TPC-H V3.0.1/dbgen/part.tbl' INTO TABLE PART
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n';
LOAD DATA LOCAL INFILE '/root/TPC-H V3.0.1/dbgen/region.tbl' INTO TABLE REGION
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n';
LOAD DATA LOCAL INFILE '/root/TPC-H V3.0.1/dbgen/supplier.tbl' INTO TABLE SUPPLIER
FIELDS TERMINATED BY '|' LINES TERMINATED BY '|\n';
SET FOREIGN_KEY_CHECKS=1;

Set up NineData data source

  1. Select the data source in the NineData Workbench interface

  2. Click Create Data Source and select MySQL in the Relational Database column of Home-built Database

  3. Set up the data source information of Alibaba Cloud MySQL RDS and the data source information of MatrixOne Intelligence in turn, as shown in the figure:

dataSourceSetup

  1. Create a new data migration task

    Click the Data Copy category on the left sidebar, select Data Copy to enter the data copy page, and click Create Copy.

    Fill in the task name, source data source (in this case, Alibaba Cloud RDS data source), target data source (in this case, MOC data source), select the replication method, replication type, replication specification, and how the target library has the same name object, and click Next.

    Settings as shown in the figure: sourceTarget

  2. Set the object to be copied

    Select the table that needs data migration in the source object, click the transfer arrow in the middle, and click Next, as shown in the figure

    replican

  3. Check configuration map

    Determine the corresponding one-to-one table names of the mapped source database and the target database. Click Save and pre-check

    configuration

  4. Click to start the task after the pre-check is successful

    sourceTarget

  5. 100MB of data will take about 4 minutes to migrate. After the migration is completed, you can select the data comparison option to compare whether the data is consistent before and after the migration.