PolarDB is a next-generation relational database of Alibaba Cloud. PolarDB is fully compatible with MySQL. PolarDB allows you to expand its storage to up to 100 TB, scale out individual clusters to up to 16 nodes, and improve performance six times higher than MySQL. This makes PolarDB suitable for various database scenarios. Data Lake Analytics (DLA) serves as a hub of in-cloud data processing. In the DLA console, you can create a PolarDB schema (mapping database), use a MySQL client or MySQL CLI tool to connect to DLA, and then read and write data to a PolarDB database by using standard SQL statements.
Preparations
Before you use DLA to read and write data to a PolarDB database, perform the following operations to prepare test data in the database:
-
DLA and the PolarDB cluster must be in the same region. Otherwise, the operations described in this topic are not allowed.
DLA connects to the PolarDB database over a Virtual Private Cloud (VPC). We recommend that you select VPC as the network type when you create a PolarDB cluster.
-
Write test data to a table in the PolarDB database.
This example demonstrates how to create a table named person in the PolarDB database and write test data to the table.
CREATE TABLE person (
id int(11) NOT NULL,
name varchar(1023) NOT NULL,
age int(11) NOT NULL,
PRIMARY KEY (id)
)
insert into person
values (1, 'james', 10),
(2, 'bond', 20),
(3, 'jack', 30),
(4, 'lucy', 40);
Usage notes
Before you connect a PolarDB database to DLA, you must add the Classless Inter-Domain
Routing (CIDR) block 100.104.0.0/16
to a whitelist of the PolarDB cluster.
Your PolarDB database resides in a VPC. By default, DLA cannot access resources in
the VPC. To enable DLA to access your PolarDB database, you must use the reverse access
technique of VPCs. To achieve this purpose, you can add the CIDR block 100.104.0.0/16
to the whitelist of your PolarDB cluster.
Permission statements: When you add the CIDR block
100.104.0.0/16
to the whitelist of your PolarDB database, you agree to the use of reverse access to read and write data to your PolarDB database.
Procedure
On the DMS for DLA page, compile SQL statements to create a PolarDB schema, a PolarDB table, and read data from the table. Alternatively, connect to DLA by using a MySQL client or MySQL CLI tool, and then compile SQL statements to create a PolarDB schema, create a PolarDB table, and read data from the table.