Skip to main content

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

VariableRequiredDefaultDescription
SOURCE_TYPENopostgresSource connector type
SOURCE_URLYes-Connection URL

PostgreSQL Source

VariableRequiredDefaultDescription
SOURCE_URLYes-PostgreSQL connection URL
SOURCE_SLOT_NAMENoAutoReplication slot name
SOURCE_PUBLICATION_NAMENoAutoPublication 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:

LegacyNew
DATABASE_URLSOURCE_URL
SLOT_NAMESOURCE_SLOT_NAME
PUBLICATION_NAMESOURCE_PUBLICATION_NAME

Sink Configuration

Generic Sink Variables

VariableRequiredDefaultDescription
SINK_TYPENostarrocksSink connector type
SINK_URLYes-Sink connection URL
SINK_DATABASEYes-Target database

StarRocks Sink

VariableRequiredDefaultDescription
SINK_URLYes-Stream Load HTTP URL
SINK_PORTNo9030MySQL protocol port
SINK_DATABASEYes-Target database
SINK_USERNorootUsername
SINK_PASSWORDNo``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)

LegacyNew
STARROCKS_URLSINK_URL
STARROCKS_DBSINK_DATABASE
STARROCKS_USERSINK_USER
STARROCKS_PASSSINK_PASSWORD
STARROCKS_PORTSINK_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

VariableDefaultDescription
FLUSH_SIZE10000Events per batch
FLUSH_INTERVAL_MS5000Max ms between flushes

Tuning Guidelines

ScenarioFLUSH_SIZEFLUSH_INTERVAL_MS
Low latency10001000
Balanced100005000
High throughput5000010000

Example:

# Low latency (dashboards)
FLUSH_SIZE="1000"
FLUSH_INTERVAL_MS="1000"

# High throughput (analytics)
FLUSH_SIZE="50000"
FLUSH_INTERVAL_MS="10000"

gRPC Server

VariableDefaultDescription
GRPC_PORT50051gRPC server port
GRPC_HOST0.0.0.0gRPC bind address
# Change port
GRPC_PORT="50052"

# Bind to specific interface
GRPC_HOST="127.0.0.1"

Logging

VariableDefaultDescription
RUST_LOGinfoLog level

Log Levels:

  • error - Errors only
  • warn - Warnings and errors
  • info - Informational (recommended)
  • debug - Debug information
  • trace - 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

Next Steps