#16 8 pages

Databases on VMs (On-Prem)

Running stateful databases on bare VMs — firewall rules, config tuning, replica set bootstrap, user management, and Prometheus monitoring for each database.

0/0 checks

Why VMs Instead of Kubernetes?

Running databases directly on VMs skips the Kubernetes storage and operator layer — simpler to reason about, easier to tune at the OS level, and often the only option when Kubernetes isn't available or the team doesn't have K8s expertise.

When VMs make more sense than K8s:

  • On-prem infrastructure without a Kubernetes platform
  • Teams that are strong on Linux/systemd but not on K8s storage and operators
  • Databases that need direct NUMA/CPU pinning or non-standard kernel tuning
  • Compliance environments where workload isolation must be at the hypervisor level

Why would a team choose to run databases on bare VMs instead of Kubernetes, even if Kubernetes is available?

Files

File Database Topics
mysql.md MySQL Master/replica GTID replication, my.cnf tuning, XtraBackup hot backup, restore runbook, GCS upload, cron, permissions gotchas
mongodb.md MongoDB Replica set on VMs, firewall rules, mongod.conf, cacheSizeGB, users, write concern, mongodb-exporter
etcd.md etcd 3-node cluster on VMs, TLS certs, systemd config, member ops, snapshot backup, disaster recovery
postgres.md PostgreSQL Primary/standby streaming replication, WAL archiving, pgBackRest, PITR restore runbook, manual failover, Prometheus monitoring
redis.md Redis Primary + 2 replicas + Sentinel HA, RDB/AOF config, BGSAVE-on-replica backup, restore from RDB, redis_exporter monitoring
kafka.md Apache Kafka 3-broker cluster, ZooKeeper setup, KRaft mode, producer/consumer tuning, JVM tuning, JMX Prometheus monitoring, MirrorMaker2 DR
elasticsearch.md Elasticsearch 3-node cluster, node roles, heap sizing, ILM hot/warm/cold, S3 snapshots, shard strategy, monitoring
clickhouse.md ClickHouse 2-shard×2-replica cluster, ClickHouse Keeper vs ZooKeeper, Distributed tables, tiered storage, native backup

Common Patterns

graph TD
    classDef primary fill:#e74c3c,stroke:#c0392b,color:#fff
    classDef replica fill:#3498db,stroke:#2980b9,color:#fff
    classDef arbiter fill:#f39c12,stroke:#d68910,color:#fff

    P["Primary VM<br/>accepts all writes<br/>holds full data"]:::primary
    S["Secondary VM<br/>tails oplog / WAL<br/>read-only traffic"]:::replica
    A["Arbiter VM<br/>vote-only<br/>no data copy"]:::arbiter

    P -->|"replication stream"| S
    P -->|"heartbeat"| A
    S -->|"heartbeat"| A

In the diagram above, why does the replication stream flow only from Primary → Secondary, while heartbeats are bidirectional between all three nodes?

Firewall rules come first. Every VM-based cluster depends on nodes reaching each other on the database port. Set rules and verify with nc -zv before touching any config file — a firewall problem looks identical to a config bug and wastes hours.

What is the recurring four-step pattern across every VM-hosted database setup, regardless of which database you are deploying?

Pages in this section

1
MySQL Master/Replica — VM Cluster Setup
Two VMs: one Master (all writes) and one Replica (hot-standby + backup source). This guide walks every step from bare OS to a production-ready GTID-replicated c
2
MongoDB Replica Set — VM Cluster Setup
Three VMs: one Primary, one Secondary, one Arbiter. This guide walks every step from bare OS to a monitored, production-ready replica set — firewall rules, mong
3
etcd Cluster — VM Setup
Three VMs: etcd-1 (10.0.0.1), etcd-2 (10.0.0.2), etcd-3 (10.0.0.3). This guide walks every step from bare OS to a production-ready etcd cluster — TLS mutual aut
4
PostgreSQL Primary/Standby Replication & Backup on VMs
Two VMs: one primary (all writes) and one warm standby (streaming replication + backup source). This guide walks every step from bare OS to a production-ready c
5
Redis Sentinel Cluster & Backup on VMs
Production runbook: Redis primary with two replicas, three Sentinel processes for automatic failover, RDB/AOF backup via replica BGSAVE, and Prometheus monitori
6
Apache Kafka — VM Cluster Setup
Three-broker Kafka cluster on bare-metal VMs: ZooKeeper quorum, broker configuration, topic management, producer/consumer tuning, JVM G1GC, JMX Prometheus monit
7
Elasticsearch — VM Cluster Setup
Three-node Elasticsearch cluster on bare-metal VMs: node roles, heap sizing, shard strategy, Index Lifecycle Management, snapshot repository, and Prometheus mon
8
ClickHouse — VM Cluster Setup
Two-shard, two-replica ClickHouse cluster on bare-metal VMs: ClickHouse Keeper for coordination, ReplicatedMergeTree table engine, distributed tables, tiered st