IMC platform collaborates with MySQL database deployment environment; excessive disk usage caused by accumulation of database log files
The system records operation logs for default operations such as addition deletion and modification and names them mysql-bin.* (binary file which cannot be directly deleted). The default storage path is /usr/local/mysql/data/
This log does not have overwrite configuration enabled by default during installation and recording. To modify the log retention period changes must be made to the configuration file and the database must be restarted to take effect. Manually clean up recorded logs as needed.
Permanently modify
1. Check current record retention period;
1. Log in to the database;
2、SHOW VARIABLES LIKE 'expire_logs_days'; -----query result
2. Modify the configuration file;
1、 vim /etc/my.conf
2. Add the following configuration at the last line:
expire_logs_days = 7 ----7 is the number of days to reserve
3. Restart the database
4. Log in to the database and execute
FLUSH LOGS ------Clear stored logs
Temporary cleanup modification, invalid after restarting the database
1. Log in to the database
2、SHOW VARIABLES LIKE 'expire_logs_days'; -----query result
3、SET GLOBAL expire_logs_days = 7; ----7 is the number of days to reserve
4. PURGE BINARY LOGS TO mysql-bin.010; ---Clean log records before the filename mysql-bin.010 sequence
5. SHOW BINARY LOGS; ---Verify reserved logs or directory: check files under /usr/local/mysql/data/