Apache Cassandra CQL
What is Port 9042?
Port 9042 is the default client port for Apache Cassandra's CQL (Cassandra Query Language) native transport protocol. CQL is Cassandra's primary interface for application queries, providing a SQL-like syntax for interacting with the distributed database. When applications connect to Cassandra using drivers (DataStax Java, Python, Go drivers), they connect to port 9042. CQL supports prepared statements, batch operations, user-defined types, and materialized views. The native transport protocol replaced the older Thrift interface (port 9160) as the recommended client connection method. Cassandra's CQL binary protocol is designed for efficiency, supporting frame-level multiplexing and asynchronous query execution.
Common Uses
- Application connections to Cassandra database
- CQL query execution and data manipulation
- Cassandra driver connectivity
- Database administration via cqlsh
Technical Details
Copy-paste commands to check port 9042 (Apache Cassandra CQL) from your terminal
Test connectivity
nc -zv example.com 9042
curl -v --max-time 5 http://example.com:9042/
telnet example.com 9042
nmap -p 9042 -sV example.com
(echo > /dev/tcp/example.com/9042) 2>/dev/null && echo "open" || echo "closed"
Open port in firewall
sudo ufw allow 9042/tcp
sudo iptables -A INPUT -p tcp --dport 9042 -j ACCEPT
sudo firewall-cmd --permanent --add-port=9042/tcp && sudo firewall-cmd --reload
Security Considerations
Enable authentication (PasswordAuthenticator or custom) and authorization (CassandraAuthorizer). Use TLS for client connections (client_encryption_options). Restrict port 9042 to application servers via firewall rules. Implement role-based access control. Never expose Cassandra directly to the internet.
Popular Ports Reference
The most commonly used and referenced network ports