Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to connect to one of our staging Cassandra servers on port 9042 and 9160 here in our company from a dev box.. Through the code, I am not able to connect to it... The program gets hanged at my SELECT query..

So I am wondering is there any way to figure out from my dev box whether these two ports are either blocked on my Cassandra staging servers or not?

Below is the Cassandra staging server url which I am trying to connect from my dev box -

sc-host01.vip.slc.qa.host.com

And my dev box machine url is -

username-dyn-vm1-4.phx-os1.tratus.dev.host.com

Can anyone tell me how to figure out what can be the possible reason to which I am not able to connect to it..

How to check from my dev box whether these ports are opened or not on my Cassandra staging servers?

Update:-

This is what I got when I ran nmap -

ubuntu@username-dyn-vm1-4:~/build$ nmap -p T:9160 sc-host01.vip.slc.qa.host.com

Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-13 20:01 UTC
Nmap scan report for sc-host01.vip.slc.qa.host.com (10.109.107.64)
Host is up (0.0037s latency).
rDNS record for 10.109.107.64: stgcass01-1.vip.slc.qa.host.com
PORT     STATE SERVICE
9160/tcp open  apani1

Nmap done: 1 IP address (1 host up) scanned in 0.19 seconds
ubuntu@username-dyn-vm1-48493:~/build$ nmap -p T:9042 sc-host01.vip.slc.qa.host.com

Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-13 20:02 UTC
Nmap scan report for sc-host01.vip.slc.qa.host.com (10.109.107.64)
Host is up (0.0049s latency).
rDNS record for 10.109.107.64: stgcass01-1.vip.slc.qa.host.com
PORT     STATE SERVICE
9042/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 0.11 seconds

Does that mean port is opened correctly and there is no problem?

And with telnet I get this -

ubuntu@username-dyn-vm1-4:~/build$ telnet sc-host01.vip.slc.qa.host.com 9042
Trying 10.109.107.64...
Connected to stgcass01-1.vip.slc.qa.host.com.
Escape character is '^]'.
^CConnection closed by foreign host.

ubuntu@username-dyn-vm1-4:~/build$ telnet sc-host01.vip.slc.qa.host.com 9160
Trying 10.109.107.64...
Connected to stgcass01-1.vip.slc.qa.host.com.
share|improve this question

2 Answers 2

up vote 1 down vote accepted

From your dev box you could likely just use telnet if it's a TCP port:

telnet sc-host01.vip.slc.qa.host.com 9042
telnet sc-host01.vip.slc.qa.host.com 9160

If you get a timeout error, then the port is blocked.

share|improve this answer
    
After trying this, I got connected to some server name.. Updated my question as well for this test.. –  SSH Oct 13 '13 at 20:10
    
So the question then becomes, is the server you connected to, the one you wanted to connect to ? (ie. eliminate the possibility of a DNS problem...) –  Niall Byrne Oct 13 '13 at 20:15
    
Yeah kind of I guess... –  SSH Oct 13 '13 at 20:17

You can use NMAP to test them (available in most distributions)

nmap -p T:9042 sc-host01.vip.slc.qa.host.com
nmap -p T:9160 sc-host01.vip.slc.qa.host.com

Edit: If the staging server has filtered ports and no response, it's likely that Cassandra server is dead or those ports filtered by IPTables/Firewall

share|improve this answer
    
I should use the above command to run from my dev box? Right? And what is 192.168.1.1? This should be replaced with my staging servers hostname? –  SSH Oct 13 '13 at 19:55
    
btw, I cannot run nmap in my dev box ubuntu machine.. It says command not found? –  SSH Oct 13 '13 at 19:59
    
Run sudo apt-get install nmap first –  Srdjan Grubor Oct 13 '13 at 20:00
    
I just installed and now nmap is working fine.. I updated my question with the details of nmap.. Can you take a look and let me know if those results means port is opened? If it is opened then what can be the other problem? –  SSH Oct 13 '13 at 20:05
    
That means that the server is accepting connections on that port, given the port numbers uniqueness it's most likely your Cassandra server, and that you have (from the nmap testing box) an open communication channel to it. –  Srdjan Grubor Oct 13 '13 at 20:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.