Yeah, Narendra is correct.

If you have 2 nodes, one in each data center, use RF=2 and do reads and
writes with either level ONE or QUORUM (which means 2 in this case).

However, if you had 2 nodes in DC1 and 1 node in DC2, then you could use
RF=3 and use LOCAL_QUORUM for reads and writes.

For writes, LOCAL_QUORUM means: Ensure that the write has been written
to <ReplicationFactor> / 2 + 1 nodes, within the local datacenter
(requires NetworkTopologyStrategy)

For reads, LOCAL_QUORUM means: Returns the record with the most recent
timestamp once a majority of replicas within the local datacenter have
replied.

- Sameer

On Wed, May 11, 2011 at 5:49 PM, Narendra Sharma
<narendra.sha...@gmail.com>wrote:

> My understanding is that the replication factor is for the entire ring.
> Even if you have 2 DCs the nodes are part of the same ring. What you get
> additionally from NTS is that you can specify how many replicas to place in
> each DC.
>
> So RF = 1 and DC1:1, DC2:1 looks incorrect to me.
>
> What is possible with NTS is following:
> RF=3, DC1=1, DC2=2
>
> Would wait for others comments to see if my understand is correct.
>
> -Naren
>
>
> On Wed, May 11, 2011 at 5:41 PM, Anurag Gujral <anurag.guj...@gmail.com>wrote:
>
>> Thanks Sameer for your answer.
>> I am using two DCs DC1 , DC2 with both having one node each, my
>> straegy_options values are DC1:1,DC2:1  I am not sure what my RF should be ,
>> should it be 1 or 2?
>> Please Advise
>> Thanks
>>  Anurag
>>
>>
>> On Wed, May 11, 2011 at 5:27 PM, Sameer Farooqui <cassandral...@gmail.com
>> > wrote:
>>
>>> Anurag,
>>>
>>> The Cassandra ring spans datacenters, so you can't use token 0 on both
>>> nodes. Cassandra’s ring is from 0 to 2**127 in size.
>>>
>>> Try assigning one node the token of 0 and the second node 8.50705917 ×
>>> 10^37 (input this as a single long number).
>>>
>>> To add a new keyspace in 0.8, run this from the CLI:
>>> create keyspace KEYSPACENAME with placement_strategy =
>>> org.apache.Cassandra.locator.NetworkTopologyStrategy' and strategy_options =
>>> [{replication_factor:2}];
>>>
>>> If using 0.7, run "help create keyspace;" from the CLI and it'll show you
>>> the correct syntax.
>>>
>>>
>>> More info on tokens:
>>>
>>> http://journal.paul.querna.org/articles/2010/09/24/cassandra-token-selection/
>>> <http://journal.paul.querna.org/articles/2010/09/24/cassandra-token-selection/>
>>> http://wiki.apache.org/cassandra/Operations#Token_selection
>>>
>>>
>>> On Wed, May 11, 2011 at 4:58 PM, Anurag Gujral 
>>> <anurag.guj...@gmail.com>wrote:
>>>
>>>> Hi All,
>>>>              I am testing network topology strategy in cassandra I am
>>>> using two nodes , one node each in different data center.
>>>> Since the nodes are in different dc I assigned token 0 to both the
>>>> nodes.
>>>> I added both the nodes as seeds in the cassandra.yaml and  I am  using
>>>> properyfilesnitch as endpoint snitch where I have specified the colo
>>>> details.
>>>>
>>>> I started first node then I when I restarted second node I got an error
>>>> that token "0" is already being used.Why am I getting this error.
>>>>
>>>> Second Question: I already have cassandra running in two different data
>>>> centers I want to add a new keyspace which uses networkTopology strategy
>>>> in the light of above errors how can I accomplish this.
>>>>
>>>>
>>>> Thanks
>>>> Anurag
>>>>
>>>
>>>
>>
>
>
> --
> Narendra Sharma
> Solution Architect
> *http://www.persistentsys.com*
> *http://narendrasharma.blogspot.com/*
>
>
>

Reply via email to