Scenario
This section describes how to import data from PgSQL to Hudi by using the CDLService web UI of a cluster with Kerberos authentication enabled.
Prerequisites
- The CDL and Hudi services have been installed in a cluster and are running properly.
- The prerequisites for the PgSQL database have been met. For details, see Policy for Modifying Write-Ahead Logs in PostgreSQL Databases.
- You have created a human-machine user, for example, cdluser, added the user to user groups cdladmin (primary group), hadoop, kafka, and supergroup, and associated the user with the System_administrator role on FusionInsight Manager.
Procedure
- Log in to FusionInsight Manager as user cdluser (change the password upon your first login), choose Cluster > Services > CDL, and click the link next to CDLService UI to go to the CDLService web UI.
- Choose Link Management and click Add Link. In the displayed dialog box, set parameters for adding the pgsql and hudi links by referring to the following tables.
Table 1 PgSQL data link parametersParameter
|
Example
|
Link Type
|
pgsql
|
Name
|
pgsqllink
|
Host
|
10.10.10.10
|
Port
|
5432
|
DB Name
|
testDB
|
User
|
user
|
Password
|
Password of the user user
|
Description
|
-
|
Table 2 Hudi data link parametersParameter
|
Example
|
Link Type
|
hudi
|
Name
|
hudilink
|
Storage Type
|
hdfs
|
Auth KeytabFile
|
/opt/Bigdata/third_lib/CDL/user_libs/cdluser.keytab
|
Principal
|
cdluser
|
Description
|
xxx
|
- After the parameters are configured, click Test to check whether the data link is normal.
After the test is successful, click OK.
- (Optional) Choose ENV Management and click Add Env. In the displayed dialog box, configure the parameters based on the following table.
Table 3 Parameters for adding an ENVParameter
|
Example Value
|
Name
|
test-env
|
Driver Memory
|
1 GB
|
Type
|
spark
|
Executor Memory
|
1 GB
|
Executor Cores
|
1
|
Number Executors
|
1
|
Queue
|
-
|
Description
|
-
|
Click OK.
- Choose Job Management > Data synchronization task and click Add Job. In the displayed dialog box, set parameters and click Next.
Parameters are as follows.
Parameter
|
Example
|
Name
|
job_pgtohudi
|
Desc
|
-
|
- Configure PgSQL job parameters.
- On the Job Management page, drag the pgsql icon on the left to the editing area on the right and double-click the icon to go to the PgSQL job configuration page. Configure parameters based on the following table.
Table 4 PgSQL job parametersParameter
|
Example
|
Link
|
pgsqllink
|
Tasks Max
|
1
|
Mode
|
insert, update, and delete
|
dbName Alias
|
pgsqldb
|
Schema
|
pgschema
|
Slot Name
|
pg_slot
|
Enable FailOver Slot
|
No
|
Slot Drop
|
No
|
Connect With Hudi
|
Yes
|
Use Exist Publication
|
No
|
Publication Name
|
publicationtest
|
- Click the plus sign (+) to display more parameters.

- Start Time: indicates the start time of table synchronization.
- WhiteList: Enter a table in the database.
- Blacklist: Enter the database table that does not need to capture data.
- Topic Table Mapping
- This parameter is mandatory if Connect With Hudi is set to Yes.
- Enter the table name in the first text box, for example, test. Enter a topic name in the second text box, for example, test_topic. The topic name must match the table name in the first text box.
- Click OK. The PgSQL job parameters are configured.
- Configure Hudi job parameters.
- On the Job Management page, drag the hudi icon in the Sink area on the left to the editing area on the right and double-click the icon to go to the Hudi job configuration page. Configure parameters based on the following table:
Table 5 Sink Hudi job parametersParameter
|
Example Value
|
Link
|
hudilink
|
Path
|
/cdl/test
|
Interval
|
10
|
Max Rate Per Partition
|
0
|
Parallelism
|
10
|
Target Hive Database
|
default
|
Configuring Hudi Table Attributes
|
Visual View
|
Global Configuration of Hudi Table Attributes
|
-
|
Configuring the Attributes of the Hudi Table: Table Name
|
test
|
Configuring the Attributes of the Hudi Table: Table Type Opt Key
|
COPY_ON_WRITE
|
Configuring the Attributes of the Hudi Table: Hudi TableName Mapping
|
-
|
Configuring the Attributes of the Hudi Table: Hive TableName Mapping
|
-
|
Configuring the Attributes of the Hudi Table: Table Primarykey Mapping
|
id
|
Configuring the Attributes of the Hudi Table: Table Hudi Partition Type
|
-
|
Configuring the Attributes of the Hudi Table: Custom Config
|
-
|

- (Optional) Click the plus sign (+) to display the Execution Env parameter. Select a created environment for it. The default value is defaultEnv.

- Click OK.
- Drag the two icons to associate the job parameters and click Save. The job configuration is complete.

- In the job list on the Job Management page, locate the created job, click Start in the Operation column, and wait until the job is started.
Check whether the data transmission takes effect, for example, insert data into the table in the PgSQL database and view the content of the file imported to Hudi.