cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Tunnicliffe <...@beobal.com>
Subject Re: Can not connect with cqlsh to something different than localhost
Date Mon, 08 Dec 2014 19:49:01 GMT
rpc_address (or rpc_interface) is used for client connections,
listen_address is for inter-node communication.



On 8 December 2014 at 19:21, Richard Snowden <richard.t.snowden@gmail.com>
wrote:

> $ netstat -ntl | grep 9042
> tcp6       0      0   127.0.0.1:9042          :::*
> LISTEN
>
> ("listen_address" not set in cassandra.yaml)
>
> Even with "listen_address: 192.168.111.136" I get:
> $ netstat -ntl | grep 9042
> tcp6       0      0   127.0.0.1:9042          :::*
> LISTEN
>
>
> All I want to do is to access Cassandra from outside my VM. Is this really
> that hard?
>
>
>
> On Mon, Dec 8, 2014 at 7:30 PM, Michael Dykman <mdykman@gmail.com> wrote:
>
>> The difference is what interface your service is listening on. What is
>> the output of
>>
>> $ netstat -ntl | grep 9042
>>
>>
>> On Mon, 8 Dec 2014 07:21 Richard Snowden <richard.t.snowden@gmail.com>
>> wrote:
>>
>>> I left listen_address blank - still I can't connect (connection refused).
>>>
>>> "cqlsh" -> OK
>>> "cqlsh ubuntu" -> fail ("ubuntu" is my hostname)
>>> "cqlsh 192.168.111.136" -> fail
>>>
>>> "telnet 192.168.111.136 9042" from outside the VM gives me a "connection
>>> refused".
>>>
>>> I just started a Tomcat in my VM and did a "telnet 192.168.111.136 8080"
>>> from outside the VM  - and got the expected result ("Connected to
>>> 192.168.111.136. Escape character is '^]'.
>>>
>>> So what's so special in Cassandra?
>>>
>>>
>>> On Mon, Dec 8, 2014 at 12:18 PM, Jonathan Haddad <jon@jonhaddad.com>
>>> wrote:
>>>
>>>> Listen address needs the actual address, not the interface.  This is
>>>> best accomplished by setting up proper hostnames for each machine (through
>>>> DNS or hosts file) and leaving listen_address blank, as it will pick the
>>>> external ip.  Otherwise, you'll need to set the listen address to the IP
of
>>>> the machine you want on each machine.  I find the former to be less of a
>>>> pain to manage.
>>>>
>>>>
>>>> On Mon Dec 08 2014 at 2:49:55 AM Richard Snowden <
>>>> richard.t.snowden@gmail.com> wrote:
>>>>
>>>>> This did not work either. I changed /etc/cassandra.yaml and restarted
Cassandra (I even restarted the machine to make 100% sure).
>>>>>
>>>>> What I tried:
>>>>>
>>>>> 1) "listen_address: localhost"
>>>>>    -> connection OK (but of course I can't connect from outside the
VM to "localhost")
>>>>>
>>>>> 2) Set "listen_interface: eth0"
>>>>>    -> connection refused
>>>>>
>>>>> 3) Set "listen_address: 192.168.111.136"
>>>>>    -> connection refused
>>>>>
>>>>>
>>>>> What to do?
>>>>>
>>>>>
>>>>> > Try:
>>>>> > $ netstat -lnt
>>>>> > and see which interface port 9042 is listening on. You will likely
need to
>>>>> > update cassandra.yaml to change the interface. By default, Cassandra
is
>>>>> > listening on localhost so your local cqlsh session works.
>>>>>
>>>>> > On Sun, 7 Dec 2014 23:44 Richard Snowden <richard.t.snowden@gmail.com>
>>>>> > wrote:
>>>>>
>>>>> > > I am running Cassandra 2.1.2 in an Ubuntu VM.
>>>>> > >
>>>>> > > "cqlsh" or "cqlsh localhost" works fine.
>>>>> > >
>>>>> > > But I can not connect from outside the VM (firewall, etc. disabled).
>>>>> > >
>>>>> > > Even when I do "cqlsh 192.168.111.136" in my VM I get connection
refused.
>>>>> > > This is strange because when I check my network config I can
see that
>>>>> > > 192.168.111.136 is my IP:
>>>>> > >
>>>>> > > root@ubuntu:~# ifconfig
>>>>> > >
>>>>> > > eth0      Link encap:Ethernet  HWaddr 00:0c:29:02:e0:de
>>>>> > >           inet addr:192.168.111.136  Bcast:192.168.111.255
>>>>> > > Mask:255.255.255.0
>>>>> > >           inet6 addr: fe80::20c:29ff:fe02:e0de/64 Scope:Link
>>>>> > >           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>>>>> > >           RX packets:16042 errors:0 dropped:0 overruns:0 frame:0
>>>>> > >           TX packets:8638 errors:0 dropped:0 overruns:0 carrier:0
>>>>> > >           collisions:0 txqueuelen:1000
>>>>> > >           RX bytes:21307125 (21.3 MB)  TX bytes:709471 (709.4
KB)
>>>>> > >
>>>>> > > lo        Link encap:Local Loopback
>>>>> > >           inet addr:127.0.0.1  Mask:255.0.0.0
>>>>> > >           inet6 addr: ::1/128 Scope:Host
>>>>> > >           UP LOOPBACK RUNNING  MTU:65536  Metric:1
>>>>> > >           RX packets:550 errors:0 dropped:0 overruns:0 frame:0
>>>>> > >           TX packets:550 errors:0 dropped:0 overruns:0 carrier:0
>>>>> > >           collisions:0 txqueuelen:0
>>>>> > >           RX bytes:148053 (148.0 KB)  TX bytes:148053 (148.0
KB)
>>>>> > >
>>>>> > >
>>>>> > > root@ubuntu:~# cqlsh 192.168.111.136 9042
>>>>> > > Connection error: ('Unable to connect to any servers', {'192.168.111.136':
>>>>> > > error(111, "Tried connecting to [('192.168.111.136', 9042)].
Last error:
>>>>> > > Connection refused")})
>>>>> > >
>>>>> > >
>>>>> > > What to do?
>>>>> > >
>>>>>
>>>>>
>>>
>

Mime
View raw message