3

There are many kahaDB logs which are not clearing up. Is it safe to clear old "data-< id >-log" files ? Shall I restart activeMQ or redeploy app after manually deleting kahaDB files ?

Vivek Sadh
  • 4,230
  • 3
  • 32
  • 49

2 Answers2

3

No. It is not safe to simply go into the KahaDB logs and start deleting them, these logs are where your messages and other runtime broker information is stored. The logs are also used if the index files become corrupted to replay and recover broker state. Removing old logs can mean you cannot recover from disk corruption etc.

What you need to do is to determine why you have such a growth of journal files. There are a number of reasons that this can happen and the solution differs based on what the cause is. You can do some debug yourself to get some answers on what is keeping old logs alive by reading the documentation on this topic.

ThomasW
  • 475
  • 3
  • 15
Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • Suppose I don't care about old data and don't care about losing data (it's testing env) - I just want to purge as much as I can from this directory, as long as ActiveMQ will stay healthy - is it safe to just delete all *.log files? – Amit Goldstein Jul 07 '20 at 07:07
  • Nope not safe unless you are wanting the broker to fall over – Tim Bish Jul 07 '20 at 14:03
  • @TimBish, The link you shared does not tell too much. For example, I added the kahadb trace log and the output was: "not removing data file: 459 as contained ack(s) refer to referenced file: [4, 6]". So what that means? How can I know which topic I need to fix with this info? Thanks – Rafael Pimenta Sep 20 '22 at 19:45
1

I sugest you to find out why your kahadb file not cleared at first. By adding this log config to log4j.properties. Then you can see exactly what is holding kahadb files in kahadb.log.

log4j.appender.kahadb=org.apache.log4j.RollingFileAppender 
log4j.appender.kahadb.file=${activemq.base}/data/kahadb.log 
log4j.appender.kahadb.maxFileSize=1024KB 
log4j.appender.kahadb.maxBackupIndex=5
log4j.appender.kahadb.append=true
log4j.appender.kahadb.layout=org.apache.log4j.PatternLayout 
log4j.appender.kahadb.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1}    - %m%n 
log4j.logger.org.apache.activemq.store.kahadb.MessageDatabase=TRACE, kahadb
Mobility
  • 3,117
  • 18
  • 31