1. Ports
  2. Port 9042

Port 9042 is the native protocol port for Apache Cassandra, a distributed database that stores the memories of the modern Internet. When Netflix remembers where you paused a show, when Instagram loads your feed, when Apple serves you an app from the App Store, the data flows through this port.

This is the port of remembrance at scale.

What Port 9042 Does

Port 9042 carries CQL (Cassandra Query Language) traffic between applications and Cassandra database clusters.1 It is the modern native protocol interface, replacing the older Thrift protocol that ran on port 9160.

When your application needs to write data to Cassandra, or read it back, it opens a TCP connection to port 9042 and speaks a binary protocol designed specifically for distributed database operations.2 The protocol supports asynchronous communication, meaning a single connection can handle multiple requests simultaneously without waiting for responses, which is essential when you're querying a database cluster that might span multiple continents.

How the Protocol Works

The CQL native protocol is a binary protocol specifically designed for Cassandra.3 Unlike its predecessor Thrift, which was a generic RPC framework, the native protocol was built from the ground up to handle the unique challenges of distributed database communication.

Every message gets a stream ID. When you send a query, it carries an identifier. When the response comes back, it carries the same identifier. This lets a single connection multiplex dozens of concurrent requests without confusion.4 A client library maintaining connections to a 1,000-node cluster doesn't need thousands of connections per node. A handful will do.

The protocol supports several message types:

  • STARTUP initiates the connection
  • QUERY sends a CQL statement
  • PREPARE and EXECUTE handle prepared statements for efficiency
  • BATCH groups multiple operations
  • REGISTER subscribes to cluster events like topology changes5

When a node joins the cluster, leaves, or fails, the server can push notifications to registered clients. Your application doesn't need to poll. The cluster tells you when the world changes.

The Story Behind Cassandra

In 2007, Facebook had a problem. They wanted to let users search through their inbox messages, but they had hundreds of millions of users sending billions of messages.6 Traditional databases couldn't handle the write throughput. They couldn't scale horizontally. They couldn't survive datacenter failures without downtime.

Prashant Malik, one of Facebook's first 50 engineers, was wrestling with this problem when Avinash Lakshman joined the company.7 Lakshman had just come from Amazon, where he had helped build Dynamo, the distributed key-value store that powered Amazon's shopping cart.8 At Amazon, a datacenter outage that caused shopping cart downtime meant losing millions of dollars. So Dynamo was built to survive anything.

When the two engineers got together, something clicked. Lakshman knew how to build systems that never go down. Both knew Google had published a paper on Bigtable, their system for storing massive structured datasets. The question emerged: what if you put Bigtable's data model on top of Dynamo's distributed architecture?9

They started building during a Facebook hackathon.10 Within a year, they had something that worked. In June 2008, Facebook launched inbox search for 100 million users, powered by their new creation.11 The system stored terabytes of indexes across 600+ cores and 120+ TB of disk space.12

They named it Cassandra.

Why "Cassandra"?

In Greek mythology, Cassandra was a princess of Troy. Apollo, god of prophecy, fell in love with her and offered her the gift of seeing the future in exchange for her affection.13 She accepted the gift, then refused his advances. Furious but unable to revoke a divine gift, Apollo cursed her: she would always speak true prophecies, but no one would ever believe her.14

Cassandra warned the Trojans about the wooden horse. They ignored her. Troy fell.

The database's creators named it after this tragic prophetess, thinking it would become bigger than Oracle.15 There's also a darker resonance: distributed systems deal in eventual consistency, where the truth propagates gradually across nodes. In a Cassandra cluster, different replicas might briefly disagree about reality. The truth is always there, spoken by at least one node, but not everyone believes it yet.

Eventually, they all do.

The Architecture

Cassandra combines two revolutionary ideas from the 2000s distributed systems renaissance.16

From Amazon's Dynamo, it takes the distributed hash ring. Every node in a Cassandra cluster is equal, there's no single master, no single point of failure.17 Data is distributed across nodes using consistent hashing, so when you add or remove a node, only a fraction of the data needs to move.18 Nodes discover each other through a gossip protocol, exchanging state information every second.19

From Google's Bigtable, it takes the data model. Data is organized into tables with rows and columns, but the underlying storage is a log-structured merge tree optimized for write-heavy workloads.20

The result is a database that can:

  • Handle millions of writes per second
  • Survive multiple node failures without data loss
  • Replicate data across data centers on different continents
  • Scale horizontally by adding commodity hardware

Who Uses Cassandra Today

The numbers are staggering.

Apple runs more than 160,000 Cassandra instances storing over 100 petabytes of data across 1,000+ clusters.21 At least one cluster exceeds 1,000 nodes and handles millions of operations per second. The App Store and iTunes run on Cassandra.

Netflix stores 98% of their streaming data in Cassandra, everything from your viewing history to your billing information.22 They run hundreds of clusters, tens of thousands of nodes, handling over 1 trillion requests per day across petabytes of data.

Instagram stores user profiles and feeds in Cassandra.23

Uber has run Cassandra as a service for over six years, powering mission-critical workloads at millions of queries per second.24

The list continues: Facebook, Spotify, eBay, Twitter, Walmart, Target, Macy's, Best Buy, Bloomberg, CERN, GitHub, Hulu, and thousands more.25

Security Considerations

Cassandra was designed to run inside trusted networks, accessed by trusted clients.26 This design assumption has led to several security vulnerabilities over the years.

CVE-2021-44521 allowed remote code execution through user-defined functions when certain non-default configuration options were enabled.27 An attacker with permission to create functions could execute arbitrary code on the server.

CVE-2020-13946 allowed local attackers to capture JMX credentials through a man-in-the-middle attack on the RMI registry.28

CVE-2018-8016 exposed an unauthenticated JMX interface to all network interfaces in default configurations.29

CVE-2025-24860 allowed users to escalate their data center access permissions, discovered in early 2025.30

CQL injection is theoretically possible but practically limited. Researchers have found no way to perform the kind of devastating SQL injection attacks possible with traditional databases.31 Cassandra's query language is more restrictive by design.

The consistent lesson: Cassandra should never be exposed directly to the Internet. Port 9042 belongs behind firewalls, VPNs, and authentication layers.

The Transition from Thrift

Cassandra didn't always speak through port 9042.

The original protocol ran on port 9160 using Apache Thrift, a cross-language RPC framework.32 Thrift worked, but it had limitations: it was synchronous (one request per connection at a time), it couldn't push server events to clients, and it exposed Cassandra's internal storage structure directly to applications.33

Starting with Cassandra 1.2, the native protocol on port 9042 became available.34 It offered asynchronous multiplexing, server-push notifications, optional compression, and an abstraction layer that hid implementation details.

Cassandra 2.1 made the native protocol the default.35 Cassandra 4.0 removed Thrift support entirely.36

If you see traffic on port 9160 today, you're looking at legacy infrastructure that hasn't been updated in nearly a decade.

  • Port 7000: Cassandra inter-node cluster communication (unencrypted)
  • Port 7001: Cassandra inter-node cluster communication (TLS encrypted)
  • Port 7199: Cassandra JMX monitoring
  • Port 9160: Legacy Thrift client port (deprecated)
  • Port 9142: Native protocol with TLS (secure alternative to 9042)

Frequently Asked Questions

Was this page helpful?

๐Ÿ˜”
๐Ÿคจ
๐Ÿ˜ƒ
Port 9042: Cassandra โ€” The Database That Remembers Everything โ€ข Connected