Getting MySQL Table Sizes

SELECT table_name table_name,
engine,
ROUND(data_length/1024/1024,2) total_size_mb,
table_rows
FROM information_schema.tables
WHERE table_schema = ‘?????’
ORDER BY 3 desc

Advertisements
Getting MySQL Table Sizes

MySQL-MMM on Centos 5 – Part 1

This guide assumes a clean centos 5 install with no MySQL installed. It will install the MySQL 5.5.6 binaries

Add the DAG and EPEL Repositories

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm


rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

Install MySQL

mkdir install
cd install


wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-5.5.6_rc-1.rhel5.x86_64.tar/from/http://www.mirrorservice.org/sites/ftp.mysql.com/
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-shared-compat-5.5.6_rc-1.rhel5.x86_64.rpm/from/http://www.mirrorservice.org/sites/ftp.mysql.com/


tar -xvf MySQL-5.5.6_rc-1.rhel5.x86_64.tar
rpm -i *.rpm

Install required dependencies

yum -y update
yum -y install perl-Proc-Daemon.noarch perl-Text-Diff.noarch perl-MailTools.noarch perl-Log-Log4perl.noarch perl-Log-Dispatch.noarch iproute perl-DBI.x86_64 perl-DBD-MySQL.x86_64 perl-Class-Singleton.noarch gcc perl-Net-ARP.x86_64


yum -y install perl-ExtUtils-CBuilder.noarch perl-Attribute-Handlers-Prospective.noarch perl-Params-Validate.x86_64


yum -y install mysql-mmm-agent mysql-mmm-monitor mysql-mmm-tools

Install and config NTP

Note: The NTP isn’t a requirement of MMM but I normally use virtual machines where the clocks slip. so I have put this more as a reminder to myself to install it

yum -y install ntp
/usr/sbin/ntpdate -u ntp2.ja.net


crontab -l > /root/cron-backup-$$
( cat /root/cron-backup-$$
echo “# Backup the logfiles”
echo “*/30 * * * * /usr/sbin/ntpdate -u ntp2.ja.net > /dev/null” ) | crontab –

MySQL-MMM on Centos 5 – Part 1