Skip to main content

StarRocks Configuration

This guide explains how to configure a StarRocks sink in EZ-CDC.

Add StarRocks Sink

Via Portal

  1. Navigate to DatasourcesNew Datasource
  2. Select StarRocks as the type
  3. Fill in the connection details:
FieldDescriptionExample
NameUnique identifieranalytics-starrocks
HostStarRocks FE hostnamestarrocks.example.com
MySQL PortFrontend MySQL protocol port9030
HTTP PortBackend HTTP port (Stream Load)8040
DatabaseTarget databaseanalytics
UsernameStarRocks userezcdc_user
PasswordUser password********
  1. Click Test Connection
  2. Click Save

Connection Options

Basic Options

OptionRequiredDefaultDescription
hostYes-FE hostname or IP
mysql_portNo9030FE MySQL protocol port
http_portNo8040BE HTTP port
databaseYes-Target database
usernameYes-StarRocks user
passwordYes-User password

Advanced Options

OptionDefaultDescription
load_urlAuto-generatedCustom Stream Load URL
timeout300Stream Load timeout (seconds)

Load URL Override

By default, EZ-CDC constructs the Stream Load URL as:

http://{host}:{http_port}/api/{database}/{table}/_stream_load

For custom configurations (e.g., load balancer):

{
"load_url": "http://starrocks-lb.example.com:8040"
}

Cluster Configurations

Single Node

For development/testing:

{
"host": "starrocks-standalone",
"mysql_port": 9030,
"http_port": 8040,
"database": "analytics",
"username": "root",
"password": ""
}

Multi-Node Cluster

For production with multiple BEs, use a load balancer to distribute Stream Load requests across Backend nodes:

Architecture:

  • Load Balancer (:8040) distributes requests to:
    • BE-1 (:8040)
    • BE-2 (:8040)
    • BE-3 (:8040)

Configure with load balancer:

{
"host": "starrocks-fe",
"mysql_port": 9030,
"load_url": "http://starrocks-be-lb:8040",
"database": "analytics",
"username": "ezcdc_user",
"password": "your_password"
}

StarRocks on Kubernetes

For K8s deployments:

{
"host": "starrocks-fe.starrocks.svc.cluster.local",
"mysql_port": 9030,
"load_url": "http://starrocks-be.starrocks.svc.cluster.local:8040",
"database": "analytics",
"username": "ezcdc_user",
"password": "your_password"
}

Test Connection

From Portal

Click Test Connection to verify:

  1. MySQL connectivity (metadata queries)
  2. HTTP connectivity (Stream Load)
  3. Authentication
  4. Database access

From CLI

# Test MySQL connection
mysql -h starrocks.example.com -P 9030 -u ezcdc_user -p

# Test Stream Load endpoint
curl -I http://starrocks.example.com:8040/api/analytics/test/_stream_load

Table Configuration

Automatic Table Creation

EZ-CDC can create tables automatically:

  1. Reads source schema
  2. Maps PostgreSQL types to StarRocks types
  3. Creates Primary Key table
  4. Adds audit columns

Example auto-created table:

CREATE TABLE orders (
-- Source columns
id BIGINT NOT NULL,
customer_id BIGINT,
total DECIMAL(18, 2),
status VARCHAR(65535),
created_at DATETIME,

-- Audit columns (added by EZ-CDC)
_cdc_updated_at DATETIME,
_cdc_deleted BOOLEAN DEFAULT false
)
PRIMARY KEY (id)
DISTRIBUTED BY HASH(id) BUCKETS 8
PROPERTIES (
"replication_num" = "1"
);

Manual Table Creation

For more control, create tables manually:

-- Create with specific settings
CREATE TABLE orders (
id BIGINT NOT NULL,
customer_id BIGINT,
total DECIMAL(18, 2),
status VARCHAR(100), -- Specific length
created_at DATETIME,
_cdc_updated_at DATETIME,
_cdc_deleted BOOLEAN DEFAULT false
)
PRIMARY KEY (id)
DISTRIBUTED BY HASH(id) BUCKETS 16 -- More buckets
PROPERTIES (
"replication_num" = "3", -- More replicas
"enable_persistent_index" = "true"
);

Type Mapping

PostgreSQL → StarRocks

PostgreSQL TypeStarRocks TypeNotes
smallintSMALLINT
integerINT
bigintBIGINT
numeric(p,s)DECIMAL(p,s)Max precision 38
realFLOAT
double precisionDOUBLE
booleanBOOLEAN
char(n)CHAR(n)
varchar(n)VARCHAR(n)Max 65535
textSTRING
dateDATE
timestampDATETIME
timestamptzDATETIMEConverted to UTC
jsonbJSONStarRocks 3.0+
uuidVARCHAR(36)
byteaVARBINARY

Troubleshooting

"Connection refused"

Error: Connection refused to starrocks.example.com:9030

Solutions:

  1. Verify FE is running and listening
  2. Check security groups allow port 9030
  3. Try connecting with mysql client

"Access denied"

Error: Access denied for user 'ezcdc_user'

Solutions:

  1. Verify password is correct
  2. Check user has LOAD privilege
  3. Verify user can access the database

"Stream Load failed"

Error: Failed to load data via Stream Load

Solutions:

  1. Check BE is reachable on port 8040
  2. Verify HTTP connectivity: curl http://be:8040
  3. Check BE logs for errors
  4. Verify user has LOAD privilege

"Database does not exist"

Error: Unknown database 'analytics'

Solutions:

-- Create the database
CREATE DATABASE analytics;
GRANT ALL ON analytics.* TO 'ezcdc_user';

Next Steps