On Mon, Feb 14, 2011 at 6:58 PM, Dan Hendry <dan.hendry.j...@gmail.com>wrote:

> > 1) If I insert a key and want to verify which node it went to then how do
> I
> > do that?
>
> I don't think you can and there should be no reason to care. Cassandra
> abstracts where data is being stored, think in terms of consistency levels
> not actual nodes.
>

If you actually mean which nodes a particular write went to, you'd have to
ask each node that it's supposed to belong on or watch the logs while on
debug.  If you just want to know which nodes it's *supposed* to go to, JMX
exposes getNaturalEndpoints and thrift exposes describe_ring. describe_ring
will give the token ranges for each node and then you can fit your key
inside those ranges and get a list of the nodes that key belongs on.


>
> > 2) How can I verify if the replication is working. That is how do I check
> > that CF row got inserted in 2 nodes if replication factor is set to 2.
>
> Perform a successful write at consistency level ALL via a thrift client.
>

Perform a successful write at CL.ALL will work.  You can also write at
whatever CL you want, then look in describe_ring to see where the data
should have ended up, then ask each node individually at CL.ONE to see if
that node has the data.  If you do this, make sure Read Repair (RR) is off,
otherwise the first read you do might repair it on another node and that
only tells you RR is working, not that the initially replication worked.

Reply via email to