I am trying to connect to a cassandra installation from a remote machine. Cassandra is running the thrift service on 9160 which is the default port. But I cannot connect the DB and I always get connection timed out exception. Here are the details.
- the app machine trying to connect to the DB is a CentOS 7 VM
- Cassandra is running on windows 10 on port 9160
I ran the nmap
and netstat
commands to see the status of the ports and these are the outputs that I got
x.y.z.z
- IP of the machine where cassandra is running
a.b.c.d
- IP of the machine where application is running
Ouput From running nmap from a.b.c.d:
Bash$ nmap -r -p 9160 x.y.z.z
Starting Nmap 6.40 ( http://nmap.org ) at 2018-05-30 04:02 PDT
Nmap scan report for x.y.z.z
Host is up (0.0016s latency).
PORT STATE SERVICE
9160/tcp closed apani1
When I run netstat
on the DB machine(x.y.z.z
) I see that the DB app is listening on 9160 port.
TCP x.y.z.z:63572 stackoverflow:https ESTABLISHED
TCP x.y.z.z:63735 stackoverflow:https ESTABLISHED
TCP x.y.z.z:64856 stackoverflow:https ESTABLISHED
TCP 127.0.0.1:6942 x.y.z.z:0 LISTENING
TCP 127.0.0.1:7000 x.y.z.z:0 LISTENING
TCP 127.0.0.1:9042 x.y.z.z:0 LISTENING
TCP 127.0.0.1:9042 x.y.z.z:55317 ESTABLISHED
TCP 127.0.0.1:9042 x.y.z.z:55329 ESTABLISHED
TCP 127.0.0.1:9160 x.y.z.z:0 LISTENING
TCP 127.0.0.1:50135 x.y.z.z:50136 ESTABLISHED
I added an inbound rule specifically for port 9160 in the DB machine. but that didn't help and I still get the connection timed out error.
My question:
- Why is the DB machine not connection even though host is up and the port is listening?
- Why does the
nmap
command show the port as closed? I can see from the cassandra start up log that the thrift service is listening on the port 9160.