美团sql优化工具测试

时间:2021-10-30 03:46:59

参考文档

https://dbarobin.com/2017/03/16/test-report-of-sqladvisor/

安装rpm时报错:Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY error: Failed dependencies:

https://blog.csdn.net/pengpengfly_jhp/article/details/22389371

gcc

Cmake安装

安装cmake之前应该系统中已经安装gcc和g++,否则无法编译cmake

首先去cmake官网下载cmake安装包,下载界面网址为:https://cmake.org/download/ 



3.1.1 拉取最新代码

git clone https://github.com/Meituan-Dianping/SQLAdvisor.git

3.1.2 安装依赖项

yum install -y cmake libaio-devel libffi-devel glib2 glib2-devel bison
如果yum源没有,请挨个下载rpm包,并解压 ,然后执行 rpm -ivh xxx.rpm --force --nodeps

# 因 yum 安装 Percona-Server-shared-56 失败,故使用 rpm 包安装,\
# 具体参考 https://github.com/Meituan-Dianping/SQLAdvisor/issues/12
yum install -y --enablerepo=Percona56 Percona-Server-shared-56
yum install -y Percona-Server-server-56 Percona-Server-client-56

rpm -ivh Percona-Server-shared-56-5.6.25-rel73.1.el6.x86_64.rpm

# 设置软链
cd /usr/lib64/
ls -l libperconaserverclient_r.so.18
ln -s libperconaserverclient_r.so.18 libperconaserverclient_r.so

3.1.3 编译依赖项 sqlparser

1. cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug \
-DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./
2. make && make install

3.1.4 安装 SQLAdvisor 源码

1. cd sqladvisor/
2. cmake -DCMAKE_BUILD_TYPE=debug ./
3. make
4. cp sqladvisor /usr/local/bin
5. 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