Cassandra on Google Cloud Platform
This guide covers deploying Apache Cassandra on Google Cloud Platform.
Instance Types
Section titled “Instance Types”Recommended Machine Types
Section titled “Recommended Machine Types”| Use Case | Machine Type | vCPUs | RAM | Notes |
|---|---|---|---|---|
| Development | n2-standard-2 | 2 | 8GB | Testing only |
| Small Prod | n2-highmem-4 | 4 | 32GB | Small workloads |
| Standard Prod | n2-highmem-8 | 8 | 64GB | Recommended |
| High Perf | n2-highmem-16 | 16 | 128GB | Heavy workloads |
Storage Options
Section titled “Storage Options”# Persistent Disk optionspd-ssd: iops: "Read: 15K-100K, Write: 15K-30K" throughput: "Read: 240-1200 MB/s" use_case: "General production"
pd-extreme: iops: "Up to 120K" throughput: "Up to 2400 MB/s" use_case: "High performance"
# Local SSD (ephemeral)local-ssd: iops: "680K read, 360K write" size: "375GB per disk" note: "Data lost on maintenance/stop"Network Configuration
Section titled “Network Configuration”VPC Set up
Section titled “VPC Set up”# Terraform exampleresource "google_compute_network" "cassandra" { name = "cassandra-network" auto_create_subnetworks = false}
resource "google_compute_subnetwork" "cassandra" { count = 3 name = "cassandra-subnet-${count.index}" ip_cidr_range = "10.0.${count.index}.0/24" region = var.region network = google_compute_network.cassandra.id}Firewall Rules
Section titled “Firewall Rules”resource "google_compute_firewall" "cassandra_internal" { name = "cassandra-internal" network = google_compute_network.cassandra.name
allow { protocol = "tcp" ports = ["7000", "7001", "7199", "9042"] }
source_tags = ["cassandra"] target_tags = ["cassandra"]}Snitch Configuration
Section titled “Snitch Configuration”GoogleCloudSnitch
Section titled “GoogleCloudSnitch”endpoint_snitch: GoogleCloudSnitch
# Automatically detects:# - DC = project:region (e.g., myproject:us-central1)# - Rack = zone (e.g., us-central1-a)Deployment with GKE
Section titled “Deployment with GKE”# Kubernetes StatefulSetapiVersion: apps/v1kind: StatefulSetmetadata: name: cassandraspec: serviceName: cassandra replicas: 3 selector: matchLabels: app: cassandra template: metadata: labels: app: cassandra spec: containers: - name: cassandra image: cassandra:4.1 ports: - containerPort: 9042 - containerPort: 7000 volumeMounts: - name: cassandra-data mountPath: /var/lib/cassandra volumeClaimTemplates: - metadata: name: cassandra-data spec: accessModes: ["ReadWriteOnce"] storageClassName: premium-rwo resources: requests: storage: 500GiMulti-Zone Deployment
Section titled “Multi-Zone Deployment”Next Steps
Section titled “Next Steps”- Azure Deployment - Azure guide
- Kubernetes - GKE deployment