Cassandra port usage - how are the ports used?

NosqlCassandra

Nosql Problem Overview


When experimenting with Cassandra I've observed that Cassandra listens to the following ports:

  • TCP *:8080
  • TCP *:8888
  • TCP *:57311
  • TCP *:57312
  • TCP 127.0.0.1:7000
  • TCP 127.0.0.1:9160
  • UDP 127.0.0.1:700

How does Cassandra use each of the ports listed?

Nosql Solutions


Solution 1 - Nosql

@Schildmeijer is largely right, however port 7001 is still used when using TLS Encrypted Internode communication

So my complete list would be for current versions of Cassandra:

  • 7199 - JMX (was 8080 pre Cassandra 0.8.xx)
  • 7000 - Internode communication (not used if TLS enabled)
  • 7001 - TLS Internode communication (used if TLS enabled)
  • 9160 - Thrift client API
  • 9042 - CQL native transport port

Solution 2 - Nosql

For Apache Cassandra 2.0 you need to take into account the following TCP ports: (See EC2 security group configuration and Apache Cassandra FAQ)

Cassandra

  • 7199 JMX monitoring port
  • 1024 - 65355 Random port required by JMX. Starting with Java 7u4 a specific port can be specified using the com.sun.management.jmxremote.rmi.port property.
  • 7000 Inter-node cluster
  • 7001 SSL inter-node cluster
  • 9042 CQL Native Transport Port
  • 9160 Thrift

DataStax OpsCenter

  • 61620 opscenterd daemon
  • 61621 Agent
  • 8888 Website

Architecture

A possible architecture with Cassandra + OpsCenter on EC2 could look like this: AWS EC2 with OpsCenter

Solution 3 - Nosql

8080 - JMX (remote)

8888 - Remote debugger (removed in 0.6.0)

7000 - Used internal by Cassandra
(7001 - Obsolete, removed in 0.6.0. Used for membership communication, aka gossip)

9160 - Thrift client API

Cassandra FAQ What ports does Cassandra use?

Solution 4 - Nosql

JMX now uses port 7199 instead of port 8080 (as of Cassandra 0.8.xx).

This is configurable in your cassandra-env.sh file, but the default is 7199.

Solution 5 - Nosql

Ports 57311 and 57312 are randomly assigned ports used for RMI communication. These ports change each time Cassandra starts up, but need to be open in the firewall, along with 8080/7199 (depending on version), to allow for remote JMX access. Something that doesn't appear to be particularly well documented, but has tripped me up in the past.

Solution 6 - Nosql

In addition to the above answers, as part of configuring your firewall, if you are using SSH then use port 22.

Solution 7 - Nosql

I resolved issue using below steps :

  1. Stop cassandara services

    sudo su - systemctl stop datastax-agent systemctl stop opscenterd systemctl stop app-dse

  2. Take backup and Change port from 9042 to 9035

    cp /opt/dse/resources/cassandra/conf/cassandra.yaml /opt/dse/resources/cassandra/conf/bkp_cassandra.yaml Vi /opt/dse/resources/cassandra/conf/cassandra.yaml native_transport_port: 9035

  3. Start Cassandra services

    systemctl start datastax-agent
    systemctl start opscenterd
    systemctl start app-dse
    
  4. create cqlshrc file.

    vi  /root/.cassandra/cqlshrc
    
    [connection]
    hostname = 198.168.1.100
    port = 9035
    

Thanks, Mahesh

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionknorvView Question on Stackoverflow
Solution 1 - NosqlMatthew O'RiordanView Answer on Stackoverflow
Solution 2 - NosqljoscasView Answer on Stackoverflow
Solution 3 - NosqlSchildmeijerView Answer on Stackoverflow
Solution 4 - NosqlDavidView Answer on Stackoverflow
Solution 5 - NosqlchrisbunneyView Answer on Stackoverflow
Solution 6 - NosqlKeerthikanth ChowdaryView Answer on Stackoverflow
Solution 7 - Nosqlmahesh agrawalView Answer on Stackoverflow