In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you what are the practical shell scripts in MYSQL, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
To extract the error information of mysql and call the police, you can follow these steps:
# # variable setting # #
Mark= `date +% Y% m% d% H% M`
Error_file=/data/mysql/data/error.log
Bak_file=/tmp/error_bak.log
Report_file=/tmp/error_rport.log
# create one without error.bak, extract error field information to ${report_file (use > here to assume later email failed and need to retain error information); read ${error_file} and append ${bak_file} (equivalent to backup); clear ${error_file}
[!-f ${bak_file}] & & touch ${bak_file}
[!-f ${report_file}] & & touch ${report_file}
Cat ${error_file} | grep "\ [ERROR\]" > > ${report_file} & & cat ${error_file} > > ${bak_file} & & > ${error_file}
# check the size of ${report_file. If it is greater than 0 (indicating error information), send an email, and then clear ${report_file}.
Logsize= `du-b ${report_file} | awk'{print $1}'`
[$logsize-gt 0] & & / usr/local/bin/sendEmail... & & > ${report_file}
The above can also be simplified to [- s ${logfile}] & & / usr/local/bin/sendEmail. & & > ${report_file}
To extract the slow log of Mysql in real time and give an alarm, you can follow the steps below:
# # variable setting # #
Mark= `date +% Y% m% d% H% M`
Process=/tmp/showprocesslist.log
Slow=/tmp/slow.log
# # output processlis to ${process}. Extract the query information of time > 5 to ${slow}. Use > > to assume that the subsequent email failed, and you need to retain the slow information.
/ usr/local/mysql/bin/mysql-usystem-palitiaoling.compose 123'-e "show full processlist;" | sed's /\\ t\ |\ n / / g'> ${process}
Cat ${process} | awk'($6 > = 5) & & ($660) & & ($6)
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.