Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb_log_file_max_days 修改后 多久可以生效?
Experts, how long does it take for tidb_log_file_max_days to take effect after modification?
In the current session, set tidb_log_file_max_days = 10;
Waited for 5 minutes, but the TiDB logs from 10 days ago still exist.
It is only effective for the current TiDB server. Did you use load balancing to connect and make the changes?
Modify the configuration file. If there are several TiDB instances, just overwrite them together. It will take effect after restarting.
Try setting set global tidb_log_file_max_days = 10;
.
Is there an error in the official documentation? Adding global is not allowed. After modification, the value has changed, but the logs have not been deleted.
It should have been changed to global in the later versions. I can use 6.5.
The current situation does not allow reload… Temporary modifications are also not effective.
Modified directly using the MySQL client to connect to TiDB.
Manually configure the variable on each node, then reload with --skip to refresh the configuration without restarting.
I couldn’t find how long it takes to take effect in the documentation.
After you made the changes, how long did it take for the logs on the corresponding tidb-server to start being automatically cleaned?
In my tests with version 6.5, after modifying set tidb_log_file_max_days = 30;
, it took effect immediately on the current TiDB node, and the logs were cleaned up immediately.
This variable cannot be set to global. It is only effective for the current connection’s TiDB node. Tested on V6.1.0.
After execution, the logs of the node were immediately cleared.
I directly used a script to delete it:
/usr/bin/find /tidb-deploy/tidb-3306/log/ -mtime +7 -name “tidb202log” -exec rm -rf {} ;
I’ve gained another little trick again~