Skip to content

Terraform module to create a set of Cassandra seed nodes spanning multiple availability zones

Notifications You must be signed in to change notification settings

lcrisci/terraform-cassandra-seeds

Repository files navigation

terraform-cassandra-seeds

Terraform module to create a set of Cassandra seed nodes spanning multiple availability zones

Prerequisites

There are a few prerequisites that are required before using this module:

  • An existing VPC must be created
  • A subnet is created for each availability zone that you wish your Cassandra cluster to be hosted on
  • (Optional) An existing ssh key should be registered with AWS if SSH access to the seed nodes are required

Usage

To consume this module, simply insert a block of code like this into your Terraform module:

module "cassandra_seeds" {
  source = "github.com/devop5/terraform-cassadra-seeds"
  cassandra_cluster_name = "My Cassandra Cluster"
  cassandra_seed_ips = ["10.69.67.128", "10.69.68.128" , "10.69.69.128"]
  ephemeral_disk_device = "/dev/xvdh"
  instance_type = "m3.medium"
  private_subnet_ids = ["subnet-1234abcd", "subnet-5678ghij", "subnet-9876fedc"]
  ssh_public_key = "${file("./public_key.pub")}"
  vpc_id = "vpc-1234abcd"
  vpc_cidr = "10.69.0.0/16"
}

There are more details in the Terraform documentation about modules and how to consume them.

Verification

To verify that the cassandra cluster is created successfully, SSH into one of the seed nodes, and run nodetool status. The documentation has more details.

Design notes

  • Ubuntu 14.04 is used.
  • The seed nodes are hosted on static IP addresses that corresponds to each of the subnets above. This decision was made so that configuration management is easier for the other cassandra nodes should a replacement seed node is required and reprovisioned.
  • Because of the static IP requirement, the seed nodes are individual EC2 instances rather than hosted inside an autoscaling group. However, by varying the number of cassandra_seed_ips and private_subnet_ids one can vary the number of seed nodes created.
  • Cassandra storage is hosted on Amazon EC2 instance store, as this yields superior performance to EBS. There are volume size limits depending on the instance type chosen so choose your instance type wisely
  • In relation to the networking design, the current implementation assumes:
    • one seed node per subnet
    • one subnet per availability zone

Credits and References

About

Terraform module to create a set of Cassandra seed nodes spanning multiple availability zones

Resources

Stars

Watchers

Forks

Packages

No packages published