Bypass import

更新时间:
复制 MD 格式

This page explains how to enable and disable the bypass import port in the OceanBase console.

Overview

OceanBase Database supports bypass import, a feature that improves data import efficiency by bypassing the traditional SQL layer and writing data directly to database files. For more information, see Bypass import overview.

Prerequisites

Before you enable the bypass import port, ensure that the following conditions are met:

  • The cluster is in the running state.

  • The tenant is in the running state.

  • The agent version is V4.3.0 or later.

    Note

    If the agent version does not meet this requirement, contact OceanBase Technical Support for assistance with the upgrade.

  • The private endpoint of the primary endpoint is in the running state.

Enable bypass import

  1. Log on to the OceanBase Management Console .

  2. In the navigation pane on the left, click Instance List.

  3. In the instance list, find the target cluster instance and click its name to open the Cluster Instance Workspace page.

  4. In the navigation pane on the left, click Database Proxy.

  5. In the proxy endpoint list, find the private endpoint of the primary endpoint and click Enable.

  6. In the confirmation dialog box, click OK.

Import data

  1. Download the latest version of the OceanBase data import tool.

    For more information about the OceanBase data import tool, see Product introduction.

  2. View and set the environment variables.

    1. View the environment variables for Java and PATH.

      [root@iZbxxxx rpc]# env | grep JAVA
      JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.382.b05-2.0.3.al8.x86_64
      [root@iZbxxxx rpc]# env | grep PATH
      PATH=/root/ob-loader-dumper-4.3.0-RELEASE/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
    2. Set the environment variables for Java and PATH.

      [root@iZbxxxx rpc]# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.382.b05-2.0.3.al8.x86_64
      [root@iZbxxxx rpc]# export PATH=/root/ob-loader-dumper-4.3.0-RELEASE/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:$PATH
  3. Import data using the bypass import method.

    Note

    Ensure that the imported file is in a valid format. For more information about how to check the data format of a file, see Are you ready with your data?.

    [root@iZbxxxx rpc]# obloader -h<host> -u<user_name> -p<pass_word> -D <db_name> --table '<table_name>' -f output1 -t <tenant_name> --public-cloud --csv --direct --rpc-port 3307 -P3306

    Parameter

    Description

    -h

    Specifies the host address of the OceanBase database.

    -u

    The username, tenant name, and cluster name used to connect to the OceanBase database. The format is <user>@<tenant>#<cluster>. For example, -u user@tenant#cluster.

    -p

    Specifies the password of the user used to connect to the OceanBase database.

    -D

    Specifies the name of the OceanBase database to which you want to import database object definitions and table data.

    --table

    Performs operations on a specified table in the OceanBase database. For example, --table 'example'.

    -f

    Specifies the prefix of the file to be imported. For example, this command indicates that the data to be imported is saved in a file whose name starts with the prefix output1.

    -t

    This parameter is used with --public-cloud to specify the tenant name for connecting to the OceanBase database.

    --public-cloud

    Indicates that database objects or table data are imported from an OceanBase cluster deployed in ApsaraDB for OceanBase.

    --csv

    Specifies that the file format of the data to be imported is CSV. You can specify the format based on the actual format of your data, such as --sql, --par, and --orc.

    --direct

    Specifies that the bypass import mode is used. This parameter is used with --rpc-port and --parallel.

    --parallel

    The degree of parallelism for loading data during bypass import. This parameter is optional. The default value is 1. This parameter is used with --rpc-port and --direct.

    --rpc-port 3307

    The port used to connect to the OBServer RPC service.

    This indicates that although the port for connecting to the database is 3306 (specified by -P3306), the actual data import is completed through the RPC service on port 3307 to improve import performance.

    -P 3306

    Specifies the host port for connecting to the OceanBase database.

Disable bypass import

  1. Log on to the OceanBase Management Console .

  2. In the navigation pane on the left, click Instance List.

  3. In the instance list, find the target cluster instance and click its name to open the Cluster Instance Workspace page.

  4. In the navigation pane on the left, click Database Proxy.

  5. In the agent endpoint list, click Close for the primary private endpoint to close the bypass import port.

  6. In the confirmation dialog box, click OK.