Configuration
dbmazz is configured entirely through environment variables. This guide covers all available options.
Configuration Overview
# Required: Source configuration
SOURCE_URL="postgres://user:pass@host:5432/db"
# Required: Sink configuration
SINK_URL="http://starrocks:8040"
SINK_DATABASE="analytics"
# Required: Tables to replicate
TABLES="public.orders,public.customers"
# Optional: All other settings have defaults
Source Configuration
Generic Source Variables
| Variable | Required | Default | Description |
|---|---|---|---|
SOURCE_TYPE | No | postgres | Source connector type |
SOURCE_URL | Yes | - | Connection URL |
PostgreSQL Source
| Variable | Required | Default | Description |
|---|---|---|---|
SOURCE_URL | Yes | - | PostgreSQL connection URL |
SOURCE_SLOT_NAME | No | Auto | Replication slot name |
SOURCE_PUBLICATION_NAME | No | Auto | Publication name |
URL Format:
postgres://[user[:password]@][host][:port][/database][?param1=value1&...]
Examples:
# Basic
SOURCE_URL="postgres://cdc_user:pass@localhost:5432/mydb"
# With SSL
SOURCE_URL="postgres://cdc_user:pass@postgres.example.com:5432/mydb?sslmode=require"
# With replication mode
SOURCE_URL="postgres://cdc_user:pass@localhost:5432/mydb?replication=database"
Legacy Variables (Deprecated)
For backward compatibility:
| Legacy | New |
|---|---|
DATABASE_URL | SOURCE_URL |
SLOT_NAME | SOURCE_SLOT_NAME |
PUBLICATION_NAME | SOURCE_PUBLICATION_NAME |
Sink Configuration
Generic Sink Variables
| Variable | Required | Default | Description |
|---|---|---|---|
SINK_TYPE | No | starrocks | Sink connector type |
SINK_URL | Yes | - | Sink connection URL |
SINK_DATABASE | Yes | - | Target database |
StarRocks Sink
| Variable | Required | Default | Description |
|---|---|---|---|
SINK_URL | Yes | - | Stream Load HTTP URL |
SINK_PORT | No | 9030 | MySQL protocol port |
SINK_DATABASE | Yes | - | Target database |
SINK_USER | No | root | Username |
SINK_PASSWORD | No | `` | Password |
Examples:
# Minimal
SINK_URL="http://localhost:8040"
SINK_DATABASE="analytics"
# Full configuration
SINK_URL="http://starrocks.example.com:8040"
SINK_PORT="9030"
SINK_DATABASE="analytics"
SINK_USER="cdc_user"
SINK_PASSWORD="secret"
Legacy Variables (Deprecated)
| Legacy | New |
|---|---|
STARROCKS_URL | SINK_URL |
STARROCKS_DB | SINK_DATABASE |
STARROCKS_USER | SINK_USER |
STARROCKS_PASS | SINK_PASSWORD |
STARROCKS_PORT | SINK_PORT |
Table Configuration
TABLES Variable
Comma-separated list of fully-qualified table names:
# Single table
TABLES="public.orders"
# Multiple tables
TABLES="public.orders,public.customers,public.products"
# Different schemas
TABLES="public.orders,sales.transactions,inventory.items"
Table Name Format
Always use fully-qualified names:
schema.table_name
Performance Settings
| Variable | Default | Description |
|---|---|---|
FLUSH_SIZE | 10000 | Events per batch |
FLUSH_INTERVAL_MS | 5000 | Max ms between flushes |
Tuning Guidelines
| Scenario | FLUSH_SIZE | FLUSH_INTERVAL_MS |
|---|---|---|
| Low latency | 1000 | 1000 |
| Balanced | 10000 | 5000 |
| High throughput | 50000 | 10000 |
Example:
# Low latency (dashboards)
FLUSH_SIZE="1000"
FLUSH_INTERVAL_MS="1000"
# High throughput (analytics)
FLUSH_SIZE="50000"
FLUSH_INTERVAL_MS="10000"
gRPC Server
| Variable | Default | Description |
|---|---|---|
GRPC_PORT | 50051 | gRPC server port |
GRPC_HOST | 0.0.0.0 | gRPC bind address |
# Change port
GRPC_PORT="50052"
# Bind to specific interface
GRPC_HOST="127.0.0.1"
Logging
| Variable | Default | Description |
|---|---|---|
RUST_LOG | info | Log level |
Log Levels:
error- Errors onlywarn- Warnings and errorsinfo- Informational (recommended)debug- Debug informationtrace- Very verbose
# Debug logging
RUST_LOG="debug"
# Component-specific logging
RUST_LOG="dbmazz=debug,tokio=warn"
Complete Example
Development
# /etc/dbmazz/config.dev.env
# Source: Local PostgreSQL
SOURCE_URL="postgres://postgres:postgres@localhost:5432/mydb"
SOURCE_SLOT_NAME="dbmazz_dev"
SOURCE_PUBLICATION_NAME="dbmazz_dev_pub"
# Sink: Local StarRocks
SINK_URL="http://localhost:8040"
SINK_PORT="9030"
SINK_DATABASE="dev_analytics"
SINK_USER="root"
SINK_PASSWORD=""
# Tables
TABLES="public.users,public.orders"
# Performance (low latency for dev)
FLUSH_SIZE="1000"
FLUSH_INTERVAL_MS="1000"
# gRPC
GRPC_PORT="50051"
# Logging (verbose for dev)
RUST_LOG="debug"
Production
# /etc/dbmazz/config.prod.env
# Source: Production PostgreSQL (RDS)
SOURCE_URL="postgres://cdc_user:${PG_PASSWORD}@prod-db.xxxxx.us-west-2.rds.amazonaws.com:5432/production?sslmode=require"
SOURCE_SLOT_NAME="dbmazz_prod"
SOURCE_PUBLICATION_NAME="dbmazz_prod_pub"
# Sink: Production StarRocks cluster
SINK_URL="http://starrocks-be-lb.internal:8040"
SINK_PORT="9030"
SINK_DATABASE="production_analytics"
SINK_USER="cdc_service"
SINK_PASSWORD="${SR_PASSWORD}"
# Tables
TABLES="public.orders,public.order_items,public.customers,public.products"
# Performance (balanced)
FLUSH_SIZE="10000"
FLUSH_INTERVAL_MS="5000"
# gRPC
GRPC_PORT="50051"
# Logging
RUST_LOG="info"
Environment Variable Sources
Direct Export
export SOURCE_URL="postgres://..."
export SINK_URL="http://..."
./dbmazz
Environment File
# Load from file
source /etc/dbmazz/config.env
./dbmazz
Systemd Environment File
# /etc/systemd/system/dbmazz.service
[Service]
EnvironmentFile=/etc/dbmazz/config.env
ExecStart=/usr/local/bin/dbmazz
Docker
# Inline
docker run -e SOURCE_URL="..." -e SINK_URL="..." dbmazz
# From file
docker run --env-file /etc/dbmazz/config.env dbmazz
Configuration Validation
dbmazz validates configuration on startup:
ERROR Invalid configuration: SOURCE_URL is required
ERROR Invalid configuration: SINK_DATABASE is required
ERROR Invalid configuration: TABLES cannot be empty
Validate Without Starting
# Check configuration
dbmazz --validate
# Output
✓ SOURCE_URL: postgres://...@localhost:5432/mydb
✓ SINK_URL: http://localhost:8040
✓ SINK_DATABASE: analytics
✓ TABLES: orders, customers
✓ Configuration valid