Search code examples
cassandradatastax-java-driverphantom-dsl

How to check from/to which Cassandra node the client read/write data?


I'm working with Cassandra 3.x and Phantom driver (scala), and modifying my Cassandra deployment from a simple, three nodes cluster to a multi datacenter Cassandra deployment that consists of two datacenters:

Transactional - the "main" datacenter, to which all reads/writes occur (except for reads/writes done by some analytics job).

Analytics - a datacenter used for analytics purposes only. The analytics job should operate (i.e. read/write to) on this datacenter.

I configured the client on the analytics job to read/write to the analytics data-center, and all other services to read/write from the transactional data-center.

How can I check the client actually behaves as expected - and reads/writes the data to the correct data-center?


Solution

  • The driver has an option allowing you to turn on tracking. That should allow you to see which nodes are involved with each query.

    There's a short description of how to do this on the driver documentation page: https://docs.datastax.com/en/developer/java-driver/4.2/manual/core/logging/

    The query logger reference API has a lot more detail on the available methods, and can even show the values of bind vars, if needed.