4

I have a server with two network interfaces. Cassandra is listening on a dedicated internal database network on eth1 (not accessable from outside). So I do my tunnel like this:

ssh -f -N -L9161:192.XXX.XXX.200:9160 [email protected] -P 9922 

Where XXX is the internal database network and YYY is the network where ssh is listening. When I try to cqlsh localhost 9161 I get the follwing exception:

Connection error: ('Unable to connect to any servers', {'localhost': ConnectionShutdown('Connection <AsyncoreConnection(139691023521360) localhost:9161 (closed)> is already closed',)}) 

But when I telnet localhost 9161 I get successfully a telnet shell. And of course cassandra is running.

Any ideas how I can get my tunnel to work?

2 Answers 2

0

I had the same issue, and it ended up looking like an incompatibiltiy between cqlsh 5.0.1 (bundled with Cassandra 2.1.4, installed from their official APT repository) and our old Cassandra 2.0.14 nodes (shipped with DataStax).

Temporarily downgrading to the cqlsh 4.1 bundled with datastax solved the issue.

8

You need to proxy both port 9160 (Cassandra Client port) and port 9042 (CQL native port). Either run two terminals or make the ssh client go background with these flags:

ssh -f -N -q -L 9042:192.XXX.XXX.200:9042 [email protected] -P 9922 ssh -f -N -q -L 9160:192.XXX.XXX.200:9160 [email protected] -P 9922 

Now you should be able to connect with cqlsh on default port at localhost. Localhost is default host as well.

cqlsh -u [username] -p [password] 
3
  • I can telnet both ports but the cqlsh error msg is still the same Commented Mar 3, 2015 at 16:46
  • And both ssh sessions are running? Are you allowed to port forward on the proxy machine? Commented Mar 3, 2015 at 23:33
  • So what is the port supplied to cqlsh on the command-line ? What if I want to have two tunnels to separate cassandra instances ? do I have to use different localhost addresses or something ? Commented May 13, 2015 at 9:13

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.