问题
I have found many posts that indicate that these files will be cleaned up after one week (my temp/tmp has files over one month old). Some say restarting sonarqube will clean these out (does not work for me to restart the application due to continuous integration). Some posts claim that this is fixed in the next sonar and sonarqube release.
How do I know (definitively) when it is safe to delete the content from temp/tmp directory without impacting the analyses? Currently there is 31 GB of data and I badly need to reclaim that space!
any pointers are welcome!
回答1:
Indeed, this question looks actually like a duplicate of SonarQube Temp Disk Space and this issue is a known one. And it's been fixed in SonarQube 5.1.2.
See https://jira.sonarsource.com/browse/SONAR-6700 for details.
If you can't upgrade, then you can just remove old temporary files by yourself in the meantime. Something like :
find $SONARQUBE_TMP_DIR -type f -mtime +7 -exec rm -f "{}" \;
should do the trick (the +7 is to say MORE (+) than 7 days old for last modification, mtime is modification time, adapt if you want more or less).
Warning: do NOT put less that +7. I did it some weeks ago and it crashed our instance. My guess here is that since SonarQube is supposed to automatically clean up things older than 7 days, it might still be using files old less than 7 days... Hence, leave them alone ;-).
回答2:
Best solution I found is to restart sonarqube. It took some time to remove the tmp files, but restarting it definitely did the trick.
来源:https://stackoverflow.com/questions/31756718/sonarqube-5-1-temp-tmp-directory-fills-up-how-can-i-tell-what-can-be-deleted