Change data capture (CDC) Beta
If you haven’t installed YugabyteDB yet, do so first by following the Quick Start guide.
A JRE (or JDK), for Java 8 or later, is installed. JDK and JRE installers for Linux, macOS, and Windows can be downloaded from , AdoptOpenJDK, or .
Add a table, named users
, to the default yugabyte
database.
CREATE TABLE products(
id bigserial PRIMARY KEY,
created_at timestamp,
category text,
ean text,
price float,
quantity int default(5000),
rating float,
title text,
vendor text
);
Download the CDC Connector JAR file (yb-cdc-connector.jar
).
java -jar yb-cdc-connector.jar \
--table_name yugabyte.products \
--log_only
The example above uses the following parameters:
—table_name
— Specifies the namespace and table, where namespace is the database (YSQL) or keyspace (YCQL).—master_addrs
— Specifies the IP addresses for all of the YB-Master servers that are producing or consuming. Default value is127.0.0.1:7100
. If you are using a 3-node local cluster, then you need to specify a comma-delimited list of the addresses for all of your YB-Master servers.—log_only
: Flag to restrict logging only to the console (stdout
).
In another terminal shell, write some values to the table and observe the values on your stdout
output stream.
key {
key: "id"
value {
int64_value: 14
}
}
changes {
key: "created_at"
value {
int64_value: 568046516870000
}
}
changes {
key: "category"
value {
string_value: "Widget"
}
}
changes {
key: "ean"
value {
string_value: "8833419218504"
}
}
changes {
double_value: 25.09876359271891
}
}
changes {
key: "quantity"
value {
int32_value: 5000
}
}
changes {
key: "rating"
value {
double_value: 4.0
}
}
changes {
key: "title"
value {
string_value: "Awesome Concrete Shoes"
}
}
changes {
key: "vendor"
value {
string_value: "McClure-Lockman"