steve-prod
steve-prod

Reputation: 31

How to inspect the local hints directory on a Cassandra node?

I'm encountering the same problem as Cassandra system.hints table is empty even when the one of the node is down:

I am learning Cassandra from academy.datastax.com. I am trying the Replication and Consistency demo on local machine. RF = 3 and Consistency = 1.

When my Node3 is down and I am updating my table using update command, the SYSTEM.HINTS table is expected to store hint for node3 but it is always empty.

@amalober pointed out that this was due to a difference the Cassandra version being used. From the Cassandra docs at DataStax:

In Cassandra 3.0 and later, the hint is stored in a local hints directory on each node for improved replay.

This same question was asked 3 years ago, How to access the local data of a Cassandra node, but the accepted solution was to

...Hack something together using the Cassandra source that reads SSTables and have that feed the local client you're hoping to build. A great starting point would be looking at the source of org.apache.cassandra.tools.SSTableExport which is used in the sstable2json tool.

Is there an easier way to access the local hints directory of a Cassandra node?

Upvotes: 3

Views: 4432

Answers (3)

Jing Li
Jing Li

Reputation: 11

I guess you are using ccm. So, the hint file should be in $CASSANDRA_HOME/.ccm/yourcluster/yournode/hints directory

Upvotes: 1

Chris Lohfink
Chris Lohfink

Reputation: 16400

I haven't been able to reproduce your issue with not getting a hints file. Every attempt I had resulted in the hints file as expected. There is a way to view the hints easier now.

We added a dump for hints in sstable-tools that you can use to view the mutations in the HH files. We may in the future add ability to use the HH files like sstables in the shell (use mutations to build memtable and include in queries) but for now its pretty raw.

Its pretty simple (sans metadata setup) if you wanna do analysis of data yourself. You can see what we did here and change to your needs: https://github.com/tolbertam/sstable-tools/blob/master/src/main/java/org/apache/cassandra/hints/HintsTool.java#L39

Upvotes: 0

doanduyhai
doanduyhai

Reputation: 8812

Is there an easier way to access the local hints directory of a Cassandra node?

The hint directory is defined in $CASSANDRA_HOME/conf/cassandra.yaml file (sometimes it is located under /etc/cassandra also, depending on how you install Cassandra)

Look for the property hints_directory

Upvotes: 6

Related Questions