4.可以测试工具了
本地显示数据
?
[root@skatedb55 dist]# ./mysqlsize --dbtype=mysql --cfg=/tmp/my.cnf --field=mysqld --datadir=innodb_data_home_dir --logdir=innodb_log_group_home_dir The parameter load is not provided.So don't load into database Schema: test2 total: 528540K Increment: 0K Schema: test5 total: 368352K Increment: 0K Schema: test4 total: 4K Increment: 0K Schema: performance_schema total: 212K Increment: 0K Schema: test6 total: 1060K Increment: 48K Schema: test30 total: 680K Increment: 0K Schema: testa total: 592216K Increment: 0K Schema: testb total: 592340K Increment: 0K Schema: testprod total: 804K Increment: 0K Schema: ty_database total: 488K Increment: 0K Schema: mysql total: 1016K Increment: 0K Schema: test total: 55344K Increment: 0K Schema: salt total: 272K Increment: 0K 2015-01-04 Binary log:10620000 K You have new mail in /var/spool/mail/root [root@skatedb55 dist]#
装载到数据库
?
[root@skatedb55 dist]# ./mysqlsize --load=root/root@10.20.0.55:3306:test6 --dbtype=mysql --cfg=/tmp/my.cnf --field=mysqld --datadir=innodb_data_home_dir --logdir=innodb_log_group_home_dir [root@skatedb55 dist]#
?
5. 查询历史数据
mysql> select b.* ,a.logsize from binlogsize a , -> (select date_format(exectime,'%Y-%m-%d') as exectime,hostname,sum(schema_size),sum(incre_size) from dbsize where exectime > date_add(now(),interval -1 day) -> and dbtype='mysql' -> and hostname='skatedb55' -> group by hostname,date_format(exectime,'%Y-%m-%d') -> ) b -> where a.hostname=b.hostname -> and b.exectime=date_format(a.logtime,'%Y-%m-%d') -> ; +------------+-----------+------------------+-----------------+----------+ | exectime | hostname | sum(schema_size) | sum(incre_size) | logsize | +------------+-----------+------------------+-----------------+----------+ | 2015-01-05 | skatedb55 | 27836040 | 648 | 10620000 | | 2015-01-05 | skatedb55 | 27836040 | 648 | 10620000 | +------------+-----------+------------------+-----------------+----------+ 2 rows in set (0.00 sec) mysql>
?