You’ve been running Prometheus on a single node for two years. Retention is set to 30 days because the disk is 500 GB and a single tenant already chews through 12 GB a day. The CFO asks why the P95 latency for the checkout flow looks different than it did a year ago — there’s no answer because the data was rotated out 11 months ago. Then a security audit asks for a metric showing the auth-failure rate during a specific 2-hour window in Q3 last year. You have nothing. The pattern repeats every time someone asks a “what was happening last quarter” question, and every time, the answer is “Prometheus only keeps 30 days.” That’s the gap Mimir closes — and on a single-VM Prometheus, the gap closes the day you wire Mimir up, not eleven months later when you remember to migrate.
What’s happening
Prometheus is excellent at scraping and recent queries but it was never designed for long-term storage. Its local TSDB compresses well, but at high cardinality and any reasonable retention beyond 30-90 days, you hit the inevitable wall: disk pressure, slow queries on cold blocks, and zero horizontal scaling. Mimir is the successor to Cortex — it accepts metrics via remote_write, shards them across ingesters, replicates each series N ways (default 3), flushes compacted blocks to object storage, and serves queries through a horizontally-scalable query frontend. The result is a Prometheus-compatible query API backed by S3 (or any S3-compatible store) with whatever retention you’re willing to pay for.
A production deployment runs at least three nodes so the ingester replication factor of 3 has somewhere to land. Each node runs all the Mimir components in monolithic mode (simpler to operate than microservices for clusters of this size), backed by a consistent hash ring stored in memberlist for service discovery. Prometheus stays in its existing role — scrape targets, evaluate alert rules — but pushes everything to Mimir via remote_write, which you can then query through Grafana as a regular Prometheus datasource.
How to verify
Cluster ring health from any node:
curl -s http://10.20.0.11:8080/ingester/ring | grep -E "ACTIVE|UNHEALTHY|LEAVING"
# Expect 3 ACTIVE ingesters, no UNHEALTHY rows
Confirm the object storage backend is reachable and writing:
# Replace bucket name with yours
aws --endpoint-url https://s3.fr-par.scw.cloud s3 ls s3://acme-mimir-blocks/anonymous/ \
| head -20
# Expect to see hashed tenant directories with /01H... block IDs after first compaction
Verify Prometheus is successfully shipping to Mimir:
# On the Prometheus host
curl -s http://localhost:9090/api/v1/query?query=prometheus_remote_storage_samples_total \
| jq '.data.result[] | {remote: .metric.remote_name, samples: .value[1]}'
If samples increment monotonically and the failure counter (prometheus_remote_storage_samples_failed_total) stays at zero, the pipeline is healthy.
The fix
Save the script as /root/setup-mimir-node.sh and run on each of the three nodes after editing the variables at the top. The installer does base hardening on Ubuntu 22.04 (UFW, fail2ban, unattended-upgrades, SSH key-only), kernel tuning for a high-fan-in service, Mimir 2.13 from the official binary, NGINX in front for HTTPS termination, and a systemd unit with appropriate ulimits. The S3 backend section assumes a Scaleway / MinIO / Wasabi-compatible endpoint — adjust the endpoint line for AWS.
#!/usr/bin/env bash
set -euo pipefail
### Ubuntu 22.04 Grafana Mimir 3-node cluster installer
### Run on each of the 3 nodes after editing the variables
### Assumes private network 10.20.0.0/24 between nodes
### Object storage: any S3-compatible bucket with read+write
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root."
exit 1
fi
# === EDIT PER NODE ===
NODE_NAME="mimir01"
NODE_IP="10.20.0.11"
PEER_IPS=("10.20.0.11" "10.20.0.12" "10.20.0.13")
MIMIR_VERSION="2.13.0"
S3_ENDPOINT="s3.fr-par.scw.cloud"
S3_REGION="fr-par"
S3_BUCKET_BLOCKS="acme-mimir-blocks"
S3_BUCKET_RULER="acme-mimir-ruler"
S3_BUCKET_ALERTS="acme-mimir-alerts"
S3_ACCESS_KEY="CHANGE_ME_ACCESS"
S3_SECRET_KEY="CHANGE_ME_SECRET"
PUBLIC_DOMAIN="mimir.example.com"
# =====================
echo
echo "========================================"
echo "Mimir node ${NODE_NAME} (${NODE_IP})"
echo "========================================"
echo "==> Updating base OS"
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get -y dist-upgrade
apt-get -y install curl wget ca-certificates gnupg lsb-release \
ufw fail2ban unattended-upgrades chrony jq tar gzip \
iproute2 net-tools dnsutils socat nginx certbot python3-certbot-nginx \
htop iotop tcpdump
systemctl enable --now chrony
echo "==> UFW baseline"
ufw default deny incoming
ufw default allow outgoing
ufw allow 22/tcp comment 'ssh'
ufw allow 80/tcp comment 'http'
ufw allow 443/tcp comment 'https'
# Mimir internal: gossip, http, grpc — only from peers
for ip in "${PEER_IPS[@]}"; do
ufw allow from "${ip}" to any port 7946 proto tcp comment 'mimir memberlist tcp'
ufw allow from "${ip}" to any port 7946 proto udp comment 'mimir memberlist udp'
ufw allow from "${ip}" to any port 8080 proto tcp comment 'mimir http'
ufw allow from "${ip}" to any port 9095 proto tcp comment 'mimir grpc'
done
ufw --force enable
echo "==> SSH hardening"
sed -i 's|^[#[:space:]]*PermitRootLogin.*|PermitRootLogin prohibit-password|' /etc/ssh/sshd_config
sed -i 's|^[#[:space:]]*PasswordAuthentication.*|PasswordAuthentication no|' /etc/ssh/sshd_config
systemctl restart ssh
echo "==> fail2ban"
cat > /etc/fail2ban/jail.d/sshd.local <<'FAIL2BAN'
[sshd]
enabled = true
port = ssh
backend = systemd
maxretry = 4
findtime = 10m
bantime = 1h
FAIL2BAN
systemctl enable --now fail2ban
echo "==> Unattended security upgrades"
cat > /etc/apt/apt.conf.d/20auto-upgrades <<'AUTO'
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::AutocleanInterval "7";
AUTO
echo "==> Sysctl tuning for high-fan-in services"
cat > /etc/sysctl.d/99-mimir.conf <<'SYSCTL'
fs.file-max = 2097152
net.core.somaxconn = 8192
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 10240 65535
vm.max_map_count = 262144
SYSCTL
sysctl --system
cat > /etc/security/limits.d/99-mimir.conf <<'LIMITS'
mimir soft nofile 200000
mimir hard nofile 200000
mimir soft nproc 65535
mimir hard nproc 65535
LIMITS
echo "==> Creating mimir user"
id -u mimir >/dev/null 2>&1 || useradd --system --no-create-home --shell /usr/sbin/nologin mimir
mkdir -p /var/lib/mimir /etc/mimir
chown -R mimir:mimir /var/lib/mimir /etc/mimir
echo "==> Downloading Mimir ${MIMIR_VERSION}"
cd /tmp
wget -q "https://github.com/grafana/mimir/releases/download/mimir-${MIMIR_VERSION}/mimir-linux-amd64"
install -o root -g root -m 0755 mimir-linux-amd64 /usr/local/bin/mimir
mimir --version
echo "==> Writing mimir.yml"
cat > /etc/mimir/mimir.yml <<EOF
# Monolithic-mode Mimir, replication factor 3
target: all,alertmanager
multitenancy_enabled: false
server:
http_listen_port: 8080
grpc_listen_port: 9095
log_level: info
common:
storage:
backend: s3
s3:
endpoint: ${S3_ENDPOINT}
region: ${S3_REGION}
access_key_id: ${S3_ACCESS_KEY}
secret_access_key: ${S3_SECRET_KEY}
insecure: false
blocks_storage:
backend: s3
s3:
bucket_name: ${S3_BUCKET_BLOCKS}
bucket_store:
sync_dir: /var/lib/mimir/tsdb-sync
tsdb:
dir: /var/lib/mimir/tsdb
retention_period: 24h
ship_interval: 1m
compactor:
data_dir: /var/lib/mimir/compactor
sharding_ring:
kvstore:
store: memberlist
distributor:
ring:
kvstore:
store: memberlist
ha_tracker:
enable_ha_tracker: false
ingester:
ring:
kvstore:
store: memberlist
replication_factor: 3
instance_addr: ${NODE_IP}
final_sleep: 30s
memberlist:
bind_port: 7946
advertise_addr: ${NODE_IP}
join_members:
- ${PEER_IPS[0]}:7946
- ${PEER_IPS[1]}:7946
- ${PEER_IPS[2]}:7946
querier:
max_concurrent: 16
query_scheduler:
max_outstanding_requests_per_tenant: 1000
ruler:
rule_path: /var/lib/mimir/ruler
ring:
kvstore:
store: memberlist
ruler_storage:
backend: s3
s3:
bucket_name: ${S3_BUCKET_RULER}
alertmanager:
data_dir: /var/lib/mimir/alertmanager
external_url: https://${PUBLIC_DOMAIN}/alertmanager
sharding_ring:
replication_factor: 3
alertmanager_storage:
backend: s3
s3:
bucket_name: ${S3_BUCKET_ALERTS}
limits:
ingestion_rate: 100000
ingestion_burst_size: 200000
max_global_series_per_user: 5000000
compactor_blocks_retention_period: 395d # 13 months
max_query_lookback: 395d
max_label_names_per_series: 50
EOF
chown -R mimir:mimir /etc/mimir
echo "==> Mimir systemd unit"
cat > /etc/systemd/system/mimir.service <<'UNIT'
[Unit]
Description=Grafana Mimir
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=mimir
Group=mimir
ExecStart=/usr/local/bin/mimir -config.file=/etc/mimir/mimir.yml
Restart=on-failure
RestartSec=5s
LimitNOFILE=200000
TimeoutStopSec=120
KillMode=process
[Install]
WantedBy=multi-user.target
UNIT
systemctl daemon-reload
systemctl enable --now mimir
echo "==> NGINX in front of HTTP listener"
cat > /etc/nginx/sites-available/mimir <<EOF
upstream mimir_http {
server 127.0.0.1:8080 max_fails=2 fail_timeout=10s;
keepalive 32;
}
server {
listen 80;
server_name ${PUBLIC_DOMAIN};
location /.well-known/acme-challenge/ { root /var/www/html; }
location / { return 301 https://\$host\$request_uri; }
}
server {
listen 443 ssl http2;
server_name ${PUBLIC_DOMAIN};
# certbot will fill these in
ssl_certificate /etc/letsencrypt/live/${PUBLIC_DOMAIN}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${PUBLIC_DOMAIN}/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
client_max_body_size 50m;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
# remote_write endpoint
location /api/v1/push {
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_pass http://mimir_http;
}
# Query / management endpoints
location / {
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_pass http://mimir_http;
}
}
EOF
ln -sf /etc/nginx/sites-available/mimir /etc/nginx/sites-enabled/mimir
rm -f /etc/nginx/sites-enabled/default
nginx -t
systemctl reload nginx
echo "==> Waiting for HTTP listener"
for i in {1..60}; do
if curl -fs "http://${NODE_IP}:8080/ready" >/dev/null 2>&1; then break; fi
sleep 2
done
echo
echo "========================================"
echo "DONE"
echo "========================================"
echo
echo "Listeners:"
ss -lntp | grep -E ':(80|443|7946|8080|9095)\b' || true
echo
echo "Ring (active ingesters):"
curl -s http://${NODE_IP}:8080/ingester/ring | grep -c ACTIVE || true
echo
echo "Run certbot --nginx -d ${PUBLIC_DOMAIN} after DNS points here."
echo "Repeat on the remaining 2 nodes with their own NODE_NAME/NODE_IP."
After all three nodes are up, run certbot --nginx -d mimir.example.com on the public-facing one (or each, behind a load balancer). On every Prometheus instance, add a remote_write block:
remote_write:
- url: https://mimir.example.com/api/v1/push
basic_auth:
username: prometheus
password: <basic-auth-or-token>
queue_config:
capacity: 10000
max_samples_per_send: 2000
batch_send_deadline: 5s
metadata_config:
send: true
send_interval: 30s
In Grafana, add a Prometheus datasource pointing at https://mimir.example.com/prometheus. Queries that previously hit Prometheus directly now run against 13 months of data with no application change. Watch cortex_ingester_memory_series per node — when one ingester carries 60%+ of series, the ring is unbalanced and you need a rolling restart to rebalance tokens. Watch cortex_compactor_runs_completed_total — if compaction stops running, S3 fills with unmerged blocks and queries get slow.
Run the long-term metrics tier on Stack Harbor’s managed cloud compute with patching, monitoring, and the ring-balance alerts already wired in our monitoring plane — or scope the migration if you’d like us to plan the move off single-node Prometheus.