Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 851A9DACB for ; Mon, 16 Jul 2012 10:06:12 +0000 (UTC) Received: (qmail 30799 invoked by uid 500); 16 Jul 2012 10:06:10 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 30773 invoked by uid 500); 16 Jul 2012 10:06:09 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 30761 invoked by uid 99); 16 Jul 2012 10:06:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jul 2012 10:06:09 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=FSL_RCVD_USER,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.113.200.5] (HELO homiemail-a94.g.dreamhost.com) (208.113.200.5) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jul 2012 10:06:04 +0000 Received: from homiemail-a94.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a94.g.dreamhost.com (Postfix) with ESMTP id E388F38A05C for ; Mon, 16 Jul 2012 03:05:43 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=thelastpickle.com; h=from :mime-version:content-type:subject:date:in-reply-to:to :references:message-id; q=dns; s=thelastpickle.com; b=eJD/LOkB75 OmtoPh1Jcijp3e1W1sN41WDTqF6RL/1QJjFpHN1enoxUYgCu8BrKVBFjN3c/JaU7 hjqsWMl5t6AKlNvFY3JrFh+93dCJO1XLkgfUOC6gng7x2hXSGerv33x/dqqGPRQ6 j5qlz+xIAwmIOjicXzcHrR8B2JJdWhMm0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=thelastpickle.com; h=from :mime-version:content-type:subject:date:in-reply-to:to :references:message-id; s=thelastpickle.com; bh=408wtXHwMdbjFHr1 dYC5ZjlCqHI=; b=iWC1CE7qpOi2tXddjYUElFP1fV+bSz4c8wWqfWkJmAwbmAkt Sm8fmFB9+9+TZgr6s7rQcaUhKU8kpE83qEcEk3SvjtJUp0ySBikR7PglQowtvdC1 GwBQlIfhT3KTcNKYYMzryoAK7HWxCg/jc3jxvmpM1s20pdi5w6qwNnZydn8= Received: from [172.16.1.10] (unknown [203.86.207.101]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aaron@thelastpickle.com) by homiemail-a94.g.dreamhost.com (Postfix) with ESMTPSA id 17C9D38A05B for ; Mon, 16 Jul 2012 03:05:42 -0700 (PDT) From: aaron morton Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: multipart/alternative; boundary="Apple-Mail=_69BE3F7A-04A8-469B-AAC5-DDA41CAAB863" Subject: Re: How to come up with a predefined topology Date: Mon, 16 Jul 2012 22:05:39 +1200 In-Reply-To: To: user@cassandra.apache.org References: <9FC471D82FE4194FA2B6A1403B475C9B08F35D8B@DBXPRD0310MB384.eurprd03.prod.outlook.com> <1F152566-00BC-4A88-B5D5-222F82799E70@thelastpickle.com> Message-Id: X-Mailer: Apple Mail (2.1278) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_69BE3F7A-04A8-469B-AAC5-DDA41CAAB863 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 > Is the above understanding correct ? yes, sorry. Cheers ----------------- Aaron Morton Freelance Developer @aaronmorton http://www.thelastpickle.com On 13/07/2012, at 4:24 PM, prasenjit mukherjee wrote: > On Fri, Jul 13, 2012 at 4:04 AM, aaron morton = wrote: >> The logic is here >> = https://github.com/apache/cassandra/blob/cassandra-1.1/src/java/org/apache= /cassandra/locator/NetworkTopologyStrategy.java#L78 >=20 > Thanks Aaron for pointing to the code. >=20 >>=20 >> a. n>r : I am assuming, have 1 replica in each rack. >>=20 >> You have 1 replica in the first n racks. >>=20 >> b. n> in each racks. >>=20 >> int(n/r) racks will have the same number of replicas. n % r will have = more. >=20 > Did you mean r%n ( since r>n) ? >=20 > Shouldn't the logic be : all racks will have at least int(r/n) and r%n > will have 1 additional replica ? >=20 > Sample use case ( r =3D 8, n =3D 3 ) > n1 : 3 ( 2+1 ) > n2: 3 ( 2+1 ) > n3: 2 >=20 > Is the above understanding correct ? >=20 > -Thanks, > Prasenjit >=20 >>=20 >> This is why multi rack replication can be tricky. >>=20 >> Hope that helps. >>=20 >>=20 >> ----------------- >> Aaron Morton >> Freelance Developer >> @aaronmorton >> http://www.thelastpickle.com >>=20 >> On 12/07/2012, at 8:05 PM, prasenjit mukherjee wrote: >>=20 >> Thanks. Some follow up questions : >>=20 >> 1. How do the reads use strategy/snitch information ? I am assuming >> the reads can go to any of the replicas. WIll it also use the >> snitch/strategy info to find next 'R' replicas 'closest' to >> coordinator-node ? >>=20 >> 2. In a single DC ( with n racks and r replicas ) what algorithm >> cassandra uses to write its replicas in following scenarios : >> a. n>r : I am assuming, have 1 replica in each rack. >> b. n> in each racks. >>=20 >> -Thanks, >> Prasenjit >>=20 >> On Thu, Jul 12, 2012 at 11:24 AM, Tyler Hobbs = wrote: >>=20 >> I highly recommend specifying the same rack for all nodes (using >>=20 >> cassandra-topology.properties) unless you really have a good reason = not too >>=20 >> (and you probably don't). The way that replicas are chosen when = multiple >>=20 >> racks are in play can be fairly confusing and lead to a data = imbalance if >>=20 >> you don't catch it. >>=20 >>=20 >>=20 >> On Wed, Jul 11, 2012 at 10:53 PM, prasenjit mukherjee = >>=20 >> wrote: >>=20 >>=20 >> As far as I know there isn't any way to use the rack name in the >>=20 >> strategy_options for a keyspace. You >>=20 >> might want to look at the code to dig into that, perhaps. >>=20 >>=20 >> Aha, I was wondering if I could do that as well ( specify rack = options ) >>=20 >> :) >>=20 >>=20 >> Thanks for the pointer, I will dig into the code. >>=20 >>=20 >> -Thanks, >>=20 >> Prasenjit >>=20 >>=20 >> On Thu, Jul 12, 2012 at 5:33 AM, Richard Lowe = >>=20 >> wrote: >>=20 >> If you then specify the parameters for the keyspace to use these, you >>=20 >> can control exactly which set of nodes replicas end up on. >>=20 >>=20 >> For example, in cassandra-cli: >>=20 >>=20 >> create keyspace ks1 with placement_strategy =3D >>=20 >> 'org.apache.cassandra.locator.NetworkTopologyStrategy' and = strategy_options >>=20 >> =3D { DC1_realtime: 2, DC1_analytics: 1, DC2_realtime: 1 }; >>=20 >>=20 >> As far as I know there isn't any way to use the rack name in the >>=20 >> strategy_options for a keyspace. You might want to look at the code = to dig >>=20 >> into that, perhaps. >>=20 >>=20 >> Whichever snitch you use, the nodes are sorted in order of proximity = to >>=20 >> the client node. How this is determined depends on the snitch that's = used >>=20 >> but most (the ones that ship with Cassandra) will use the default = ordering >>=20 >> of same-node < same-rack < same-datacenter < different-datacenter. = Each >>=20 >> snitch has methods to tell Cassandra which rack and DC a node is in, = so it >>=20 >> always knows which node is closest. Used with the Bloom filters this = can >>=20 >> tell us where the nearest replica is. >>=20 >>=20 >>=20 >>=20 >> -----Original Message----- >>=20 >> From: prasenjit mukherjee [mailto:prasen.bea@gmail.com] >>=20 >> Sent: 11 July 2012 06:33 >>=20 >> To: user >>=20 >> Subject: How to come up with a predefined topology >>=20 >>=20 >> Quoting from >>=20 >> = http://www.datastax.com/docs/0.8/cluster_architecture/replication#networkt= opologystrategy >>=20 >> : >>=20 >>=20 >> "Asymmetrical replication groupings are also possible depending on = your >>=20 >> use case. For example, you may want to have three replicas per data = center >>=20 >> to serve real-time application requests, and then have a single = replica in a >>=20 >> separate data center designated to running analytics." >>=20 >>=20 >> Have 2 questions : >>=20 >> 1. Any example how to configure a topology with 3 replicas in one DC = ( >>=20 >> with 2 in 1 rack + 1 in another rack ) and one replica in another DC = ? >>=20 >> The default networktopologystrategy with rackinferringsnitch will = only >>=20 >> give me equal distribution ( 2+2 ) >>=20 >>=20 >> 2. I am assuming the reads can go to any of the replicas. Is there a >>=20 >> client which will send query to a node ( in cassandra ring ) which is >>=20 >> closest to the client ? >>=20 >>=20 >> -Thanks, >>=20 >> Prasenjit >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >> -- >>=20 >> Tyler Hobbs >>=20 >> DataStax >>=20 >>=20 >>=20 --Apple-Mail=_69BE3F7A-04A8-469B-AAC5-DDA41CAAB863 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1
Is the above understanding = correct ?
yes, = sorry.

Cheers

http://www.thelastpickle.com

On 13/07/2012, at 4:24 PM, prasenjit mukherjee = wrote:

On Fri, Jul 13, 2012 at 4:04 AM, aaron morton <aaron@thelastpickle.com> = wrote:
The logic is = here
https://githu= b.com/apache/cassandra/blob/cassandra-1.1/src/java/org/apache/cassandra/lo= cator/NetworkTopologyStrategy.java#L78

Thanks = Aaron for pointing to the code.


a. n>r : I = am assuming, have 1 replica in each rack.

You have 1 = replica in the first n racks.

b. n<r : ?? = I am assuming, try to equally distribute replicas = across
in each = racks.

int(n/r) racks = will have the same number of replicas. n % r will have = more.

Did you mean  r%n ( since r>n) =  ?

Shouldn't the logic be : all racks will have at least = int(r/n) and r%n
will have 1 additional replica ?

Sample use = case ( r =3D 8, n =3D 3 )
n1 : 3 ( 2+1 )
n2:  3 ( 2+1 = )
n3:  2

Is the above understanding correct = ?

-Thanks,
Prasenjit


This is why = multi rack replication can be tricky.

Hope that = helps.


-----------------
Aaron Morton
Freelance Developer
@aaronmorton
http://www.thelastpickle.com
=

On 12/07/2012, at 8:05 PM, prasenjit mukherjee = wrote:

Thanks. Some = follow up questions :

1.  How do = the reads use strategy/snitch information ? I am = assuming
the reads can go to = any of the replicas. WIll it also use the
snitch/strategy info to find next 'R' replicas 'closest' = to
coordinator-node = ?

2. In a single DC ( with n racks and r replicas ) what = algorithm
cassandra uses to = write its replicas in following scenarios :
a. n>r : I am assuming, have 1 replica in each = rack.
b. n<r : ?? I am = assuming, try to equally distribute replicas = across
in each = racks.

-Thanks,
Prasenjit

On Thu, Jul 12, = 2012 at 11:24 AM, Tyler Hobbs <tyler@datastax.com> = wrote:

I highly = recommend specifying the same rack for all nodes = (using

cassandra-topology.properties) unless you really have a = good reason not too

(and you = probably don't).  The way that replicas are chosen when = multiple

racks are in = play can be fairly confusing and lead to a data imbalance = if

you don't catch it.



On Wed, Jul 11, = 2012 at 10:53 PM, prasenjit mukherjee <prasen.bea@gmail.com>

wrote:


As far as I = know there isn't any way to use the rack name in = the

strategy_options for a keyspace. = You

might want to look at the code to dig into that, = perhaps.


Aha, I was = wondering if I could do that as well ( specify rack options = )

:)


Thanks for the = pointer, I will dig into the code.


-Thanks,

Prasenjit


On Thu, Jul 12, = 2012 at 5:33 AM, Richard Lowe <richard.lowe@arkivum.com><= br>

wrote:

If you then = specify the parameters for the keyspace to use these, = you

can control exactly which set of nodes replicas end up = on.


For example, = in cassandra-cli:


create keyspace = ks1 with placement_strategy =3D

'org.apache.cassandra.locator.NetworkTopologyStrategy' and = strategy_options

=3D { = DC1_realtime: 2, DC1_analytics: 1, DC2_realtime: 1 = };


As far as I = know there isn't any way to use the rack name in = the

strategy_options for a keyspace. You might want to look = at the code to dig

into that, = perhaps.


Whichever = snitch you use, the nodes are sorted in order of proximity = to

the client node. How this is determined depends on the = snitch that's used

but most (the = ones that ship with Cassandra) will use the default = ordering

of same-node = < same-rack < same-datacenter < different-datacenter. = Each

snitch has = methods to tell Cassandra which rack and DC a node is in, so = it

always knows which node is closest. Used with the Bloom = filters this can

tell us where = the nearest replica is.




-----Original = Message-----

From: prasenjit = mukherjee [mailto:prasen.bea@gmail.com]

Sent: 11 July = 2012 06:33

To: = user

Subject: How to = come up with a predefined topology


Quoting = from

http://www.datastax.com/docs/0.8/cluster_architec= ture/replication#networktopologystrategy

:


"Asymmetrical = replication groupings are also possible depending on = your

use case. For = example, you may want to have three replicas per data = center

to serve = real-time application requests, and then have a single replica in = a

separate data center designated to running = analytics."


Have 2 = questions :

1. Any example = how to configure a topology with 3 replicas in one DC = (

with 2 in 1 rack + 1 in another rack ) and one replica in = another DC ?

The default = networktopologystrategy with rackinferringsnitch will = only

give me equal = distribution ( 2+2 )


2. I am = assuming the reads can go to any of the replicas. Is there = a

client which will send query to a node ( in cassandra ring = ) which is

closest to the = client ?


-Thanks,

Prasenjit







--

Tyler = Hobbs

DataStax




<= /html>= --Apple-Mail=_69BE3F7A-04A8-469B-AAC5-DDA41CAAB863--