selfhost.directory

The index of self-hostable projects — ranked, categorized and served with live updates.
Own your data and stop giving it to big tech.

Apache Cassandra logo

Self-host Apache Cassandra

cassandra-5.0.9

Masterless distributed NoSQL database with linear scaling

ReleaseOpen SourceApache-2.0
docker run --name cass_cluster cassandra:latest
Updated2 weeks ago
LanguageJava
Setup difficultyAdvanced
Stars
10 141
Ports
7000 (Internode (cluster) communication), 7001 (Internode communication with SSL enabled), 9042 (CQL native protocol clients), 7199 (JMX (nodetool and other management clients))
Docker
cassandra

What is Apache Cassandra?

Apache Cassandra alternatives

Should you self-host Apache Cassandra?

Apache Cassandra scores 75/100 on selfhost.directory (how scoring works) and ranks #7 of 38 in Databases. It has 10 141 GitHub stars, +29 in the last 30 days.

There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.

Setup is advanced: plan for several services and some ongoing maintenance. An official Docker image is available. It is Apache-2.0-licensed and written mostly in Java.

Its closest alternative on selfhost.directory is etcd (85/100, 52 669 stars). It scores higher overall, so compare the two before you pick. See Apache Cassandra vs etcd side by side.

Features

  • Audit Logging
  • CQL query language
  • Dynamic data masking
  • Encrypted client connections
  • Encrypted internode transport
  • Hinted handoff
  • JMX administration interface
  • Linear scalability
  • Masterless peer-to-peer cluster
  • Multi-datacenter replication
  • Query capture and replay
  • Read repair
  • Role-based Access ControlDisabled by default; requires setting authorizer: CassandraAuthorizer and restarting nodes.
  • Storage-attached indexes (SAI)
  • Vector Search

Apache Cassandra README

License Build Status     Official Downloads Docker Pulls     Slack Bluesky LinkedIn Youtube

Apache Cassandra

Apache Cassandra is a highly-scalable partitioned row store. Rows are organized into tables with a required primary key.

Partitioning means that Cassandra can distribute your data across multiple machines in an application-transparent matter. Cassandra will automatically repartition as machines are added and removed from the cluster.

Row store means that like relational databases, Cassandra organizes data by rows and columns. The Cassandra Query Language (CQL) is a close relative of SQL.

For more information, see the Apache Cassandra web site.

Issues should be reported on The Cassandra Jira.

How to install Apache Cassandra

Install Apache Cassandra with Docker

docker pull cassandra:latest
docker run --name cass_cluster cassandra:latest
docker exec -it cass_cluster cqlsh

The quickstart instead creates a docker network and runs the container as --name cassandra --hostname cassandra.

How to configure Apache Cassandra

  • cluster_name'Test Cluster'Name of the cluster; nodes must share it.
  • storage_port7000TCP port, for commands and data (internode). Should not be exposed to the internet.
  • listen_addresslocalhostAddress or interface to bind to and tell other Cassandra nodes to connect to.
  • native_transport_port9042Port for the CQL native transport to listen for clients on.
  • num_tokens16Number of tokens randomly assigned to this node on the ring.

FAQ

Why can't I call JMX method X in jconsole?

Operations that take array arguments cannot be invoked from jconsole, since it does not support them; you need an array-capable JMX client or your own JMX program.

Does a single seed mean a single point of failure?

The ring still runs and boots without a seed, but you cannot add new nodes, so production systems should configure several seeds.

What are seeds?

Seed nodes are gossip hubs that new nodes contact at startup to discover the rest of the ring; any node can be a seed and a node does not need seeds after it has joined. Two or more seeds per datacenter are recommended, with the list synced across nodes.

Why does top report that Cassandra is using a lot more memory than the Java heap max?

Cassandra memory-maps on-disk files, which consumes virtual address space that tools like top report; on 64-bit systems that is not real memory, and resident pages act as a cache.

How do I unsubscribe from the email list?

Send mail to user-unsubscribe@cassandra.apache.org.

Why are nodes on RHEL unable to join the ring?

Check whether SELinux is enabled and turn it off.

Will batching my operations speed up my bulk load?

No - batches mostly cause latency spikes, so prefer asynchronous INSERTs or true bulk loading. Batching updates inside a single partition is the exception.

Nodetool says "Connection refused to host: 127.0.1.1" for any remote host. What gives?

Nodetool talks over JMX and RMI, and wrong name resolution on either side breaks it. Check /etc/hosts on both ends, or set -Djava.rmi.server.hostname to a reachable interface near the bottom of cassandra-env.sh.

Can I store (large) BLOBs in Cassandra?

Small blobs (a few megabytes) are fine, but Cassandra is not tuned for large files and always reads and sends a whole blob value, so large blobs should be chunked. By default values above 16MiB are rejected through max_mutation_size.

Can I change the replication factor of a keyspace on a live cluster?

Yes, but existing data needs a full repair or cleanup afterwards: run nodetool cleanup when lowering RF and nodetool repair -full when raising it, ideally as rolling repairs at QUORUM or ALL consistency.

Why does nodetool ring only show one entry, even though my nodes logged that they see each other joining the ring?

The nodes were given the same token, usually by cloning a VM that already started Cassandra and generated a token. Wiping the data and commitlog directories makes each node generate a random token on restart.

I delete data from Cassandra, but disk usage stays the same. What gives?

SSTables are immutable, so a delete writes a tombstone marker instead of erasing the value. The space is reclaimed during the first compaction between the data and its tombstone.

What happens to existing data in my cluster when I add new nodes?

A joining node contacts the other nodes itself and streams the data it should own, as described in the topology-changes documentation.

What ports does Cassandra use?

By default 7000 for cluster communication (7001 when SSL is enabled), 9042 for native protocol clients and 7199 for JMX. All of them are TCP, and the data/protocol ports are configurable while the JMX port comes from cassandra-env.sh.

More in Databases

Rate this project

Click to rate — no account needed.

0 comments

Posting as guest
Loading comments…