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.
NoteIf 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
Log on to the OceanBase Management Console .
In the navigation pane on the left, click Instance List.
In the instance list, find the target cluster instance and click its name to open the Cluster Instance Workspace page.
In the navigation pane on the left, click Database Proxy.
In the proxy endpoint list, find the private endpoint of the primary endpoint and click Enable.
In the confirmation dialog box, click OK.
Import data
Download the latest version of the OceanBase data import tool.
For more information about the OceanBase data import tool, see Product introduction.
View and set the environment variables.
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/binSet 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
Import data using the bypass import method.
NoteEnsure 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 -P3306Parameter
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-cloudto 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-portand--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-portand--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
Log on to the OceanBase Management Console .
In the navigation pane on the left, click Instance List.
In the instance list, find the target cluster instance and click its name to open the Cluster Instance Workspace page.
In the navigation pane on the left, click Database Proxy.
In the agent endpoint list, click Close for the primary private endpoint to close the bypass import port.
In the confirmation dialog box, click OK.