• 注意MYSQL的日志更迭


    原文链接:http://www.mysqlperformanceblog.com/2007/12/09/be-careful-rotating-mysql-logs/

    If you enable logging of all queries as “slow queries” using the patch or MySQL 5.1 you can get log file to grow huge. Same may happen with general log file. In some cases we’ve got log file sizes of 100G or more which may need to be cleaned up.

    如果使用patch或在5.1版本启用日志记录所有的查询到“慢查询”日志里,你的日志文件可以增长到非常巨大。类似的情况也会发生在通用日志文件上。在一些情景下我们得到的可能需要清理的日志文件超过了100G甚至更大。

     

    Here is some danger waiting for you at least on typical Linux systems – If you follow most simple process – delete log file you do not need and run “FLUSH LOGS” so file is recreated and space reclaimed you can get into serious trouble. File close operation will when perform deletion which can be quite a long process, depending on filesystem and log file size – we’ve seen it to take 10 minutes or more in some cases. When log file is reopened MySQL will be practically unavailable causing unanticipated downtime.

    至少在一些典型的LINUX系统上,有一些危险在等着你--如果你按照最简单的操作--删除你不需要的日志文件并执行“FLUSH LOGS”操作,日志文件会被重建,空间被回收,你会陷入严重的麻烦之中。文件关闭操作将会执行删除,这将是一个相当漫长的过程,取决于文件系统和日志文件大小--我们看到过超过10分钟甚至更多的情况。当日志文件被重新打开,MYSQL将几乎不可用,从而发生意料之外的宕机。

     

    The workaround for this problem is very simple – instead of deleting MySQL log file – rename it, call “FLUSH LOGS” which will be instant as it will not involve complex delete operation and when you can delete the log file you no more need.

    解决这个问题的方法非常简单--不要删除MYSQL日志--重命名他们,执行“FLUSH LOGS”将瞬间完成,因为它不涉及复杂的删除操作。当这些日志文件不再需要时,你可以删除他们。

     

    It can be also good idea to hook up log rotate to take care of MySQL logs so you would not need to cleanup them manually. In some cases it is already setup if you use MySQL distribution supplied by OS vendor.

    设置循环日志也是处理MYSQL日志的一个好办法,你不需要去手动清理它们。如果你使用MYSQL发布,有时候一些操作系统提供商已经预装了它。(?)

  • 相关阅读:
    文件查找和压缩
    shell脚本编程基础
    [模板]数据生成与对拍
    Codeforces Round #746 (Div. 2)
    Codeforces Round #712 (Div. 2)
    Codeforces Round #715 (Div. 2)
    Codeforces Round #752 (Div. 2)
    提高模拟赛Day8T3树上跑步
    提高模拟赛Day8T2最大匹配
    提高模拟赛Day8T1求中位数
  • 原文地址:https://www.cnblogs.com/zuoxingyu/p/2711485.html
Copyright © 2020-2023  润新知