SQLAdvisor(美团)部署实录
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQLAdvisor(美团)部署实录相关的知识,希望对你有一定的参考价值。
[[email protected] ~]# rpm -ivh epel-release-6-8.noarch.rpm
[[email protected] ~]# rpm -ivh percona-release-0.1-4.noarch.rpm
[[email protected] ~]# yum install -y cmake libaio-devel libffi-devel glib2 glib2-devel
[[email protected] ~]# yum install -y Percona-Server-shared-55
[[email protected] ~]# git clone https://github.com/Meituan-Dianping/SQLAdvisor.git
Initialized empty Git repository in /root/SQLAdvisor/.git/
remote: Counting objects: 1460, done.
remote: Total 1460 (delta 0), reused 0 (delta 0), pack-reused 1460
Receiving objects: 100% (1460/1460), 19.92 MiB | 109 KiB/s, done.
Resolving deltas: 100% (368/368), done.
[[email protected] ~]# cd SQLAdvisor
[[email protected] SQLAdvisor]# cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./
[[email protected] SQLAdvisor]# make && make install
[[email protected] SQLAdvisor]# cd sqladvisor
[[email protected] sqladvisor]# cmake -DCMAKE_BUILD_TYPE=debug ./
[[email protected] sqladvisor]# make
[[email protected] sqladvisor]# cp sqladvisor /usr/bin
[[email protected] ~]# sqladvisor --help
Usage:
sqladvisor [OPTION...] sqladvisor
SQL Advisor Summary
Help Options:
-?, --help Show help options
Application Options:
-f, --defaults-file sqls file
-u, --username username
-p, --password password
-P, --port port
-h, --host host
-d, --dbname database name
-q, --sqls sqls
-v, --verbose 1:output logs 0:output nothing
[[email protected] ~]# vi sql.cnf
[sqladvisor]
username=tpcc
password=tpcc
host=192.168.1.200
port=3306
dbname=tpcc1000
sqls=select * from warehouse;
[[email protected] ~]# sqladvisor -f sql.cnf -v 1
2018-02-13 09:04:31 20618 [Note] 第1步: 对SQL解析优化之后得到的SQL:select `*` AS `*` from `tpcc1000`.`warehouse`
2018-02-13 09:04:31 20618 [Note] 第2步:表warehouse 的SQL太逆天,没有优化建议
2018-02-13 09:04:31 20618 [Note] 第3步: SQLAdvisor结束!
以上是关于SQLAdvisor(美团)部署实录的主要内容,如果未能解决你的问题,请参考以下文章