mysqlslap是官方提供的压力测试工具之一,官方介绍如下:
mysqlslap is a diagnostic program designed to emulate client load for a MySQL server and to report the timing of each stage. It works as if multiple clients are accessing the server. mysqlslap is available as of MySQL 5.1.4.
原文参考:http://www.davidodwyer.com/category/tags/tcpdump-mysql
#!/bin/bash
tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i) {
if (defined $q) { print "$q\n"; }
$q=$_;
} else {
$_ =~ s/^[ \t]+//; $q.=" $_";
}
}'
可以根据自己的需要稍微改改,我在这里只增加了对 CALL 关键字。
其实很简单,就是利用linux下的 watch 工具来做监控,方法如下:
[yejr@localhost imysql]# watch -d -n 10 "egrep 'MySQL thread|Log|Modified db pages' innodb_status.3249 " Every 10.0s: egrep 'MySQL thread|Log|Modified db pages' innodb_status.3249 Thu Apr 9 10:01:12 2009
原文参考:http://www.xaprb.com/blog/2009/03/25/mysql-command-line-tip-compare-result-sets/
利用mysql客户端的pager功能即可:
mysql> pager md5sum - PAGER set to 'md5sum -' mysql> select * from user; b20bd3864962507e2e05cd8706440ffd - 3 rows in set (0.00 sec) mysql> select * from user; b20bd3864962507e2e05cd8706440ffd - 3 rows in set (0.00 sec) mysql> select * from user; b20bd3864962507e2e05cd8706440ffd - 3 rows in set (0.00 sec)
还不错吧,哈哈
来源: http://www.imysql.cn/blog/3208 & http://www.imysql.cn/
作者:吴炳锡
第一个:
http://mirror.provenscaling.com/
特点:
有社区版和企业版两种,基本上比较全。上面的每个版本基本都没问题。
第二个:
特点:
国际Mysql牛人Peter(仅次于国内牛人叶大师yejr)的公司研究的分支及官方的代码patch都能找到的地方。
第三个:
作用:
备份DB中的数据到单表,以防止增加表后少备份了。
#!/usr/bin/perl
# mysql meg
# wubx
use strict;
use DBI;
my $host='172.16.100.1';
my $port='3306';
my $user='root;
my $passwd='';
my $dsn="dbi:mysql:hostname=$host:port=$port";
my $backup="/backup";
my $dbh= DBI->connect($dsn,$user,'');
unless ($dbh)
{
print "Connect error!\n";
同事碰到麻烦,寻求帮忙,问题是这样的:
有个InnoDB表,想要用 LOAD DATA INFILE 的方式倒数据进去,发现报错:table is full。
我看了一下,日志中没有相关可用信息,该表使用的是共享表空间,总共6个ibdata*文件,只有2个文件的修改时间是最新的,觉得可能不是因为表空间慢的缘故,于是尝试插入少量数据试试看先。分多次插入10,20,100条记录都没问题,一次性插入500多条记录时,就又报table is full了。看来,事务没有问题,再把焦点转会表空间问题上来。尝试性的关闭mysqld,新加一个表空间文件,启动,再插入更多数据,发现这次没问题了,搞定。
一朋友发来消息,说他的mysql报错,日志大致如下:
090318 15:16:35 InnoDB: WARNING: over 4 / 5 of the buffer pool is occupied by InnoDB: lock heaps or the adaptive hash index! Check that your InnoDB: transactions do not set too many row locks. InnoDB: Your buffer pool size is 16 MB. Maybe you should make InnoDB: the buffer pool bigger? InnoDB: Starting the InnoDB Monitor to print diagnostics, including InnoDB: lock heap and hash index sizes.
前言:我想,对于新手来说,有个很重要的问题,就是在mysql发生问题时,就束手无策,不知道该做什么了。要么到论坛里发“冰天雪地裸体跪求帮助”或“急急急”之类的帖子,要么在群里狂喊,对解决问题毫无帮助。这个时候,新手们要做的就是,学会看日志,并且找到问题所在,然后尝试自己动手解决,或者把问题描述清楚,让有经验的人士帮忙。本文说下几种常见问题,以及解决问题的丝路。
最近评论
17 分钟 2 秒 前
1 天 6 小时 前
1 天 6 小时 前
2 天 10 小时 前
1 周 1 天 前
1 周 2 天 前
1 周 3 天 前