您好,登錄后才能下訂單哦!
zabbix 清理舊數(shù)據(jù)
#!/bin/bash User=user Passwd=passwd Date=`date -d $(date -d "-30 day" +%Y%m%d) +%s` #取30天之前的時(shí)間戳 $(which mysql) -u${User} -p${Passwd} -S /tmp/mysql.sock -e " use zabbix; DELETE FROM history WHERE 'clock' < $Date; optimize table history; DELETE FROM history_str WHERE 'clock' < $Date; optimize table history_str; DELETE FROM history_uint WHERE 'clock' < $Date; optimize table history_uint; DELETE FROM history_text WHERE 'clock' < $Date; optimize table history_text; DELETE FROM trends WHERE 'clock' < $Date; optimize table trends; DELETE FROM trends_uint WHERE 'clock' < $Date; optimize table trends_uint; DELETE FROM events WHERE 'clock' < $Date; optimize table events; "
mysql ibdata空間清理
mysqldump -u [username] -p[root_password] [database_name] > dumpfilename.sql DROP DATABASE database_name /etc/init.d/mysqld stop rm /var/lib/mysql/ibdata1 rm /var/lib/mysql/ib_logfile* /etc/init.d/mysqld start create database [database_name] mysql -u [username]-p[root_password] [database_name] < dumpfilename.sql
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。