In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
If the log_bin parameter is configured, you need to configure the expire_logs_days parameter to specify the binary log retention time, otherwise the disk space will be full by the log sooner or later. If it has not been configured before, the configuration steps are as follows:
1. View the current configuration
(root@localhost) [(none)] show global variables like 'log_bin'
+-+ +
| | Variable_name | Value |
+-+ +
| | log_bin | ON |
+-+ +
1 row in set (0.02 sec)
(root@localhost) [(none)] show global variables like 'expire_logs_days'
+-+ +
| | Variable_name | Value |
+-+ +
| | expire_logs_days | 0 | |
+-+ +
1 row in set (0.00 sec)
(root@localhost) [(none)] show global variables like 'max_binlog_size'
+-+ +
| | Variable_name | Value |
+-+ +
| | max_binlog_size | 1073741824 | |
+-+ +
1 row in set (0.00 sec)
(root@localhost) [(none)] show binary logs
+-+ +
| | Log_name | File_size |
+-+ +
| | mysql-bin.000001 | 614 | |
| | mysql-bin.000002 | 1595 | |
| | mysql-bin.000003 | 445747850 | |
+-+ +
3 rows in set (0.02 sec)
[root@dbrac16 ~] # ll / usr/local/mysql/data/mysql-bin*
-rw-r- 1 mysql mysql 614 May 11 10:06 / usr/local/mysql/data/mysql-bin.000001
-rw-r- 1 mysql mysql 1595 May 17 09:45 / usr/local/mysql/data/mysql-bin.000002
-rw-r- 1 mysql mysql 445747850 May 19 14:28 / usr/local/mysql/data/mysql-bin.000003
-rw-r- 1 mysql mysql 117 May 17 11:16 / usr/local/mysql/data/mysql-bin.index
2. View slave status
[root@dbrac17 ~] # mysql-uroot-p123456-e "show slave status\ G" | grep Master_Log_File
Mysql: [Warning] Using a password on the command line interface can be insecure.
Master_Log_File: mysql-bin.000003
Relay_Master_Log_File: mysql-bin.000003
3. Clear expired logs manually
If you accumulate too many logs, you can perform this step first to clean up some of the logs.
(root@localhost) [(none)] purge master logs before '2017-05-17 0000 purl 0000'
Query OK, 0 rows affected (0.15 sec)
(root@localhost) [(none)] show binary logs
+-+ +
| | Log_name | File_size |
+-+ +
| | mysql-bin.000002 | 1595 | |
| | mysql-bin.000003 | 445747850 | |
+-+ +
2 rows in set (0.00 sec)
4. Configuration parameters
[root@dbrac16 ~] # cat / etc/my.cnf | grep expire_logs_days
Expire_logs_days = 3
Modify the parameter file and set the log to be kept for 3 days. Restart is required to take effect.
Set directly, effective immediately.
(root@localhost) [(none)] set global expire_logs_days=3
Query OK, 0 rows affected (0.00 sec)
Triggers an expired log cleanup operation.
(root@localhost) [(none)] flush logs
Query OK, 0 rows affected (0.04 sec)
(root@localhost) [(none)] show binary logs
+-+ +
| | Log_name | File_size |
+-+ +
| | mysql-bin.000003 | 445747897 | |
| | mysql-bin.000004 | 201 | |
+-+ +
3 rows in set (0.00 sec)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.