Railway

Deploy StarRocks

Fast SQL OLAP database for analyzing large amounts of data

Deploy StarRocks

Just deployed

/data

Just deployed

/data

starrocks-storage

Bucket

Just deployed

StarRocks logo

Deploy and Host StarRocks on Railway

StarRocks is an open-source MPP analytical database that answers joins and aggregations over hundreds of millions of rows in well under a second, over the MySQL wire protocol. Teams reach for it when a read replica stops keeping up with a dashboard, or when they want one engine for freshly ingested rows and for historical tables in Apache Iceberg. Any MySQL client connects, so dbt, Superset, Metabase and Grafana work on day one.

This template runs StarRocks in its shared-data architecture, separating compute from storage. A frontend node (FE) owns metadata, parses SQL and plans queries; a compute node (CN) executes every query and load; and an S3-compatible bucket holds every tablet. The compute tier keeps only a local cache, so you can self-host StarRocks without sizing a disk for your dataset up front. The frontend is published on a Railway domain for its console and REST API, and on a TCP proxy for MySQL clients.

Diagram of the StarRocks frontend and compute node on Railway

Getting Started with StarRocks on Railway

Deploy the template and set one value: SR_ROOT_PASSWORD, for the built-in root superuser. The bucket, storage volume, private hostnames and internal wiring are configured on first boot. When both services are healthy, connect over the TCP proxy on the frontend's Networking tab:

mysql -h  -P  -u root -p

Run SHOW COMPUTE NODES first: one row, Alive true, non-zero TabletNum. Then create something real and query it back:

CREATE DATABASE demo;
CREATE TABLE demo.pageviews (
  event_day DATE NOT NULL,
  country    VARCHAR(32) NOT NULL,
  views      BIGINT NOT NULL
)
DUPLICATE KEY(event_day, country)
PARTITION BY date_trunc('month', event_day)
DISTRIBUTED BY HASH(country) BUCKETS 4;

INSERT INTO demo.pageviews VALUES ('2026-06-01', 'Germany', 118);
SELECT country, sum(views) FROM demo.pageviews GROUP BY country;

The same root credential opens the frontend's web console, where you check cluster health without a SQL client: the landing page reports the running version, system browses the cluster like /proc, and queries and sessions show activity.

StarRocks cluster page reporting version 4.1.4 and host CPU details StarRocks compute node listed alive with its private hostname and ports StarRocks database listing with the demo database and its two tables

About Hosting StarRocks

StarRocks is a columnar, vectorized MPP engine built for analytics fast enough to sit in front of users rather than behind a nightly job. Self-hosting suits teams for whom query latency is a product feature, or who want warehouse-grade SQL without per-query billing.

  • Sub-second aggregations and joins from a vectorized engine with a cost-based optimizer
  • MySQL protocol compatibility, so existing BI tools and drivers connect unchanged
  • Real-time upserts through primary-key tables, not only appends
  • Asynchronous materialized views with automatic query rewrite, so a dashboard query is answered from a pre-aggregate without changing the SQL
  • External catalogs for Iceberg, Delta Lake, Hudi, Hive and JDBC, so one engine queries live and lake tables

starrocks-fe holds the catalog, plans queries and terminates client connections, keeping its metadata journal on a volume. starrocks-cn reads tablets from object storage and executes the fragments it is handed, using its volume purely as a cache. starrocks-storage is the system of record for your tables.

Why Deploy StarRocks on Railway

Railway removes the cluster-assembly work that makes self-hosted StarRocks a project of its own:

  • Object storage is provisioned and wired to the cluster automatically
  • Private networking connects the frontend and compute node with no configuration
  • Both services get health checks and restart policies out of the box
  • The MySQL protocol is exposed through a TCP proxy, so BI tools connect directly
  • Adding compute means adding a service, not a machine

Common Use Cases

  • Customer-facing analytics — usage dashboards and in-product charts where a slow query is a visible defect
  • Replacing a pre-aggregation layer — dropping rollup jobs that exist only because the primary database aggregates too slowly
  • Operational reporting — inventory, order and telemetry dashboards fed by continuous inserts
  • Lakehouse acceleration — sub-second SQL over Iceberg or Delta Lake tables already in object storage

Dependencies for StarRocks

  • starrocks-fegridalpha/starrocks-railway on starrocks/fe-ubuntu:4.1-latest. Metadata, SQL, planning, console and REST API.
  • starrocks-cn — the same repository on starrocks/cn-ubuntu:4.1-latest. Stateless compute: scans, joins, aggregations and loading.
  • starrocks-storage — an S3-compatible bucket holding every tablet and rowset.

Environment Variables Reference

VariableServicePurpose
SR_ROOT_PASSWORDbothPassword for the root superuser, applied on first boot
SR_S3_BUCKET, SR_S3_ENDPOINT, SR_S3_REGIONfrontendLocation of the cluster's storage volume
SR_S3_ACCESS_KEY_ID, SR_S3_SECRET_ACCESS_KEYfrontendBucket credentials
SR_FE_HOSTcomputePrivate hostname of the frontend
SR_FE_HEAP_PERCENTfrontendContainer memory share for the JVM heap
SR_CN_MEM_LIMITcomputeContainer memory share for query execution
SR_CN_DATACACHE_DISK_SIZEcomputeSize of the local hot-data cache

Deployment Dependencies

Hardware Requirements for Self-Hosting StarRocks

ResourceMinimumRecommended
CPU2 vCPU per service8 vCPU per service
RAM4 GB frontend, 4 GB compute8 GB frontend, 16 GB+ compute
Storage5 GB volume per service5 GB frontend, 20 GB+ cache
RuntimeJDK 17 (frontend), Linux x86-64Same

The frontend's volume holds only metadata and stays small. The compute node's volume is a cache, so more of it means fewer reads from object storage — table data never has to fit there.

Self-Hosting StarRocks

The quickest way to try StarRocks locally is the all-in-one image, which runs a frontend and backend in one container:

docker run -p 9030:9030 -p 8030:8030 -p 8040:8040 \
  --name starrocks -itd starrocks/allin1-ubuntu:4.1-latest
mysql -h 127.0.0.1 -P 9030 -u root

A shared-data cluster is closer to production. The frontend needs these in fe.conf, and the compute node registers itself once the frontend answers:

run_mode = shared_data
cloud_native_storage_type = S3
aws_s3_endpoint = https://your-object-storage-endpoint
mysql -h starrocks-fe -P 9030 -u root -e \
  'ALTER SYSTEM ADD COMPUTE NODE "starrocks-cn:9050";'

Doing that yourself means managing the metadata journal, the storage volume definition, node registration across restarts and the networking between roles.

Is StarRocks Free to Self-Host?

StarRocks is fully open source under Apache 2.0, with no paid edition, seat limits or feature gates. Materialized views, primary-key tables, external catalogs and compute/storage separation are all in the open-source build. On Railway you pay only for infrastructure: two containers, two small volumes and the object storage your tables use.

FAQ

What is StarRocks? An open-source MPP analytical database for sub-second queries over large datasets. It is columnar and vectorized, supports real-time updates as well as appends, and speaks the MySQL wire protocol.

What does this Railway template deploy? A shared-data StarRocks cluster: a frontend for metadata and SQL, a compute node for query execution, and an S3-compatible bucket for all table data.

Why does the template include object storage instead of just a volume? In shared-data mode object storage is where tables live. That keeps the compute node stateless and lets your dataset grow past any single volume. The volumes hold only the metadata journal and the cache.

How do I connect Superset, Metabase or dbt to self-hosted StarRocks? Use their MySQL connector against the TCP proxy host and port with root and your SR_ROOT_PASSWORD. For dbt, the dbt-starrocks adapter uses that same connection.

How do I scale StarRocks on Railway? Add another compute node service from the same repository and Dockerfile.cn, pointed at the same frontend. Each node needs its own private hostname, so add services rather than replicas.

My first query after a redeploy was slow — is that normal? Briefly, yes. After a restart the compute node re-attaches its shards and its cache starts empty, so the first scan reads everything from object storage. Wait for a non-zero TabletNum in SHOW COMPUTE NODES, then run one query to warm the cache.

Can StarRocks query data I already have in S3? Yes. External catalogs read Iceberg, Delta Lake, Hudi and Hive tables in place, and you can join them against natively stored tables in one query.


Template Content

starrocks-storage

Bucket

More templates in this category

View Template
NEW
Typesense vs Meilisearch
self-hosted Typesense vs Meilisearch

onepush
0
View Template
Betterlytics
Betterlytics is a cookieless analytics platform GDPR-compliant.

OpenSource Templates
27
View Template
NEW
Finance Tracker
Private multi-user household finance ledger with budgets and CSV import.

wotonews
0