Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE][TOOLS-CDC]:add flink Command line support #107

Merged
merged 3 commits into from
Dec 11, 2024

Conversation

xxsc0529
Copy link
Contributor

@xxsc0529 xxsc0529 commented Dec 4, 2024

Summary

When synchronizing data to OceanBase, the flink CLI is supported. close #100

Solution Description

Define program entries, receive parameters, and parse them. Use Oceanbase Catalog to obtain the information required by Flink and create the corresponding sink。Here's how it works.
`CREATE TABLE test_history (
itemid BIGINT NOT NULL,
clock INT DEFAULT 0 NOT NULL,
value DOUBLE PRECISION DEFAULT 0.0000 NOT NULL,
ns INT DEFAULT 0 NOT NULL,
PRIMARY KEY (itemid, clock, ns)
) ;

CREATE TABLE test_history_uint (
itemid BIGINT NOT NULL,
clock INT DEFAULT 0 NOT NULL,
value DECIMAL(20,0) DEFAULT 0 NOT NULL,
ns INT DEFAULT 0 NOT NULL,
PRIMARY KEY (itemid, clock, ns)
) ;

CREATE TABLE test_history_str (
itemid BIGINT NOT NULL,
clock INT DEFAULT 0 NOT NULL,
value VARCHAR(255) DEFAULT '' NOT NULL,
ns INT DEFAULT 0 NOT NULL,
PRIMARY KEY (itemid, clock, ns)
);The command line is as follows./bin/flink run
-Dexecution.checkpointing.interval=10s
-Dparallelism.default=1
-c com.oceanbase.connector.flink.tools.cdc.CdcTools
lib/flink-connector-oceanbase-tools-cdc-1.4-SNAPSHOT.jar
mysql-sync-database
--database test_db
--mysql-conf hostname=xxxx
--mysql-conf port=3306
--mysql-conf username=root
--mysql-conf password=xxxx
--mysql-conf database-name=test_db
--including-tables "tbl1|test.*"
--sink-conf username=xxxx@xxxx
--sink-conf password=xxxx
--sink-conf url=jdbc:mysql://xxxx:xxxx
--sink-conf sink.label-prefix=label
--table-conf replication_num=1`
The sink-config configuration is the configuration of the OceanBase database

Copy link
Member

@whhe whhe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, merging.

Let's make some minor patches in the next few days.

@whhe whhe merged commit f7f175f into oceanbase:main Dec 11, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Add command line tools to support Flink CDC as source
2 participants