Reputation: 21
For teaching purposes I want to give insight in the replication strategy of a Cassandra cluster. Therefore I would like to query the data in a specific Cassandra node. I did not find a way to do this? Does one of you know a way to do this?
Upvotes: 2
Views: 1849
Reputation: 1406
You can use https://github.com/tolbertam/sstable-tools to query with a cqlsh interface on a single SSTable without going through Cassandra; there is a good example at https://github.com/tolbertam/sstable-tools#cqlsh. You can obtain from there a list of keys stored on that SSTable, and then you can run the regular cqlsh with TRACING ON, as mentioned in another answer, and see if it will go to that server or another.
Or you could stop all servers but one, and try to run queries against it with LOCAL_ONE.
Upvotes: 0
Reputation: 1538
To know about from which node data is coming I think you need to enable tracing on CQLSH. cqlsh>TRACING ON once tracing enabled if you run any query you will get tracing details and information. For more details you may refer below link. https://docs.datastax.com/en/dse/5.1/cql/cql/cql_reference/cqlsh_commands/cqlshTracing.html
Above things are based on replication and consistency level.
Upvotes: 1
Reputation: 2196
If you find where the data resides in the cluster that you want to query, log into that node via a tool such as cqlsh, and then set your consistency to LOCAL_ONE, you should be able to get the data from the local node only. If you want to prove that to be the case, enable tracing before you run the query. It will tell you where it pulled the data from (you could also get some cases of read repair by chance (which will show other nodes as well). If you do, ignore that run and do it again).
Upvotes: 2