StarRocks Configuration
This guide explains how to configure a StarRocks sink in EZ-CDC.
Add StarRocks Sink
Via Portal
- Navigate to Datasources → New Datasource
- Select StarRocks as the type
- Fill in the connection details:
| Field | Description | Example |
|---|---|---|
| Name | Unique identifier | analytics-starrocks |
| Host | StarRocks FE hostname | starrocks.example.com |
| MySQL Port | Frontend MySQL protocol port | 9030 |
| HTTP Port | Backend HTTP port (Stream Load) | 8040 |
| Database | Target database | analytics |
| Username | StarRocks user | ezcdc_user |
| Password | User password | ******** |
- Click Test Connection
- Click Save
Connection Options
Basic Options
| Option | Required | Default | Description |
|---|---|---|---|
host | Yes | - | FE hostname or IP |
mysql_port | No | 9030 | FE MySQL protocol port |
http_port | No | 8040 | BE HTTP port |
database | Yes | - | Target database |
username | Yes | - | StarRocks user |
password | Yes | - | User password |
Advanced Options
| Option | Default | Description |
|---|---|---|
load_url | Auto-generated | Custom Stream Load URL |
timeout | 300 | Stream 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:
- MySQL connectivity (metadata queries)
- HTTP connectivity (Stream Load)
- Authentication
- 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:
- Reads source schema
- Maps PostgreSQL types to StarRocks types
- Creates Primary Key table
- 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 Type | StarRocks Type | Notes |
|---|---|---|
smallint | SMALLINT | |
integer | INT | |
bigint | BIGINT | |
numeric(p,s) | DECIMAL(p,s) | Max precision 38 |
real | FLOAT | |
double precision | DOUBLE | |
boolean | BOOLEAN | |
char(n) | CHAR(n) | |
varchar(n) | VARCHAR(n) | Max 65535 |
text | STRING | |
date | DATE | |
timestamp | DATETIME | |
timestamptz | DATETIME | Converted to UTC |
jsonb | JSON | StarRocks 3.0+ |
uuid | VARCHAR(36) | |
bytea | VARBINARY |
Troubleshooting
"Connection refused"
Error: Connection refused to starrocks.example.com:9030
Solutions:
- Verify FE is running and listening
- Check security groups allow port 9030
- Try connecting with
mysqlclient
"Access denied"
Error: Access denied for user 'ezcdc_user'
Solutions:
- Verify password is correct
- Check user has LOAD privilege
- Verify user can access the database
"Stream Load failed"
Error: Failed to load data via Stream Load
Solutions:
- Check BE is reachable on port 8040
- Verify HTTP connectivity:
curl http://be:8040 - Check BE logs for errors
- 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';