---
title: "Deploy InfluxDB v2 — Open Source Time Series Database"
description: "Self-host InfluxDB — store & query metrics, IoT & time series data"
category: "Storage"
url: https://railway.com/deploy/influxdb-v2-time-series
---

# Deploy InfluxDB v2 — Open Source Time Series Database

Self-host InfluxDB — store & query metrics, IoT & time series data

**[Deploy InfluxDB v2 — Open Source Time Series Database on Railway](https://railway.com/template/influxdb-v2-time-series)**

- **Creator:** SilverBanana
- **Category:** Storage

## Template content

### influxdb https://res.cloudinary.com/dh2nt6hgh/image/upload/v1761844637/influxdb_logo_a7otsc.svg

- **Image:** influxdb

## Documentation

# Deploy and Host InfluxDB on Railway

InfluxDB is the open-source, purpose-built time series database for metrics, events, and IoT data — the standard backend for monitoring dashboards, sensor telemetry, application metrics, and financial time series. This template deploys **InfluxDB v2**, the mature, full-featured release, pinned to a specific version with a persistent volume and admin credentials configured on first boot, so it's ready to write and query immediately.

---

## What This Template Deploys

| Service | Purpose |
| --- | --- |
| **InfluxDB v2** | The time series database, web UI, and HTTP API on port `8086` |

A single service with a persistent volume at `/var/lib/influxdb2` holding all data, dashboards, and tokens. On first boot it auto-configures an organization, bucket, admin user, and API token — no manual setup wizard.

---

## About Hosting

InfluxDB is in the middle of a generational shift, and picking the right version is the most important decision — this template makes it for you deliberately, and explains why.

**This template uses InfluxDB v2, pinned to a specific version.** v2 is the mature, batteries-included release: the Flux query language, Tasks for scheduled processing, a full web UI with dashboards, and token authentication that works out of the box. It's what most production monitoring and IoT deployments run today.

**Why not v3 Core?** InfluxDB 3 Core is the new engine — SQL and InfluxQL queries, Apache Arrow, sub-10ms reads, unlimited cardinality — and it's impressive, but it's positioned as a single-node release for edge and non-critical workloads, drops the v2 UI and Flux, and has a real deployment trap: with the default file object store, its data-directory environment variables aren't honored and the server fails to start without explicit object-store configuration. For a straightforward, full-featured self-hosted time series database today, v2 is the more reliable choice. If you specifically need v3's SQL engine, that's a deliberate, different setup.

**One thing to know regardless of this template: on September 15, 2026, InfluxDB's Docker `latest` tag switches to v3 Core.** Any deployment pinned to `latest` will jump a major version on that date. This template pins v2 explicitly, so it won't move under you — upgrading stays a decision you make.

On first boot, `DOCKER_INFLUXDB_INIT_MODE=setup` auto-creates your organization, bucket, admin user, and an API token from the init variables, so the instance is usable the moment it's up rather than dropping you at a setup screen.

Typical cost: **~$5–10/month** on Railway depending on data volume. InfluxDB OSS is free; InfluxDB Cloud bills by usage.

---

## How It Compares

| | InfluxDB v2 (this template) | InfluxDB 3 Core | InfluxDB Cloud | TimescaleDB |
| --- | --- | --- | --- | --- |
| Cost model | Flat ~$5–10/mo infra | Flat infra | Per usage | Postgres infra |
| Maturity | Production-ready | Newer, edge-focused | Managed | Mature |
| Query language | Flux, InfluxQL | SQL, InfluxQL | Flux/SQL | SQL (Postgres) |
| Web UI & dashboards | Built-in | Dropped | Yes | Via Grafana |
| Tasks / processing | Built-in | Python engine | Yes | Postgres jobs |
| Self-hostable | Yes | Yes | No | Yes |

InfluxDB 3 Core is the future engine but currently single-node and stripped of the v2 UI and Flux. TimescaleDB is excellent if you want time series on PostgreSQL/SQL. InfluxDB v2 is the sweet spot for a self-hosted, full-featured, purpose-built time series database with a UI, Tasks, and a huge ecosystem (Telegraf, Grafana) today.

---

## Deploy in Under 5 Minutes

1. Click **Deploy on Railway** — InfluxDB v2 builds automatically (~2 minutes)
2. Set `DOCKER_INFLUXDB_INIT_USERNAME`, `_PASSWORD`, `_ORG`, and `_BUCKET` for the initial setup
3. Set `DOCKER_INFLUXDB_INIT_ADMIN_TOKEN` to a strong value — this is your API token
4. Confirm the volume is mounted at `/var/lib/influxdb2`
5. Open your Railway domain, log in to the UI, or start writing data via the HTTP API and token

Point Telegraf, a Grafana data source, or any InfluxDB client at your Railway URL with the token.

---

## Common Use Cases

- **Server and application monitoring** — collect metrics with Telegraf and visualize in the built-in UI or Grafana
- **IoT and sensor data** — ingest high-frequency device telemetry with efficient time-based storage and retention
- **DevOps observability** — store and query infrastructure metrics for dashboards and alerting
- **Financial and market time series** — tick data and analytics with fast time-range queries
- **Home lab and self-hosted metrics** — a private metrics backend for your own servers and services
- **Grafana backend** — a purpose-built time series data source behind your Grafana dashboards

---

## Configuration

| Variable | Required | Description |
| --- | --- | --- |
| `DOCKER_INFLUXDB_INIT_MODE` | Pre-set | `setup` — auto-configures the instance on first boot |
| `DOCKER_INFLUXDB_INIT_USERNAME` | Required | Initial admin username |
| `DOCKER_INFLUXDB_INIT_PASSWORD` | Required | Initial admin password — use a strong value |
| `DOCKER_INFLUXDB_INIT_ORG` | Required | Initial organization name |
| `DOCKER_INFLUXDB_INIT_BUCKET` | Required | Initial bucket (database) name |
| `DOCKER_INFLUXDB_INIT_ADMIN_TOKEN` | Required | Admin API token — set a strong value, keep it safe |
| `DOCKER_INFLUXDB_INIT_RETENTION` | Optional | Data retention period, e.g. `30d` (blank = infinite) |
| `INFLUXD_HTTP_BIND_ADDRESS` | Pre-set | `:8086` so Railway can route to the service |

> **Save your admin token.** `DOCKER_INFLUXDB_INIT_ADMIN_TOKEN` is your API credential for writes and queries. In InfluxDB 2.9+ tokens are hashed on disk and can't be recovered later, so store it somewhere safe at deploy time.

> **Data lives on the `/var/lib/influxdb2` volume.** All buckets, dashboards, tasks, and tokens persist there. Without the volume, everything resets on redeploy. (Note this is the v2 path; InfluxDB 3 uses a different directory.)

---

## Dependencies for InfluxDB Hosting

- Railway account — Hobby plan (~$5–10/month) runs the database
- A persistent Railway volume at `/var/lib/influxdb2` (included)
- Optional: Telegraf for metric collection, Grafana for visualization
- Optional: any InfluxDB client library in your language of choice

### Deployment Dependencies

- [InfluxDB GitHub Repository](https://github.com/influxdata/influxdb)
- [InfluxDB v2 Documentation](https://docs.influxdata.com/influxdb/v2/)
- [InfluxDB Docker Image](https://hub.docker.com/_/influxdb)
- [Railway Volumes Documentation](https://docs.railway.com/volumes)

### Implementation Details

The template runs a pinned InfluxDB v2 image on port `8086` with a persistent volume at `/var/lib/influxdb2`. The version is pinned deliberately rather than tracking `latest`, because on September 15, 2026 the `latest` Docker tag switches to InfluxDB 3 Core — a major version change that would otherwise happen automatically. Pinning keeps upgrades intentional.

`DOCKER_INFLUXDB_INIT_MODE=setup` runs InfluxDB's automated initialization on first boot, creating the organization, bucket, admin user, and API token from the init variables. This replaces the interactive setup wizard, so the instance is ready for writes and queries as soon as it's healthy. From version 2.9 onward, tokens are hashed on disk and can't be retrieved afterward, which is why the admin token should be recorded when you set it.

InfluxDB v2 exposes InfluxDB v1- and v2-compatible HTTP APIs, so Telegraf, Grafana, and existing InfluxDB clients connect using the URL and token. All state persists on the volume across redeploys.

---

## Frequently Asked Questions

**Why v2 instead of v3 Core?** v2 is the mature release with the full UI, Flux, and Tasks, and it's what most production deployments run. v3 Core is newer, single-node, edge-focused, drops the v2 UI, and has a startup pitfall with its default object store. For a straightforward full-featured time series database today, v2 is the safer pick.

**What happens on September 15, 2026?** InfluxDB's Docker `latest` tag switches to v3 Core. Templates using `latest` will jump major versions automatically. This one pins v2, so it won't change under you.

**Do I need to run a setup wizard?** No. `DOCKER_INFLUXDB_INIT_MODE=setup` configures the org, bucket, admin user, and token on first boot from your variables, so the instance is ready immediately.

**Does my data survive a redeploy?** Yes, on the `/var/lib/influxdb2` volume — buckets, dashboards, tasks, and tokens all persist. Without the volume, everything resets.

**How do I connect Telegraf or Grafana?** Point them at your Railway URL with the admin token. Telegraf writes metrics via the v2 API; Grafana adds InfluxDB as a data source with the same URL and token.

**Can I query with SQL?** v2 uses Flux and InfluxQL, not SQL. If you specifically need SQL over time series, that's InfluxDB 3 Core or TimescaleDB — a different setup.

**How do I set data retention?** Set `DOCKER_INFLUXDB_INIT_RETENTION` (e.g. `30d`) at deploy, or adjust bucket retention later in the UI. Leaving it blank keeps data indefinitely.

---

## Why Deploy InfluxDB 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 InfluxDB on Railway you get a full-featured time series database ready to use — v2 pinned deliberately so it won't jump versions, admin credentials and a token set on first boot, a persistent volume for your data, and automatic HTTPS. Store and query metrics, IoT data, and time series at scale, on infrastructure you own.

## 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/influxdb-v2-time-series
