Javis
Javis

Reputation: 338

Cassandra 2.1.3. How to extract CommitLog

Please help for my problem. I use Ubuntu 14.04, Java 8, Cassandra 2.1.3. Sorry I'm beginner. How I can extract and deserialize commitLog from dir: /var/lib/cassandra/commitlog? As far as I understand we may use lib for Maven cassandra-all, where is method CommitLogReplayer.recover? If I start recover commitLog, for example:

CommitLogReplayer.recover(new File("/var/lib/cassandra/commitlog/CommitLog-4-1453270991708.log")); 

I get exception:

Expecting URI in variable: [cassandra.config].  Please prefix the file with file:/// for local files or file://<server>/ for remote files. Aborting. If you are executing this from an external tool, it needs to set Config.setClientMode(true) to avoid loading configuration.
Fatal configuration error; unable to start. See log for stacktrace.

Config.setClientMode(true); - don't helped me.

What I am wrong?

Upvotes: 1

Views: 273

Answers (1)

Chris Lohfink
Chris Lohfink

Reputation: 16400

With setClientMode(true), there will be no context to deserialize the data unless you do something to create the cfmetadata yourself. Even then this is a pretty non trivial project since the applying of mutations is tightly coupled with C*. That said this isn't impossible, but you wont be able to use the CommitLogReplayer since it tries to apply the mutations. Its a good place to start looking to write your own though (up to CommitLogReplayer.replayMutation you can reuse a lot).

Upvotes: 2

Related Questions