简体   繁体   English

限制mysql日志文件大小

[英]Limiting mysql log file size

I have a mysql log file that regularly goes over 30gb, this sucks when you realise that your server is full because of this file. 我有一个定期超过30gb的mysql日志文件,当您意识到服务器由于此文件已满时,这很烂。 I need a simple solution to limit this file to about 1gb, i don't need logs that run that long, and i'd rather avoid this problem in the future. 我需要一个简单的解决方案来将该文件限制为大约1GB,我不需要运行那么长时间的日志,并且我希望将来避免出现此问题。

Any ideas? 有任何想法吗? Thanks 谢谢

To specify it in the my.cnf file, backup your current my.cnf file (always recommended), stop slave, stop the MySQL server and place the following option: 要在my.cnf文件中指定它,请备份当前的my.cnf文件(始终建议),停止从站,停止MySQL服务器并放置以下选项:

   # relay log restrictions
   relay-log-space-limit=15G

Then save and quit the file and start MySQL. 然后保存并退出文件并启动MySQL。 Unless you configured differently, MySQL will automatically start the slave thread. 除非您配置不同,否则MySQL将自动启动从属线程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM