zabbix升級 mysql最佳化

來源:互聯網
上載者:User

標籤:mysql   database   search   local   

./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2


apt-get install libmysqlclient-dev


--aptitude search snmp | grep dev


apt-get install  libxml2 libxml2-dev


apt-get install libsnmp-dev


apt-get install libcurl4-gnutls-dev


fuser -k 80/tcp



mysql -u zabbix -p zabbix < /usr/local/zabbix-3.2.0alpha1/database/mysql/schema.sql

mysql -u zabbix -p zabbix < /usr/local/zabbix-3.2.0alpha1/database/mysql/images.sql

mysql -u zabbix -p zabbix < /usr/local/zabbix-3.2.0alpha1/database/mysql/data.sql


apt-get dist-upgrade -u


--default-character-set=UTF8


*************************************************************************************************************************


wget http://repo.zabbix.com/zabbix/3.0/debian/pool/main/z/zabbix/zabbix-server-mysql_3.0.4-1+wheezy_amd64.deb


dpkg -i zabbix-server-mysql_3.0.4-1+wheezy_amd64.deb


apt-get update



apt-get install zabbix-server-mysql zabbix-frontend-php

********************************************************************************************************************************************************************


統計資料庫大小 

SELECT table_schema , sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"  FROM information_schema.TABLES GROUP BY table_schema;


統計表大小並排序 

SELECT table_name AS "Tables",

round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"

FROM information_schema.TABLES

WHERE table_schema = ‘zabbix‘

ORDER BY (data_length + index_length) DESC;



use zabbix;

truncate table history;

optimize  table history;

truncate table history_str;

truncate table history_uint;


**********************************************************************

#!/bin/bash


# Author: ZhiPeng Wang.

# Last Modified: 2014/6/2


User="root"

Passwd="wangzhipeng"

Date=`date -d $(date -d "-30 day" +%Y%m%d) +%s` #取30天之前的時間戳記


$(which mysql) -u${User} -p${Passwd} -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  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;

"


zabbix升級 mysql最佳化

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.