---
title: "Deploy StarRocks"
description: "Analyze data fast with real-time OLAP and MySQL-compatible SQL."
category: "Analytics"
url: https://railway.com/deploy/starrocks
---

# Deploy StarRocks

Analyze data fast with real-time OLAP and MySQL-compatible SQL.

**[Deploy StarRocks on Railway](https://railway.com/template/starrocks)**

- **Creator:** INF Labs
- **Category:** Analytics

## Template content

### starrocks https://www.gravatar.com/avatar/26712e45547dddc52f8c9671fe6e75b8?s=80&r=g&d=mm

- **Image:** starrocks/allin1-ubuntu:4.1.4
- **Start command:** `/bin/bash -c 'mkdir -p "$STARROCKS_META_DIR" "$STARROCKS_STORAGE_ROOT"; sed -i "/^[[:space:]]*meta_dir[[:space:]]*=/d" /data/deploy/starrocks/fe/conf/fe.conf; sed -i "/^[[:space:]]*storage_root_path[[:space:]]*=/d" /data/deploy/starrocks/be/conf/be.conf; sed -i "/^[[:space:]]*JAVA_OPTS[[:space:]]*=/d" /data/deploy/starrocks/fe/conf/fe.conf; printf "\nmeta_dir = %s\nJAVA_OPTS=\"-Dlog4j2.formatMsgNoLookups=true -Xmx%s -XX:+UseG1GC -Djava.security.policy=/data/deploy/starrocks/fe/conf/udf_security.policy\"\n" "$STARROCKS_META_DIR" "$STARROCKS_FE_HEAP" >> /data/deploy/starrocks/fe/conf/fe.conf; printf "\nstorage_root_path = %s\n" "$STARROCKS_STORAGE_ROOT" >> /data/deploy/starrocks/be/conf/be.conf; exec /data/deploy/entrypoint.sh'`
- **Public domain:** Yes

## Documentation

# Deploy and Host StarRocks on Railway

StarRocks is a high-performance analytical database designed for real-time OLAP, fast aggregations, interactive analytics, and BI workloads. This template runs StarRocks as a single Railway service with integrated Frontend (FE) and Backend (BE) components, MySQL-compatible SQL access, persistent storage, and HTTP administration endpoints.

## About Hosting StarRocks

Hosting StarRocks on Railway gives you a complete analytical database in a compact single-service deployment.

The official all-in-one image runs both StarRocks Frontend and Backend components inside the same container. The FE handles metadata, SQL access, query planning, and cluster management, while the BE stores analytical data and executes query workloads.

A single Railway Volume persists both FE metadata and BE data under separate directories, keeping the deployment simple while preserving database state across redeployments.

## Common Use Cases

- Run real-time analytical queries
- Build OLAP workloads with fast aggregations
- Power dashboards and BI applications
- Query large structured datasets
- Build analytics backends for applications
- Analyze event, log, and transactional data
- Use MySQL-compatible clients and drivers

## Dependencies for StarRocks Hosting

- StarRocks all-in-one runtime
- Persistent Railway Volume for metadata and analytical data
- Railway HTTP networking for FE HTTP/API access
- Railway TCP networking for MySQL-compatible SQL access

## Architecture

```text
                 StarRocks
             Single Railway Service
                      │
          ┌───────────┴───────────┐
          ▼                       ▼
   Frontend (FE)             Backend (BE)
   Query Planning            Data Storage
   Metadata                  Query Execution
   SQL Gateway               Aggregations
          │                       │
          └───────────┬───────────┘
                      │
                      ▼
              Railway Volume
               /data/persist
               ├── fe-meta
               └── be-storage
````

The Frontend is responsible for:

* SQL query parsing and planning
* Metadata management
* MySQL-compatible SQL access
* Cluster management
* HTTP administration and status endpoints

The Backend is responsible for:

* Analytical data storage
* Query execution
* Scans and aggregations
* Data processing

The official all-in-one runtime manages both components inside the same service.

## Public Interfaces

StarRocks exposes two useful interfaces through Railway:

| Interface |   Port | Purpose                                  |
| --------- | -----: | ---------------------------------------- |
| HTTP      | `8030` | FE HTTP/API and administrative endpoints |
| TCP       | `9030` | MySQL-compatible SQL connections         |

The HTTP endpoint is primarily intended for administration, status, and API access. It is not a full analytics dashboard.

The TCP endpoint is the primary interface for applications, database clients, and BI tools.

## How to Use

### Access the HTTP Endpoint

Open the Railway public domain configured for port `8030`.

This endpoint provides StarRocks FE HTTP and administrative functionality.

### Connect with a SQL Client

Use the Railway TCP Proxy configured for port `9030`.

StarRocks uses the MySQL protocol, so you can connect with tools such as:

* DBeaver
* MySQL CLI
* JDBC
* Python MySQL drivers
* BI and analytics platforms

Example connection settings:

```text
Driver: MySQL
Host: <RAILWAY_TCP_PROXY_HOST>
Port: <RAILWAY_TCP_PROXY_PORT>
Username: root
Password: none
```

Fresh StarRocks installations use the `root` user without a password by default.

Verify the deployment:

```sql
SHOW FRONTENDS;
SHOW BACKENDS;
```

The integrated Backend should appear as alive and available.

### Create a Database

```sql
CREATE DATABASE analytics;
```

### Create a Table

```sql
CREATE TABLE analytics.events (
    event_time DATETIME,
    user_id BIGINT,
    event_type VARCHAR(64)
)
DUPLICATE KEY(event_time, user_id)
DISTRIBUTED BY HASH(user_id);
```

### Query Data

```sql
SELECT
    event_type,
    COUNT(*) AS total
FROM analytics.events
GROUP BY event_type;
```

## StarRocks vs Similar Platforms

| Feature                         | StarRocks | ClickHouse | PostgreSQL | DuckDB |
| ------------------------------- | --------: | ---------: | ---------: | -----: |
| Real-time OLAP                  |         ✅ |          ✅ |         ⚠️ |      ✅ |
| Analytical SQL                  |         ✅ |          ✅ |         ⚠️ |      ✅ |
| Persistent database storage     |         ✅ |          ✅ |          ✅ |      ✅ |
| MySQL-compatible protocol       |         ✅ |         ⚠️ |          ❌ |      ❌ |
| Fast aggregations               |         ✅ |          ✅ |         ⚠️ |      ✅ |
| Distributed architecture        |         ✅ |          ✅ |         ⚠️ |      ❌ |
| FE/BE architecture              |         ✅ |          ❌ |          ❌ |      ❌ |
| BI workloads                    |         ✅ |          ✅ |          ✅ |      ✅ |
| Transactional workloads         |        ⚠️ |          ❌ |          ✅ |      ❌ |
| Horizontal scale-out capability |         ✅ |          ✅ |         ⚠️ |      ❌ |

StarRocks is a strong fit for real-time analytics and BI workloads where low-latency SQL and high-throughput aggregation performance are important.

ClickHouse is also highly optimized for analytical workloads, while PostgreSQL is generally better suited for transactional systems. DuckDB is ideal for lightweight and embedded analytics, while StarRocks is designed as a persistent server-side OLAP database.

## Persistent Storage

This template uses a single Railway Volume mounted at:

```text
/data/persist
```

Both important StarRocks data areas are stored inside that volume:

```text
/data/persist
├── fe-meta
│   └── Frontend metadata
│
└── be-storage
    └── Analytical table data
```

The FE metadata preserves database and cluster state, while the BE storage directory contains analytical table data.

Do not remove the volume if the deployment contains data you want to preserve.

## Deployment Model

This template uses StarRocks' official all-in-one image in `shared_nothing` mode.

The all-in-one runtime manages:

* Frontend startup
* Backend startup
* Internal FE/BE communication
* Backend registration
* Process supervision

This keeps the Railway deployment to one service while retaining the core FE/BE architecture of StarRocks.

The all-in-one deployment is best suited for development, evaluation, analytics services, and workloads where a compact single-service StarRocks deployment is preferred.

For larger or highly available environments, StarRocks can also be deployed using separate Frontend and multiple Backend or Compute Node services.

## Security Notice

Fresh StarRocks installations use the `root` SQL user without a password.

After deployment, set a strong password before exposing SQL access to untrusted clients.

Example:

```sql
SET PASSWORD = PASSWORD('your-strong-password');
```

The SQL endpoint should only be exposed when external database access is required.

## Why Deploy StarRocks on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying StarRocks on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

## Similar templates

- [Betterlytics](https://railway.com/deploy/betterlytics) — Betterlytics is a cookieless analytics platform GDPR-compliant.
- [Finance Tracker](https://railway.com/deploy/finance-tracker-1) — Private multi-user household finance ledger with budgets and CSV import.
- [Matomo Analytics + MariaDB](https://railway.com/deploy/matomo-analytics-mariadb) — Privacy-friendly analytics with MariaDB and persistent volumes.

Open this page in a browser: https://railway.com/deploy/starrocks
