1. 程式人生 > >美團sql優化工具測試

美團sql優化工具測試

參考文件

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