You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Huiliang Zhang <zh...@gmail.com> on 2014/06/25 05:55:33 UTC

EC2 cassandra cluster node address problem

Hi,

I am using Cassandra on EC2 instances. My cassandra always returns private
ips of the instances to the thrift program. Then the program cannot connect
to the private ips.

I already changed the
rpc_address: elastic ip
rpc_address: elastic ip

Then I restarted the cassandra cluster. But the system.peers still save the
private ips as peer address.

How to fix this?

Thanks,
Huiliang

Re: EC2 cassandra cluster node address problem

Posted by Huiliang Zhang <zh...@gmail.com>.
It should be good to use broadcast_address for my purpose. The only problem
is coming from opscenter now because it cannot recognize the datacenter
from the ip range.


On Wed, Jun 25, 2014 at 7:13 PM, Michael Shuler <mi...@pbandjelly.org>
wrote:

> On 06/25/2014 09:05 PM, Huiliang Zhang wrote:
>
>> Thanks. In 2.0.6, a setting is like this:
>>
>> # Address to broadcast to other Cassandra nodes
>> # Leaving this blank will set it to the same value as listen_address
>> # broadcast_address: 1.2.3.4
>>
>> If it is changing to elastic ip, it will cause other kinds of problem
>> like Unknown Datacenter in opscenter.
>>
>
> Right. That setting serves a different purpose  :)
>
> --
> Kind regards,
> Michael
>

Re: EC2 cassandra cluster node address problem

Posted by Michael Shuler <mi...@pbandjelly.org>.
On 06/25/2014 09:05 PM, Huiliang Zhang wrote:
> Thanks. In 2.0.6, a setting is like this:
>
> # Address to broadcast to other Cassandra nodes
> # Leaving this blank will set it to the same value as listen_address
> # broadcast_address: 1.2.3.4
>
> If it is changing to elastic ip, it will cause other kinds of problem
> like Unknown Datacenter in opscenter.

Right. That setting serves a different purpose  :)

-- 
Kind regards,
Michael

Re: EC2 cassandra cluster node address problem

Posted by Huiliang Zhang <zh...@gmail.com>.
Thanks. In 2.0.6, a setting is like this:

# Address to broadcast to other Cassandra nodes
# Leaving this blank will set it to the same value as listen_address
# broadcast_address: 1.2.3.4

If it is changing to elastic ip, it will cause other kinds of problem like
Unknown Datacenter in opscenter.



On Wed, Jun 25, 2014 at 6:49 PM, Michael Shuler <mi...@pbandjelly.org>
wrote:

> On 06/25/2014 08:31 PM, Huiliang Zhang wrote:
>
>> Thanks, get it. It is working after I translate the private ip to
>> elastic ip.
>>
>
> This sounds like a nice way to work around a known networking limitation
> when using EC2. Glad that worked out OK. In 2.1+, cassandra.yaml includes a
> broadcast_rpc_address setting to help mitigate this limitation for client
> connections.
>
> # RPC address to broadcast to drivers and other Cassandra nodes. This
> cannot
> # be set to 0.0.0.0. If left blank, this will be set to the value of
> # rpc_address. If rpc_address is set to 0.0.0.0, broadcast_rpc_address must
> # be set.
> # broadcast_rpc_address: 1.2.3.4
>
> --
> Kind regards,
> Michael
>

Re: EC2 cassandra cluster node address problem

Posted by Michael Shuler <mi...@pbandjelly.org>.
On 06/25/2014 08:31 PM, Huiliang Zhang wrote:
> Thanks, get it. It is working after I translate the private ip to
> elastic ip.

This sounds like a nice way to work around a known networking limitation 
when using EC2. Glad that worked out OK. In 2.1+, cassandra.yaml 
includes a broadcast_rpc_address setting to help mitigate this 
limitation for client connections.

# RPC address to broadcast to drivers and other Cassandra nodes. This cannot
# be set to 0.0.0.0. If left blank, this will be set to the value of
# rpc_address. If rpc_address is set to 0.0.0.0, broadcast_rpc_address must
# be set.
# broadcast_rpc_address: 1.2.3.4

-- 
Kind regards,
Michael

Re: EC2 cassandra cluster node address problem

Posted by Huiliang Zhang <zh...@gmail.com>.
Thanks, get it. It is working after I translate the private ip to elastic
ip.


On Wed, Jun 25, 2014 at 1:51 PM, Andrey Ilinykh <ai...@gmail.com> wrote:

> yes, of course. Private ip is real ip address of node. Cassandra can
> listen on this ip only. elastic ip is external. It belongs to AWS firewall.
> It is similar to your web router. You can forward your external port to
> local one, but application running on your local node doesn't know anything
> about it.
>
>
> On Wed, Jun 25, 2014 at 1:25 PM, Huiliang Zhang <zh...@gmail.com> wrote:
>
>> Thanks. In fact, it is Cassandra that returns private ip of nodes to my
>> program by:
>>
>> client.describe_ring(keyspace)
>>
>> Then the program will start communicate with Cassandra through the
>> private ips. One way is to translate the ips myself.
>>
>>
>> On Tue, Jun 24, 2014 at 10:40 PM, Andrey Ilinykh <ai...@gmail.com>
>> wrote:
>>
>>> you can set rpc_address to 0.0.0.0, then it will listen on all
>>> interfaces. Also you have to modify security group settings to allow
>>> incoming connection for port 9160. But it is a really bad idea. By this
>>> way you open your cluster to whole world, ssh tunnel is the best way.
>>>
>>>
>>> On Tue, Jun 24, 2014 at 10:01 PM, Huiliang Zhang <zh...@gmail.com>
>>> wrote:
>>>
>>>> Thanks. Is there a way to configure Cassandra to use elastic ip instead
>>>> of private ip?
>>>>
>>>>
>>>> On Tue, Jun 24, 2014 at 9:29 PM, Andrey Ilinykh <ai...@gmail.com>
>>>> wrote:
>>>>
>>>>> Cassandra knows nothing about elastic ip. You have to use ssh tunnel
>>>>> or run your client on ec2 instance.
>>>>>
>>>>> Thank you,
>>>>>   Andrey
>>>>>
>>>>>
>>>>> On Tue, Jun 24, 2014 at 8:55 PM, Huiliang Zhang <zh...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am using Cassandra on EC2 instances. My cassandra always returns
>>>>>> private ips of the instances to the thrift program. Then the program cannot
>>>>>> connect to the private ips.
>>>>>>
>>>>>> I already changed the
>>>>>> rpc_address: elastic ip
>>>>>> rpc_address: elastic ip
>>>>>>
>>>>>> Then I restarted the cassandra cluster. But the system.peers still
>>>>>> save the private ips as peer address.
>>>>>>
>>>>>> How to fix this?
>>>>>>
>>>>>> Thanks,
>>>>>> Huiliang
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Re: EC2 cassandra cluster node address problem

Posted by Andrey Ilinykh <ai...@gmail.com>.
yes, of course. Private ip is real ip address of node. Cassandra can listen
on this ip only. elastic ip is external. It belongs to AWS firewall. It is
similar to your web router. You can forward your external port to local
one, but application running on your local node doesn't know anything about
it.


On Wed, Jun 25, 2014 at 1:25 PM, Huiliang Zhang <zh...@gmail.com> wrote:

> Thanks. In fact, it is Cassandra that returns private ip of nodes to my
> program by:
>
> client.describe_ring(keyspace)
>
> Then the program will start communicate with Cassandra through the private
> ips. One way is to translate the ips myself.
>
>
> On Tue, Jun 24, 2014 at 10:40 PM, Andrey Ilinykh <ai...@gmail.com>
> wrote:
>
>> you can set rpc_address to 0.0.0.0, then it will listen on all
>> interfaces. Also you have to modify security group settings to allow
>> incoming connection for port 9160. But it is a really bad idea. By this
>> way you open your cluster to whole world, ssh tunnel is the best way.
>>
>>
>> On Tue, Jun 24, 2014 at 10:01 PM, Huiliang Zhang <zh...@gmail.com>
>> wrote:
>>
>>> Thanks. Is there a way to configure Cassandra to use elastic ip instead
>>> of private ip?
>>>
>>>
>>> On Tue, Jun 24, 2014 at 9:29 PM, Andrey Ilinykh <ai...@gmail.com>
>>> wrote:
>>>
>>>> Cassandra knows nothing about elastic ip. You have to use ssh tunnel or
>>>> run your client on ec2 instance.
>>>>
>>>> Thank you,
>>>>   Andrey
>>>>
>>>>
>>>> On Tue, Jun 24, 2014 at 8:55 PM, Huiliang Zhang <zh...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I am using Cassandra on EC2 instances. My cassandra always returns
>>>>> private ips of the instances to the thrift program. Then the program cannot
>>>>> connect to the private ips.
>>>>>
>>>>> I already changed the
>>>>> rpc_address: elastic ip
>>>>> rpc_address: elastic ip
>>>>>
>>>>> Then I restarted the cassandra cluster. But the system.peers still
>>>>> save the private ips as peer address.
>>>>>
>>>>> How to fix this?
>>>>>
>>>>> Thanks,
>>>>> Huiliang
>>>>>
>>>>>
>>>>
>>>
>>
>

Re: EC2 cassandra cluster node address problem

Posted by Huiliang Zhang <zh...@gmail.com>.
Thanks. In fact, it is Cassandra that returns private ip of nodes to my
program by:

client.describe_ring(keyspace)

Then the program will start communicate with Cassandra through the private
ips. One way is to translate the ips myself.


On Tue, Jun 24, 2014 at 10:40 PM, Andrey Ilinykh <ai...@gmail.com> wrote:

> you can set rpc_address to 0.0.0.0, then it will listen on all interfaces.
> Also you have to modify security group settings to allow incoming
> connection for port 9160. But it is a really bad idea. By this way you
> open your cluster to whole world, ssh tunnel is the best way.
>
>
> On Tue, Jun 24, 2014 at 10:01 PM, Huiliang Zhang <zh...@gmail.com> wrote:
>
>> Thanks. Is there a way to configure Cassandra to use elastic ip instead
>> of private ip?
>>
>>
>> On Tue, Jun 24, 2014 at 9:29 PM, Andrey Ilinykh <ai...@gmail.com>
>> wrote:
>>
>>> Cassandra knows nothing about elastic ip. You have to use ssh tunnel or
>>> run your client on ec2 instance.
>>>
>>> Thank you,
>>>   Andrey
>>>
>>>
>>> On Tue, Jun 24, 2014 at 8:55 PM, Huiliang Zhang <zh...@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am using Cassandra on EC2 instances. My cassandra always returns
>>>> private ips of the instances to the thrift program. Then the program cannot
>>>> connect to the private ips.
>>>>
>>>> I already changed the
>>>> rpc_address: elastic ip
>>>> rpc_address: elastic ip
>>>>
>>>> Then I restarted the cassandra cluster. But the system.peers still save
>>>> the private ips as peer address.
>>>>
>>>> How to fix this?
>>>>
>>>> Thanks,
>>>> Huiliang
>>>>
>>>>
>>>
>>
>

Re: EC2 cassandra cluster node address problem

Posted by Andrey Ilinykh <ai...@gmail.com>.
you can set rpc_address to 0.0.0.0, then it will listen on all interfaces.
Also you have to modify security group settings to allow incoming
connection for port 9160. But it is a really bad idea. By this way you open
your cluster to whole world, ssh tunnel is the best way.


On Tue, Jun 24, 2014 at 10:01 PM, Huiliang Zhang <zh...@gmail.com> wrote:

> Thanks. Is there a way to configure Cassandra to use elastic ip instead of
> private ip?
>
>
> On Tue, Jun 24, 2014 at 9:29 PM, Andrey Ilinykh <ai...@gmail.com>
> wrote:
>
>> Cassandra knows nothing about elastic ip. You have to use ssh tunnel or
>> run your client on ec2 instance.
>>
>> Thank you,
>>   Andrey
>>
>>
>> On Tue, Jun 24, 2014 at 8:55 PM, Huiliang Zhang <zh...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I am using Cassandra on EC2 instances. My cassandra always returns
>>> private ips of the instances to the thrift program. Then the program cannot
>>> connect to the private ips.
>>>
>>> I already changed the
>>> rpc_address: elastic ip
>>> rpc_address: elastic ip
>>>
>>> Then I restarted the cassandra cluster. But the system.peers still save
>>> the private ips as peer address.
>>>
>>> How to fix this?
>>>
>>> Thanks,
>>> Huiliang
>>>
>>>
>>
>

Re: EC2 cassandra cluster node address problem

Posted by Huiliang Zhang <zh...@gmail.com>.
Thanks. Is there a way to configure Cassandra to use elastic ip instead of
private ip?


On Tue, Jun 24, 2014 at 9:29 PM, Andrey Ilinykh <ai...@gmail.com> wrote:

> Cassandra knows nothing about elastic ip. You have to use ssh tunnel or
> run your client on ec2 instance.
>
> Thank you,
>   Andrey
>
>
> On Tue, Jun 24, 2014 at 8:55 PM, Huiliang Zhang <zh...@gmail.com> wrote:
>
>> Hi,
>>
>> I am using Cassandra on EC2 instances. My cassandra always returns
>> private ips of the instances to the thrift program. Then the program cannot
>> connect to the private ips.
>>
>> I already changed the
>> rpc_address: elastic ip
>> rpc_address: elastic ip
>>
>> Then I restarted the cassandra cluster. But the system.peers still save
>> the private ips as peer address.
>>
>> How to fix this?
>>
>> Thanks,
>> Huiliang
>>
>>
>

Re: EC2 cassandra cluster node address problem

Posted by Andrey Ilinykh <ai...@gmail.com>.
Cassandra knows nothing about elastic ip. You have to use ssh tunnel or run
your client on ec2 instance.

Thank you,
  Andrey


On Tue, Jun 24, 2014 at 8:55 PM, Huiliang Zhang <zh...@gmail.com> wrote:

> Hi,
>
> I am using Cassandra on EC2 instances. My cassandra always returns private
> ips of the instances to the thrift program. Then the program cannot connect
> to the private ips.
>
> I already changed the
> rpc_address: elastic ip
> rpc_address: elastic ip
>
> Then I restarted the cassandra cluster. But the system.peers still save
> the private ips as peer address.
>
> How to fix this?
>
> Thanks,
> Huiliang
>
>