Export full data to OSS

Updated at:

This topic describes how to create and manage full data export tasks from Lindorm to OSS by using the web interface of the LTS platform. This feature allows you to export data from a Lindorm database to Alibaba Cloud OSS. Multiple file formats and flexible export configurations are supported.

Prerequisites

System requirements

  • The LTS engine and the computing engine are activated.

  • The wide table snapshot feature is enabled. To enable this feature, contact LTS technical support.

  • The LTS engine is upgraded to version 3.9.4 or later, and the feature is hot-upgraded in the backend by LTS technical support. The upgrade does not affect other engine services.

  • Network connectivity between the source Lindorm instance and the destination OSS bucket is normal.

Permission requirements

  • Lindorm data source permissions: The account that is configured in the job can access the tables to be exported.

  • OSS permissions: The RAM account that you provide has read and write permissions on the destination bucket.

Procedure

Step 1: Configure data sources

  1. Log on to the Lindorm console.

  2. In the upper-left corner of the page, select the region where the instance is deployed.

  3. On the Instances page, click the ID of the target instance or click View Instance Details in the Actions column for the instance.

  4. In the left-side navigation pane, click Instance Details. In the UI Access section, click LTS to go to Cluster Management UI.

    Important

    If this is your first time using LTS, reset the password and add the client IP address to the network whitelist.

  5. Create data sources. Create Lindorm, Spark, and OSS data sources separately. All three data sources are required:

  6. Create an export task. In the left-side navigation pane, choose Data Export > Export Task List to go to the export task creation page.

    • In the source data source field, select the Lindorm instance from which you want to export data, and then select the configured Lindorm data source from the drop-down list.

    • In the destination data source field, select the OSS data source to which you want to export data, and then select the configured OSS data source from the drop-down list.

  7. Set the file type. The following file types are available:

    • CSV: Suitable for text data and general scenarios.

    • Parquet: Suitable for big data analysis scenarios. Uses columnar storage.

    • ORC: Suitable for high-performance query scenarios.

  8. Configure the OSS bucket. Specify the destination bucket in which the exported files are stored.

    Note

    To ensure that the data is exported successfully, make sure that the following conditions are met:

    • The bucket is created.

    • The current account has write permissions on the bucket.

    • Your current network environment can access the region in which the bucket resides.

Step 2: Configure the export

Two export configuration methods are available. Select one of them:

  • If you want to export an entire table, cluster, or database, you do not need to specify an SQL statement in the export configuration. This method does not support computation. It supports only 1:1 export of all table fields. Currently, only SQL tables without dynamic columns are supported.

  • If you want to use an SQL filter statement, you do not need to select a table. Use the select xx from database.table_name where xx format. This method allows you to customize SQL statements to filter data and perform ETL computation before the data is exported.

Option A: Table specification

Examples:

  • *: Exports all tables in the Lindorm instance.

  • test_ns:*: Exports all tables in the test_ns namespace.

  • test_ns:user_info: Exports only the user_info table.

Option B: SQL statement

Dangerous statements such as DROP, DELETE, and TRUNCATE are not allowed. Statements are validated in the SQL editor, and such dangerous statements cannot be executed.

Syntax requirement: Spark SQL. Example:

INSERT OVERWRITE DIRECTORY 'oss://xxx-beijing/lindorm2oss/{namespace}/{tablename}/{ts}' USING CSV SELECT * FROM {namespace}.`{tablename}`

Step 3: Configure Spark runtime parameters

Number of executor instances

  • Field name: Number of Executors

  • Description: Specifies the number of executor instances for the Spark job. The default value is 1 Executor, which uses 4 concurrent threads to read data from the upstream wide table.

  • Impact: The more instances you specify, the higher the parallelism and the faster the export speed. However, this affects the source instance. We recommend that you use the default value (1 Executor) and then adjust the value based on the monitoring data of the source instance.

Additional Spark parameters (optional)

Used to optimize the performance of Spark jobs. You do not need to specify this parameter by default.

Step 4: Submit the task

Before the task is submitted, the system automatically verifies the following items:

  • Whether all required fields are specified.

  • Whether the data source connections are normal.

  • Whether the OSS bucket permissions are sufficient.

  • Whether the table specification or the SQL syntax is correct.

Click Create at the bottom of the page to submit the task.

  • Success: You are automatically redirected to the task list page.

  • Failure: The specific error message is displayed. Modify the configuration as prompted.

Monitor and manage tasks

Choose Data Export > Export Task List to view the task status:

  • RUNNING: The task is running.

  • SUCCESS: The task is complete.

  • FAILED: The task failed.

  • KILLED: The task is terminated.

Click a task to view the task progress, the amount of processed data, the execution logs, and the error messages (if any). To view the information, you must provide the username and password of the database connection, which you can obtain in the console.

Export file structure

Default storage path format:

oss://{bucket}/lindorm2oss/{namespace}/{table}/{timestamp}/

To customize the path, use the SQL method.

Example of the file organization structure:

lindorm2oss/
├── namespace1/
│   ├── table1/
│   │   └── 20240101_120000/
│   │       ├── part-00000.csv
│   │       ├── part-00001.csv
│   │       └── _SUCCESS
│   └── table2/
│       └── 20240101_120000/
└── namespace2/
    └── table1/
        └── 20240101_120000/

Submit a task by calling an API operation

Create a data export task

Request:

POST /pro/proc/data-export/create
Content-Type: application/x-www-form-urlencoded

Parameters:

Parameter

Type

Required

Description

src

String

Yes

The name of the source data source. The type must be Lindorm.

dst

String

Yes

The name of the destination data source. The type must be OSS.

ossBucket

String

Yes

The name of the OSS bucket.

instances

String

Yes

The number of Spark Executor instances. The value must be a positive integer.

tableSpec

String

Mutually exclusive with sqlStatements

The table matching rule.

sqlStatements

String

Mutually exclusive with tableSpec

A custom Spark SQL statement.

fileType

String

No

The format of the exported files. Valid values: csv (default), parquet, and orc.

sparkAdditionalParams

String

No

Additional Spark parameters. Format: key1|value1,key2|value2

Constraints:

  • tableSpec and sqlStatements are mutually exclusive. You can specify only one of them.

  • sqlStatements must not contain DROP, TRUNCATE, or DELETE statements.

  • instances must be an integer greater than 0.

Success response:

{
  "success": "true",
  "msg": "<procId>"
}

Failure response:

{
  "success": "false",
  "errorCode": "<error code>",
  "errorMsg": "<error message>"
}

Error codes:

Error code

Description

API-DS-000

The data source does not exist.

API-EXPORT-001

The OSS bucket cannot be empty.

API-EXPORT-002

The table rule and the SQL statement are mutually exclusive. Specify only one of them.

API-EXPORT-003

You must specify at least one of the table rule and the SQL statement.

API-EXPORT-004

The SQL statement contains dangerous statements.

API-BULKLOAD-009

The Spark spec value is invalid.

API-BULKLOAD-011

The instances parameter is invalid.

API-100

An internal server error occurred.

Example: Export data by using a custom SQL statement

curl -X POST 'http://lts-xxx-master1-001.lts.rds.aliyuncs.com:12311/pro/proc/data-export/create' \
  --data-urlencode 'src=ld-xxx' \
  --data-urlencode 'dst=oss-data-source' \
  --data-urlencode 'fileType=csv' \
  --data-urlencode 'ossBucket=xxx-oss' \
  --data-urlencode 'instances=1' \
  --data-urlencode 'sparkAdditionalParams=key|value' \
  --data-urlencode 'sqlStatements=CREATE OR REPLACE TEMPORARY VIEW my_table_view AS SELECT * FROM lindorm_table.default.my_table;CREATE TABLE IF NOT EXISTS oss_my_table USING CSV LOCATION '\''oss://xxx-oss/lindorm2oss/default/my_table/1'\'' AS SELECT * FROM my_table_view LIMIT 0;INSERT OVERWRITE TABLE oss_my_table SELECT * FROM my_table_view;'

Query running export tasks

Request:

GET /pro/proc/data-export/running

No parameters are required.

Success response:

{
  "success": "true",
  "data": [
    {
      "procId": "proc-xxxxxxxx",
      "name": "Task name or procId",
      "srcDS": "ld-xx",
      "sinkDS": "oss-data-source",
      "tableInfo": "default:my_table",
      "startTime": "2026-03-18 14:30:00",
      "runningTime": "1h 25m 30s 100ms",
      "progress": "3/5",
      "successCnt": 3,
      "totalCnt": 5,
      "state": "RUNNING"
    }
  ]
}

Response fields:

Field

Type

Description

procId

String

The unique identifier of the task.

name

String

The task name. If the name is not specified, the value is the same as procId.

srcDS

String

The name of the source data source.

sinkDS

String

The name of the destination data source.

tableInfo

String

The table information. Valid values: the original tableSpec value, the source table name parsed from the SQL statement, or "Custom SQL".

startTime

String

The time when the task was created.

runningTime

String

The elapsed running time in a human-readable format.

progress

String

The progress in the "completed/total" format.

successCnt

int

The number of completed jobs.

totalCnt

int

The total number of jobs.

state

String

The task status. The value is always RUNNING for this operation.

Example:

curl 'http://<host>:12312/pro/proc/data-export/running'

Sample response:

{
  "success": "true",
  "data": [
    {
      "procId": "proc-20260318-001",
      "name": "proc-20260318-001",
      "srcDS": "ld-xxx",
      "sinkDS": "oss-data-source",
      "tableInfo": "default:my_table",
      "startTime": "2026-03-18 10:00:00",
      "runningTime": "4h 30m 15s 200ms",
      "progress": "8/10",
      "successCnt": 8,
      "totalCnt": 10,
      "state": "RUNNING"
    }
  ]
}

FAQ

  • Q: The task fails to be submitted.

    A: Possible causes:

    • The data source connection is abnormal.

    • The OSS permissions are insufficient.

    • The table does not exist, or you do not have the access permissions.

    Solution: Check the data source connection status, verify the OSS bucket permissions, and make sure that the table name and the namespace are correct.

  • Q: The exported data is incomplete.

    A: Possible causes:

    • Insufficient Spark resources cause the task to be interrupted.

    • An exception occurs during data writing.

    • The network is unstable.

    Solution: Check the resource instances, review the Spark logs to locate the specific error, and make sure that the network environment is stable.

  • Q: The export is slow.

    A: Optimization suggestions:

    • Increase the number of Executor instances.

    • Adjust the Spark resource configuration.

    • Export large amounts of data in batches.

Best practices

Standard SQL tables

Export a standard SQL table (an SQL table without dynamic columns) by using the SQL method:

INSERT OVERWRITE DIRECTORY 'oss://xxx-beijing/lindorm2oss/{namespace}/{tablename}/{ts}' USING CSV SELECT * FROM {namespace}.`{tablename}`

Submission parameters:

spark.sql.lindorm.snapshot.maxSplitBytes|128m,spark.sql.ldps.lindorm.scan.snapshot.inferSchema|false,spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version|2,spark.hadoop.mapreduce.fileoutputcommitter.cleanup.skipped|false

SQL tables with dynamic columns

Dynamic columns require manual type mapping. Dynamic columns are written as the String type, and strings are converted to hexadecimal encoding:

INSERT OVERWRITE DIRECTORY 'oss://xxx-beijing/lindorm2oss/{namespace}/{tablename}/{ts}' USING CSV SELECT p1, p2, c1, CAST(d3 AS STRING) AS d31, CAST(d5 AS STRING) AS d51, CAST(d6 AS STRING) AS d61 FROM {namespace}.`{tablename}`

Submission parameters:

spark.sql.lindorm.snapshot.maxSplitBytes|128m,spark.sql.ldps.lindorm.scan.snapshot.inferSchema|false,spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version|2,spark.hadoop.mapreduce.fileoutputcommitter.cleanup.skipped|false

HBase-like tables

INSERT OVERWRITE DIRECTORY 'oss://xxx-beijing/lindorm2oss/{namespace}/{tablename}/{ts}' USING PARQUET SELECT
  to_hstring(ROW, 0, length(ROW)) AS ROW,
  to_hstring(name, 0, length(name)) AS name,
  to_hinteger(age, 0) AS age,
  to_hlong(time, 0) AS time,
  to_hshort(buycode, 0) AS buycode,
  to_hfloat(price, 0) AS price,
  to_hdouble(price2, 0) AS price2,
  to_hboolean(isMale, 0) AS isMale
FROM {namespace}.`{tablename}`;

Submission parameters:

spark.sql.lindorm.snapshot.maxSplitBytes|128m,spark.sql.ldps.lindorm.scan.snapshot.inferSchema|true,spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version|2,spark.hadoop.mapreduce.fileoutputcommitter.cleanup.skipped|false

Non-SQL submission in the console

HBase tables and SQL tables with dynamic columns

Base64-encoded strings are output by default. We recommend that you use the SQL submission method.

Submission parameters:

spark.sql.lindorm.snapshot.maxSplitBytes|128m,spark.sql.ldps.lindorm.scan.snapshot.inferSchema|true,spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version|2,spark.hadoop.mapreduce.fileoutputcommitter.cleanup.skipped|false

Standard SQL tables and HType tables

You can use these tables directly. In the table specification field, enter {namespace.tableName}.

Submission parameters:

spark.sql.lindorm.snapshot.maxSplitBytes|128m,spark.sql.ldps.lindorm.scan.snapshot.inferSchema|false,spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version|2,spark.hadoop.mapreduce.fileoutputcommitter.cleanup.skipped|false