MySQL慢查詢日誌和錯誤記錄檔按天輪詢

來源:互聯網
上載者:User

問題背景
為便於問題排查和減小記錄檔大小,需對慢查詢日誌和錯誤記錄檔按天輪詢


輪詢指令碼/data/scripts/mysql-log-rotate):

"/data/dbdata/otherlog/slow_query.log" "/data/dbdata/otherlog/mysql_error.log" {    create 660 mysql mysql    dateext    notifempty    daily    maxage 60    rotate 30    missingok    compress    olddir /data/dbdata/otherlog    postrotate        if /usr/local/mysql/bin/mysqladmin ping -uroot -S /var/run/mysql/mysql.sock &>/dev/null; then            /usr/local/mysql/bin/mysqladmin flush-logs -uroot -S /var/run/mysql/mysql.sock        fi    endscript}


CRONTAB資訊:

5923***(/usr/sbin/logrotate-f/data/scripts/mysql-log-rotate>/dev/null2>&1)

650) this.width=650;" title="11.png" alt="205359648.png" src="http://www.bkjia.com/uploads/allimg/131229/2032231104-0.png" />






本文出自 “每分每秒” 部落格,請務必保留此出處http://sofar.blog.51cto.com/353572/1303771

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.