---
title: "Deploy Milvus"
description: "Vector database for storing embeddings and finding similar items"
category: "Storage"
url: https://railway.com/deploy/milvus-1
---

# Deploy Milvus

Vector database for storing embeddings and finding similar items

**[Deploy Milvus on Railway](https://railway.com/template/milvus-1)**

- **Creator:** A3A
- **Category:** Storage
- **Total deploys:** 1

## Template content

### milvus https://cdn.simpleicons.org/milvus/00A1EA.svg

- **Image:** milvusdb/milvus:v2.6.22
- **Start command:** `/tini -s -- /bin/bash -c 'E="$MILVUS_BUCKET_ENDPOINT"; case "$E" in https://*) MINIO_USE_SSL=true; MINIO_PORT=443; E="${E#https://}";; http://*) MINIO_USE_SSL=false; MINIO_PORT=80; E="${E#http://}";; *) MINIO_USE_SSL=false; MINIO_PORT=9000;; esac; MINIO_ADDRESS="${E%%/*}"; export MINIO_ADDRESS MINIO_PORT MINIO_USE_SSL; CQ=max; CP=100000; read -r CQ CP < /sys/fs/cgroup/cpu.max; if [ "$CQ" != "max" ]; then N=$(( (CQ + CP - 1) / CP )); if [ "$N" -lt 1 ]; then N=1; fi; export GOMAXPROCS="$N" OMP_NUM_THREADS="$N"; fi; echo "railway-start: storage=$MINIO_ADDRESS:$MINIO_PORT ssl=$MINIO_USE_SSL gomaxprocs=${GOMAXPROCS:-host}"; exec milvus run standalone'`
- **Health check:** /healthz

### attu https://raw.githubusercontent.com/zilliztech/attu/v2.6.0/client/public/attu.svg

- **Image:** zilliz/attu:v2.6
- **Health check:** /api/v1/healthy
- **Public domain:** Yes

### etcd https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/etcd.svg

- **Image:** quay.io/coreos/etcd:v3.5.25
- **Health check:** /health

## Buckets

- **milvus-storage**

## Documentation

# Deploy and Host Milvus on Railway

Milvus is an open-source vector database built for similarity search over embeddings. It stores billions of vectors alongside scalar metadata, indexes them for approximate nearest-neighbour lookup, and answers top-k queries in milliseconds with filtering and hybrid full-text search. Teams building retrieval-augmented generation, semantic search, recommendations and image retrieval use it as the retrieval layer behind their models.

Deploy Milvus on Railway and the whole standalone stack arrives wired together: the Milvus server, an etcd service for metadata, a Railway object storage bucket for segment and index data, and Attu — the official web console — as the only publicly reachable service. Your application connects privately at `milvus.railway.internal:19530` while you administer everything through Attu over HTTPS. Authentication is on before first boot, so the database is never exposed with its shipped default password.

![Milvus, etcd and Attu services with object storage on Railway](https://res.cloudinary.com/rroe4rtk/image/upload/v1787648127/milvus-architecture.png)

## Getting Started with Milvus on Railway

Open the Attu URL from the Railway dashboard once the deploy finishes. Attu opens on a connection screen with the Milvus address already filled in — leave it, choose **username/password**, and sign in as `root` with the password from `COMMON_SECURITY_DEFAULTROOTPASSWORD`. The dashboard then shows your Milvus version, deploy mode and database count — the quickest sign that every service is talking to the others.

Your first useful action is creating a collection. Open the `default` database, click **+ Collection**, name it, set the vector field's dimension to match your embedding model (768 for many sentence-transformer models, 1536 for OpenAI's `text-embedding-3-small`), and add scalar fields such as a title. Before saving, open the **Index** tab on the vector field, create an `AUTOINDEX` with a matching metric — `COSINE` for normalised embeddings, `L2` otherwise — and tick *Load collection immediately after creation*. Insert rows from the **Data** tab, then use **Vector Search** to paste a query vector and check the results come back ranked by score.

![Attu dashboard showing Milvus 2.6.22 running in standalone mode](https://res.cloudinary.com/rroe4rtk/image/upload/v1787648130/milvus-attu-overview.png)
![Attu data browser listing six product embedding rows](https://res.cloudinary.com/rroe4rtk/image/upload/v1787648132/milvus-collection-data.png)
![Attu vector search ranking coffee products by cosine score](https://res.cloudinary.com/rroe4rtk/image/upload/v1787648136/milvus-vector-search.png)

## About Hosting Milvus

A vector database solves a problem relational stores handle badly: finding the rows whose embeddings are *closest* to a query embedding, over collections far too large to scan. Milvus separates storage from compute and supports HNSW, IVF, DiskANN and quantised indexes, trading recall against memory. Self-hosting matters when embeddings are sensitive, when per-query pricing on a managed service dominates the bill, or when retrieval belongs beside the app.

Key features:

- Dense, sparse, binary and multi-vector fields in one collection, with hybrid search and reranking
- Built-in BM25 full-text search, so keyword and semantic retrieval share one query path
- Metadata filtering evaluated inside the index scan rather than after it
- Partitions, role-based access control and per-collection privileges
- SDKs for Python, Node.js, Java, Go and C#, plus a RESTful API

This deployment runs Milvus in **standalone** mode, packing the coordinator, proxy, query, data and streaming components into one process — the shape Milvus documents for Docker, since the distributed shape is Kubernetes-only. Standalone needs the same external dependencies as a cluster: **etcd** for schemas, credentials and segment metadata, and **object storage** for the binlogs. A Railway bucket rather than a MinIO container keeps your vector data on durable storage, not one attached disk.

## Why Deploy Milvus on Railway

Railway removes the orchestration work self-hosting Milvus involves:

- Milvus, etcd, object storage and the Attu console deploy together, already wired
- Private networking keeps the database off the public internet, no firewall rules
- Persistent volumes and a managed S3-compatible bucket are provisioned for you
- Health checks and automatic restarts on each service
- Vertical scaling from the dashboard when collections outgrow their memory

## Common Use Cases

- **Retrieval-augmented generation** — fetch the most relevant document chunks for an LLM prompt, filtered by tenant, source or recency
- **Semantic and hybrid product search** — combine BM25 keyword scoring with embedding similarity so queries match on meaning, not wording
- **Recommendations** — represent users and items as vectors, serving "more like this" in one call
- **Image and video retrieval** — index CLIP embeddings for reverse-image lookup and deduplication

## Dependencies for Milvus

- **Milvus** — `milvusdb/milvus:v2.6.22`, the vector database ([milvus-io/milvus](https://github.com/milvus-io/milvus)). Serves gRPC and the RESTful API on 19530 and health on 9091, with its write-ahead log and mmap cache on a volume.
- **etcd** — `quay.io/coreos/etcd:v3.5.25`, the metadata store. Every schema, index descriptor, credential and segment record lives here, so it is a hard dependency, not a cache, and it keeps a volume.
- **Attu** — `zilliz/attu:v2.6`, the official console ([zilliztech/attu](https://github.com/zilliztech/attu)), and the only service with a public domain.
- **Object storage** — a Railway bucket holding the insert, index and statistics binlogs, over the S3 API.

### Environment Variables Reference

| Variable | Service | Purpose |
|---|---|---|
| `COMMON_SECURITY_AUTHORIZATIONENABLED` | milvus | Requires credentials on every request |
| `COMMON_SECURITY_DEFAULTROOTPASSWORD` | milvus | Password for `root`, seeded on first boot |
| `ETCD_ENDPOINTS` | milvus | Private address of the etcd service |
| `MINIO_BUCKET_NAME` | milvus | Bucket holding vector and index data |
| `MILVUS_URL` | attu | Milvus address the console connects to |

Milvus maps any configuration key to an environment variable by removing `.`, `_` and `/` and lowercasing, so `MINIO_USE_SSL` sets `minio.useSSL`. Every key in `milvus.yaml` works this way.

### Deployment Dependencies

- Milvus docs and configuration reference: https://milvus.io/docs
- Docker Hub: https://hub.docker.com/r/milvusdb/milvus, Attu: https://github.com/zilliztech/attu

## Hardware Requirements for Self-Hosting Milvus

| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 2 vCPU | 8 vCPU |
| RAM | 8 GB | 16–32 GB |
| Storage | 5 GB volume + bucket | 20 GB volume + bucket |
| Runtime | Milvus 2.6, etcd 3.5 | Milvus 2.6, etcd 3.5 |

Memory is the binding constraint: loaded collections sit in RAM, so plan on the raw vector size plus index overhead. A million 768-dimension float vectors is roughly 3 GB before indexing, and mmap moves much of that to disk.

## Self-Hosting Milvus

Milvus publishes an official image and a Compose file that runs the same three-part stack locally:

```
curl -sfL https://raw.githubusercontent.com/milvus-io/milvus/v2.6.22/deployments/docker/standalone/docker-compose.yml -o docker-compose.yml
docker compose up -d
```

Install the SDK with `pip install -U pymilvus`, then create a collection, insert a vector and search it:

```
from pymilvus import MilvusClient
client = MilvusClient(uri="http://localhost:19530", token="root:Milvus")
client.create_collection(collection_name="demo", dimension=8)
client.insert("demo", [{"id": 1, "vector": [0.1]*8, "title": "hello"}])
print(client.search("demo", data=[[0.1]*8], limit=3, output_fields=["title"]))
```

On Railway, swap the URI for `http://milvus.railway.internal:19530` from another service in the project and use your own root password.

## Is Milvus Free to Self-Host?

Milvus is free and open source under the Apache 2.0 licence, with no paid tier, seat limit or usage cap in the self-hosted build. Every feature described here — indexes, RBAC, hybrid search, the Attu console — is included, and Zilliz Cloud is an optional managed offering from the project's main contributor. On Railway you pay only for the compute, volumes and storage the services use.

## FAQ

**What is Milvus?**
Milvus is an open-source vector database that indexes high-dimensional embeddings and returns the nearest matches to a query vector in milliseconds, with metadata filtering and hybrid keyword search built in.

**What does this Railway template deploy?**
Four pieces: the Milvus server in standalone mode, etcd for metadata, a Railway object storage bucket for vector and index data, and the Attu console as the public entry point.

**Why does Milvus need etcd and object storage?**
Milvus separates metadata, data and compute by design. etcd holds schemas, credentials and segment records; object storage holds the binlogs that make up the collections. Neither is optional in either mode.

**How do I connect my application to self-hosted Milvus?**
Deploy your app into the same Railway project and point your SDK at `milvus.railway.internal:19530` with the token `root:` plus your password. Milvus has no public domain, so traffic stays on the private network; gRPC cannot cross Railway's HTTP edge, and in-project HTTP clients use the RESTful API v2 on the same port.

**Which Attu version works with which Milvus version?**
They must match: Attu 2.6 supports Milvus 2.6 and Attu 3.x supports Milvus 3.x. This template pins both to the 2.6 line so the console and the server never drift apart.


## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/milvus-1
