cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Stevens <migh...@gmail.com>
Subject Re: Cassandra Configuration VS Static IPs.
Date Tue, 06 Oct 2015 02:30:36 GMT
Basically your client just needs a route to talk to the IP being broadcast
by each node.  We do plenty in EC2 and we use the instance private IP in
the broadcast address.  If you are doing multi-datacenter in EC2 it gets a
little harrier, where you need to use the public IP (but not necessarily
elastic IPs).

> A client is a program connecting to a cassandra instance. All it needs to
know is an IP, a keyspace and a table to operate.

More correctly it's talking to a Cassandra cluster; typically you'll
configure your client with several seed nodes, and the client will use
those to discover the topology of the rest of the cluster.  Your client
should be able to talk to all the nodes in at least one DC (usually the
same physical as well as logical DC as the client).  This helps any good
client which will attempt to route queries directly to the replicas for
each piece of data to save the cluster the overhead and increased latency
of coordinating reads and writes.

On Sun, Oct 4, 2015 at 6:41 PM Jonathan Haddad <jon@jonhaddad.com> wrote:

> You've been talking about configuring static, public IPs.  Public IPs are
> only needed if you want to connect to your Cassandra servers from a public
> network aka not from the same datacenter.
>
> AWS instances don't get a new IP on rebooting.  The instance doesn't
> shutdown when you tell a server to reboot, it just keeps running & keeps
> the same IP.
>
> You can connect to the internal address (192.168.x.x) or (10.x.x.x.) if
> you're on the same network.  That's not a public IP.  You don't have to
> hard code an address in your yaml, you can just the rpc_interface and set
> it to eth0 (or whatever AWS uses by default for server's NIC).
>
> Also, you know you can control IP addresses in a VPC, right?
>
> On Sun, Oct 4, 2015 at 8:31 PM Renato Perini <renato.perini@gmail.com>
> wrote:
>
>> Jonathan, I have some difficulties in understanding what you're talking
>> about. A client is a program connecting to a cassandra instance. All it
>> needs to know is an IP, a keyspace and a table to operate. My client is
>> nothing more than a simple textual version of a program like datastax
>> devcenter. No "same dc" concepts are involved for using it.
>> As for AWS, I'm not changing anything. The instances, as I said multiple
>> times, don't have an elastic ip, so the public IP is dynamic. This means it
>> changes automatically at every reboot.
>>
>>
>> Il 05/10/2015 02:22, Jonathan Haddad ha scritto:
>>
>> If your client is in the same DC, then you shouldn't use *public* ip
>> addresses.  If you're using a recent version of Cassandra you can just set
>> the listen_interface and rpc_interface to whatever network interface you've
>> got.
>>
>> If you're really changing IPs when you reboot machines (I have no idea
>> why you'd do this, AWS definitely doesn't work this way) then I think
>> you're going to hit a whole set of other issues.
>>
>>
>> On Sun, Oct 4, 2015 at 7:10 PM Renato Perini <renato.perini@gmail.com>
>> wrote:
>>
>>> Yes, the client uses the same datacenter (us-west-2).
>>> Maybe I haven't explained well the situation. I'm not asking to connect
>>> to nodes *without* using a static IP address, but allowing Cassandra to
>>> determine the current public address at the time of connection.
>>> Spark, for example, uses shell scripts for configuration, so the public
>>> IP (in AWS) can be assigned using the command `curl
>>> http://169.254.169.254/latest/meta-data/public-ipv4`, whatever it is at
>>> the time of boot.
>>> Cassandra uses a yaml file for the main configuration, so this is
>>> impossibile to achieve. Basically I would like to make the client connect
>>> correctly on all nodes using their public IPs without being required to
>>> know them (the client would discover them dynamically while connecting).
>>>
>>>
>>>
>>> Il 05/10/2015 00:55, Jonathan Haddad ha scritto:
>>>
>>> So you're not running the client in the same DC as your Cassandra
>>> cluster.  In that case you'll need to be able to connect to the public
>>> address of all the nodes.  Technically you could have a whitelist and only
>>> connect to 1, I wouldn't recommend it.
>>>
>>> This is no different than any other database in that you would need a
>>> public address to be able to connect to the servers from a machine not in
>>> your datacenter.  How else would you connect to them if you don't provide
>>> access?
>>>
>>> On Sun, Oct 4, 2015 at 6:35 PM Renato Perini <renato.perini@gmail.com>
>>> wrote:
>>>
>>>> Seems to be not the case when connecting to my (single) data center
>>>> using the java connector with a small client I have developed for testing.
>>>> For the broadcast_rpc_address I have configured the local IP of the
>>>> nodes. The cluster works fine and nodes communicates fairly well using
>>>> their local IPs. When I connect to a node (let's say node 1) from the
>>>> outside using the java driver and the node's public IP, the cluster
>>>> discovery uses internal IPs for contacting other nodes, leading to
>>>> (obviously) errors.
>>>>
>>>> As for AWS, Elastic IPs are free as long as they're associated to an
>>>> instance and the machines are up 24h/7. I have to shut down the machines
>>>> during the night for various reasons, so unfortunately they're not totally
>>>> free for my use case.
>>>>
>>>>
>>>>
>>>> Il 05/10/2015 00:04, Jonathan Haddad ha scritto:
>>>>
>>>> Public IP?  No, not required unless you're running multiple DCs.
>>>>
>>>> Where are you running a DC that IPs aren't cheap?  If you're in AWS
>>>> they're basically free (or at least the cheapest section of your bill by
>>>> far)
>>>>
>>>>
>>>>
>>>> On Sun, Oct 4, 2015 at 5:59 PM Renato Perini <renato.perini@gmail.com>
>>>> wrote:
>>>>
>>>>> Is cassandra really supposed to have a static public IP for each and
>>>>> single node in the cluster?
>>>>> This seems to be expensive (static IPs are nor free neither cheap),
>>>>> still the broadcast_rpc_address expects a static IP for client
>>>>> communications (load balancing, contact points, etc.)
>>>>> Is there some mechanism to determine a public IP at runtime?
>>>>>
>>>>> Basically, I have nodes (machines) with dynamic public IPs and I cannot
>>>>> embed them in the cassandra.yaml file because of their dynamic nature
>>>>> (they change at each reboot).
>>>>> Any solution to this?
>>>>>
>>>>> Thanks.
>>>>>
>>>>
>>>>
>>>
>>

Mime
View raw message