温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

MySQL 性能医生:OrzDBA

发布时间:2020-06-16 20:58:30 来源:网络 阅读:489 作者:spark_Gg 栏目:MySQL数据库

svn co http://code.taobao.org/svn/orzdba/trunk
wget http://github.com/downloads/Lowercases/tcprstat/tcprstat-static.v0.3.1.x86_64

ln -sf /trunk/tcprstat-static.v0.3.1.x86_64 /usr/bin/tcprstat
chmod u+s /usr/bin/tcprstat

需要在代码160行左右配置MySQL的相关验证信息,如username,password,host,port,sock等
vi orzdba

my $port = 3307; # -P

my $MYSQL = qq{mysql -s --skip-column-names -ugg -p111111 -h20.72.8.17 $port };
$MYSQL .= qq{-S$socket } if defined $socket;
my $TCPRSTAT = "/usr/bin/tcprstat --no-header -t 1 -n 0 -p $port";

解压orzdba_rt_depend_perl_module.tar.gz,安装rt所依赖的perl模块
yum install perl-Test-Simple.x86_64
yum install perl-Time-HiRes
yum install perl-ExtUtils-CBuilder
yum install perl-ExtUtils-MakeMaker
yum install perl-DBD-MySQL
yum install perl-DBI
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/perl-Test-Simple-0.98-243.el7.noarch.rpm

rpm -ivh perl-Test-Simple-0.98-243.el7.noarch.rpm
tar -zxvf orzdba_rt_depend_perl_module.tar.gz
cd Perl_Module

1.tar -zxvf version-0.99.tar.gz
cd version-0.99
perl Makefile.PL
make
make test
cp lib/version/Internals.pod blib/lib/version/Internals.pod
cp lib/version.pm blib/lib/version.pm
cp lib/version.pod blib/lib/version.pod
cd vutil/
cp lib/version/vxs.pm ../blib/lib/version/vxs.pm
chmod 644 vxs.bs
rm -f ../blib/arch/auto/version/vxs/vxs.so
chmod 755 ../blib/arch/auto/version/vxs/vxs.so
cp vxs.bs ../blib/arch/auto/version/vxs/vxs.bs
chmod 644 ../blib/arch/auto/version/vxs/vxs.bs
cd ..
rm -f ../blib/arch/auto/version/vxs/vxs.so
cd vutil/
chmod 755 ../blib/arch/auto/version/vxs/vxs.so
cd ..
make install

2.tar -zxvf Class-Data-Inheritable-0.08.tar.gz
cd Class-Data-Inheritable-0.08
perl Makefile.PL
make test
make install

3.tar -zxvf Module-Build-0.31.tar.gz
cd Module-Build-0.31
perl Build.PL
./Build
./Build test
./Build install

4.tar -zxvf File-Lockfile-v1.0.5.tar.gz
cd File-Lockfile-v1.0.5
perl Build.PL
perl ./Build
perl ./Build test
perl ./Build install

vi /etc/hosts
10.72.8.17 hank-yoon.com
chmod -755 orzdba
ln -sf /trunk/orzdba /usr/bin/orzdba

㈠ 查看MySQL响应时间(rt)
orzdba -lazy -rt -S /data/mysql/mysql.sock
注释:
count:此间隔内处理完成的请求数量
avg:此间隔内所有完成的请求,响应的平均时间
95_avg:此间隔内,95%的请求量的平均响应时间,单位微妙,该值较能体现MySQL Server的查询平均响应时间

㈡ 监控InnoDB的各项指标
orzdba -innodb -S /data/mysql/mysql.sock
㈢ 监控MySQL Server性能
orzdba -mysql -S /data/mysql/mysql.sock

orztop
yum install perl-CPAN perl-TermReadKey -y
chmon755 /orztop

my $orzdba = '/usr/bin/orzdba -lazy';
#my ($mysql_dbname,$mysql_host,$mysql_port,$mysql_user,$mysql_pass) = ('','10.72.8.17',3307,'gg','111111');
my ($mysql_dbname,$mysql_host,$mysql_port,$mysql_user,$mysql_pass) = ('','10.72.8.17',3307,'gg','111111');
my $mysql_socket = '/data/mysql/mysql.sock';

/orztop

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI