Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Many commitlog files with Cassandra

I've got a mostly idle (till now) 4 node cassandra cluster that's hooked up with opscenter. There's a table that's had very little writes in the last week or so (test cluster). It's running 2.1.0. Happened to ssh in, and out of curiosity, ran du -sh * on the data directory. Here's what I get:

4.2G    commitlog
851M    data
188K    saved_caches

There's 136 files in the commit log directory. I flushed, and then drained cassandra, stopped and started the service. Those files are still there. What's the best way to get rid of these? Most of the stuff is opscenter related, and I'm inclined to just blow them away as I don't need the test data. Wondering what to do in case this pops up again. Appreciate any tips.

like image 973
ashic Avatar asked Oct 31 '14 18:10

ashic


People also ask

What is Commitlog in Cassandra?

Commitlogs are an append only log of all mutations local to a Cassandra node. Any data written to Cassandra will first be written to a commit log before being written to a memtable. This provides durability in the case of unexpected shutdown. On startup, any mutations in the commit log will be applied.

Can I delete Cassandra commit logs?

1 Answer. The commit logs are the commits for incoming writes to your cluster from the application. You don't delete them.

Where are Memtables stored in Cassandra?

The memtable is an in memory data structure which can be kept on or offheap for each table on each node. The memtables periodically flush to new sstables which are merged with the memtable for reads. The commitlog provides durability for the memtable until its flushed.

Which directory contains the commit log file in Cassandra?

The commit log is archived at node startup and when a commit log is written to disk, or at a specified point-in-time. You configure this feature in the commitlog_archiving. properties configuration file, which is located in the following directories: Cassandra package installations: /etc/cassandra.


1 Answers

The files in the commit log directory have a fixed size determined by your settings in the cassandra.yaml. All files have a pre-allocated size, so you cannot change it by making flush, drain or other operations on the cluster.

You have to change the configuration if you want to reduce their size.

Look at the configuration settings "commitlog_total_space_in_mb" and "commitlog_segment_size_in_mb" to configure the size of each file and the total space occupied by all of them.

like image 195
Nicola Ferraro Avatar answered Sep 21 '22 02:09

Nicola Ferraro