Self-host Apache Cassandra
cassandra-5.0.9Masterless distributed NoSQL database with linear scaling
docker run --name cass_cluster cassandra:latest- 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))
cassandraWhat is Apache Cassandra?
Apache Cassandra is the Apache Software Foundation's open-source distributed NoSQL database, a partitioned row store in which rows live in tables that require a primary key and are queried with the Cassandra Query Language (CQL), a close relative of SQL. Its cluster is masterless: every node is identical, there is no single point of failure, and data is repartitioned automatically as machines join or leave, so read and write throughput grow linearly with added hardware. Replication can span multiple datacenters, hinted handoff and read repair keep asynchronous writes available, and failed nodes can be replaced without downtime. Observability and compliance tooling is built in, including audit logging of DML, DDL and DCL activity, full query logging with capture and replay through fqltool, nodetool over JMX, and cassandra-stress for load testing. Release 5.0 added vector search built on storage-attached indexes, dynamic data masking, a unified compaction strategy, mathematical CQL functions and JDK 17 support. Self-hosting a node is simple (pull the cassandra image, or unpack the tarball and run bin/cassandra, or install the Debian/RPM packages), while production clusters need Java 11 or 17, listen_address and seed configuration, replication factors per datacenter, and regular repair and compaction maintenance. Note that out of the box authentication and authorization are disabled (AllowAllAuthenticator and AllowAllAuthorizer), so enabling PasswordAuthenticator and CassandraAuthorizer is a deliberate operator step.
Apache Cassandra alternatives
Apache CouchDBSelf-hosted, open-source Apache CouchDB is a document database with an HTTP/JSON API, bi-directional replication for offline-first sync, and multi-server clustering.CompareApache CouchDB with Apache Cassandra
CouchDBSeamless multi-primary syncing database with an intuitive HTTP/JSON API, designed for reliabilityCompareCouchDB with Apache Cassandra
automqSelf-hosted, open-source Apache Kafka fork with stateless brokers that store logs on S3 or MinIO and rebalance partitions in seconds.Compareautomq with Apache Cassandra
cratedbA self-hosted, open-source distributed SQL database with PostgreSQL wire protocol support, for real-time analytics over time-series, full-text and vector data.Comparecratedb with Apache Cassandra
databendSelf-hosted, open-source data warehouse in Rust for large-scale analytics plus vector and full-text search, with Python UDF sandboxes and git-like data branching.Comparedatabend with Apache Cassandra
memgraphSelf-hosted, open-source in-memory graph database with Cypher, vector indexes and the MAGE algorithm library for GraphRAG and real-time graph analytics.Comparememgraph with Apache Cassandra
cloudberryOne advanced and mature open-source MPP (Massively Parallel Processing) database. Open source alternative to Greenplum Database.Comparecloudberry with Apache Cassandra
DruidSelf-hosted open-source OLAP database delivering millisecond analytics on high-cardinality event data, with SQL, JDBC, a web console and native Kafka/Kinesis ingestion.CompareDruid with Apache Cassandra
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
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.
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
Apache CouchDBSelf-hosted, open-source Apache CouchDB is a document database with an HTTP/JSON API, bi-directional replication for offline-first sync, and multi-server clustering.
Apache IoTDBApache IoTDB is a self-hosted, open-source time-series database for industrial IoT with high-throughput reads/writes, ultra-high compression, and SQL-like queries.
arangodbSelf-hosted multi-model database for documents, graphs and key-values, queried in one AQL language; the open-source Community edition is free for non-commercial use.
autobaseOpen-source MIT DBaaS for PostgreSQL: Patroni-based HA clusters, backups, failover and upgrades driven from a web console, Ansible collection or GitOps.
brain-dbSelf-hosted memory database for AI agents with fused semantic, lexical, graph, and temporal retrieval. Single Rust core, binary wire protocol, Apache-2.0.
chromaOpen-source vector database for AI retrieval: dense, sparse, full-text, regex and metadata search. Self-host it with pip, the chroma CLI, or Docker on port 8000.
CondensationAn open-source distributed data system for app builders: conflict-free sync, end-to-end encryption and self-hosted store servers on a file system or MySQL.
CondensationDBAn open-source distributed data system: build apps with its client libraries and run a self-hosted store server, with semilattice merging and end-to-end encryption.
convexThe open-source reactive database for app developers
cratedbA self-hosted, open-source distributed SQL database with PostgreSQL wire protocol support, for real-time analytics over time-series, full-text and vector data.
databasementDatabasement is a self-hosted, open-source database backup manager: register MySQL, PostgreSQL, MongoDB, Redis and more, schedule backups, and restore.
dgraphA horizontally scalable GraphQL database for self-hosted terabyte-scale data. Native GraphQL API with ACID transactions, full-text search, deployed via Docker or source.
0 comments