Skip to main content
Version: V1.2

Disk space cleanup method

Log data cleaning

Applications log

find <Install directory>/Logs -mtime +3 -type f -name "*.log" -exec rm -f {} \;

Middleware service log

Mysql

Remember not to use RM -f. Once again, this file will be relatively large, because all MySQL audit logs recorded here.

echo "" >{Install directory}/mysql/data/mysql/error.log
echo "" > {Install directory}/mysql/data/mysql/mysql-server-id-[实际ID].log

You can refer to the following methods to close the MySQL audit log

# Do not restart the mysql service, mysql will fail after restarting. Replace the actual mysql account password information
mysql -uxxx -pxxxx -h 127.0.0.1 -e "set global general_log=0;"

# Modify the mysql.conf file to take effect even if mysql is restarted
sed -i "/general_log=1/ s/1/0/g" {Install directory}/mysql/conf/mysql.conf

Redis

Generally, this file is not large

echo "" > {Install directory}/redis/data/redis.log

Rabbitmq

Generally, this file is not large

echo "" > {Install directory}/rabbitmq/data/rabbitmq.log

Nginx

Clear nginx logs

find <Install directory>/nginx/log -type f|awk '{print "echo > "$1}'|bash

Container data cleaning

Clean up unused mirrors

If it is not necessary, it does not need to be cleaned

docker image prune -f

Clean the mounted volume

docker volume prune -f

Data backup file cleanup

Mysql

# clear files older than 3days
find <Install directory>/mysql/mysql-backup -maxdepth 1 -mtime +3 -exec rm -rf {} \;