Tunneling cassandra via ssh gives me a connection closed error

Solution 1:

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]