You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Andrea Giordano <an...@gmail.com> on 2017/11/30 18:38:59 UTC

can't reach cassandra outside my lan

Hi, osx user here.
I have installed a simple Cassandra db on my laptop and I would like to query it outside the Lan.
So I set port forwarding and port triggering on my router (vodafone station) to link external 9042 to internal 9042.

Moreover I set on cassandra.yaml the broadcast_rpc_address to my router ip.

Unfortunately, when I try to connect using java api I obtain:

Exception in thread "main" com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /HERE_THERE_IS_ROUTER_IP:9042 (com.datastax.driver.core.exceptions.TransportException: [/HERE_THERE_IS_ROUTER_IP:9042] Cannot connect))

I noted that without setting broadcast_rpc_address I can reach Cassandra trough 127.0.0.1 so the database is active and running.

I’ve also tried  

lsof -n -i4TCP:9042 | grep LISTEN

and I obtain 

java    7555 giordano  184u  IPv4 0x513195612572e265      0t0  TCP 127.0.0.1:9042 (LISTEN)

when I unset broadcast_rpc_address
and no output when I set broadcast_rpc_address.
Is the problem in the yaml settings on in the router settings?


P.S.: I have also modifying listen_address in the same way, without good news.
P.P.S: clearly each time I edited the yaml file I restarted cassandra

Re: can't reach cassandra outside my lan

Posted by Andrea Giordano <an...@gmail.com>.
just tried, without results.
telnet my_ip 9042 returns connection refused and lsof -n -i4TCP:9042 | grep LISTEN
returns no output

> On 30 Nov 2017, at 19:42, Jon Haddad <jo...@jonhaddad.com> wrote:
> 
> Cassandra is listening on your localhost address, 127.0.0.1, not your laptop’s address on the network.  Set rpc_address to the address on your network, or use rpc_interface and let Cassandra figure it out.
> 
>> On Nov 30, 2017, at 10:38 AM, Andrea Giordano <andrea.giordano.inf@gmail.com <ma...@gmail.com>> wrote:
>> 
>> Hi, osx user here.
>> I have installed a simple Cassandra db on my laptop and I would like to query it outside the Lan.
>> So I set port forwarding and port triggering on my router (vodafone station) to link external 9042 to internal 9042.
>> 
>> Moreover I set on cassandra.yaml the broadcast_rpc_address to my router ip.
>> 
>> Unfortunately, when I try to connect using java api I obtain:
>> 
>> Exception in thread "main" com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /HERE_THERE_IS_ROUTER_IP:9042 (com.datastax.driver.core.exceptions.TransportException: [/HERE_THERE_IS_ROUTER_IP:9042] Cannot connect))
>> 
>> I noted that without setting broadcast_rpc_address I can reach Cassandra trough 127.0.0.1 so the database is active and running.
>> 
>> I’ve also tried  
>> 
>> lsof -n -i4TCP:9042 | grep LISTEN
>> 
>> and I obtain 
>> 
>> java    7555 giordano  184u  IPv4 0x513195612572e265      0t0  TCP 127.0.0.1:9042 (LISTEN)
>> 
>> when I unset broadcast_rpc_address
>> and no output when I set broadcast_rpc_address.
>> Is the problem in the yaml settings on in the router settings?
>> 
>> 
>> P.S.: I have also modifying listen_address in the same way, without good news.
>> P.P.S: clearly each time I edited the yaml file I restarted cassandra
> 


Re: can't reach cassandra outside my lan

Posted by Jon Haddad <jo...@jonhaddad.com>.
Cassandra is listening on your localhost address, 127.0.0.1, not your laptop’s address on the network.  Set rpc_address to the address on your network, or use rpc_interface and let Cassandra figure it out.

> On Nov 30, 2017, at 10:38 AM, Andrea Giordano <an...@gmail.com> wrote:
> 
> Hi, osx user here.
> I have installed a simple Cassandra db on my laptop and I would like to query it outside the Lan.
> So I set port forwarding and port triggering on my router (vodafone station) to link external 9042 to internal 9042.
> 
> Moreover I set on cassandra.yaml the broadcast_rpc_address to my router ip.
> 
> Unfortunately, when I try to connect using java api I obtain:
> 
> Exception in thread "main" com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /HERE_THERE_IS_ROUTER_IP:9042 (com.datastax.driver.core.exceptions.TransportException: [/HERE_THERE_IS_ROUTER_IP:9042] Cannot connect))
> 
> I noted that without setting broadcast_rpc_address I can reach Cassandra trough 127.0.0.1 so the database is active and running.
> 
> I’ve also tried  
> 
> lsof -n -i4TCP:9042 | grep LISTEN
> 
> and I obtain 
> 
> java    7555 giordano  184u  IPv4 0x513195612572e265      0t0  TCP 127.0.0.1:9042 (LISTEN)
> 
> when I unset broadcast_rpc_address
> and no output when I set broadcast_rpc_address.
> Is the problem in the yaml settings on in the router settings?
> 
> 
> P.S.: I have also modifying listen_address in the same way, without good news.
> P.P.S: clearly each time I edited the yaml file I restarted cassandra