SQLAdvisor安裝(CentOS 6)
1. 從git上拉取最新程式碼
[BEGIN] 2018/8/6 14:13:04 (venv4archer) [root@mysql-server data1]# mkdir SQLAdvisor (venv4archer) [root@mysql-server data1]# cd SQLAdvisor (venv4archer) [root@mysql-server SQLAdvisor]# git clone 正克隆到 'SQLAdvisor'... remote: Counting objects: 1460, done. remote: Total 1460 (delta 0), reused 0 (delta 0), pack-reused 1460 接收物件中: 100% (1460/1460), 19.92 MiB | 473.00 KiB/s, done. 處理 delta 中: 100% (367/367), done. (venv4archer) [root@mysql-server SQLAdvisor]# ls SQLAdvisor
2. 安裝依賴包
(venv4archer) [root@mysql-server SQLAdvisor]# yum install cmake libaio-devel libffi-devel glib2 glib2-devel -y (venv4archer) [root@mysql-server SQLAdvisor]# yum install (venv4archer) [root@mysql-server yum.repos.d]# yum makecache (venv4archer) [root@mysql-server yum.repos.d]# yum install Percona-Server-shared-56
3. 編譯依賴項sqlparser
(venv4archer) [root@mysql-server SQLAdvisor]# cd SQLAdvisor/ (venv4archer) [root@mysql-server SQLAdvisor]# cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./ -- Running cmake version 2.8.12.2 -- Found Git: /usr/bin/git (found version "1.8.3.1") -- The C compiler identification is GNU 4.4.7 -- The CXX compiler identification is GNU 4.4.7 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Looking for include file libaio.h -- Looking for include file libaio.h - found -- Looking for io_queue_init in aio -- Looking for io_queue_init in aio - found (venv4archer) [root@mysql-server SQLAdvisor]# make Scanning dependencies of target INFO_BIN [ 0%] Built target INFO_BIN Scanning dependencies of target INFO_SRC [ 0%] Built target INFO_SRC Scanning dependencies of target abi_check [ 0%] Built target abi_check Scanning dependencies of target zlib [ 0%] Building C object zlib/CMakeFiles/zlib.dir/adler32.c.o [ 1%] Building C object zlib/CMakeFiles/zlib.dir/compress.c.o [ 1%] Building C object zlib/CMakeFiles/zlib.dir/crc32.c.o [ 1%] Building C object zlib/CMakeFiles/zlib.dir/deflate.c.o [ 2%] Building C object zlib/CMakeFiles/zlib.dir/gzio.c.o [ 2%] Building C object zlib/CMakeFiles/zlib.dir/infback.c.o (venv4archer) [root@mysql-server SQLAdvisor]# make install [ 0%] Built target INFO_BIN [ 0%] Built target INFO_SRC [ 0%] Built target abi_check [ 5%] Built target zlib
建立 percona 包的軟連線
(venv4archer) [root@mysql-server sqladvisor]# cd /usr/lib64/ (venv4archer) [root@mysql-server lib64]# ln -s libperconaserverclient_r.so.18 libperconaserverclient_r.so
4. 安裝SQLAdvisor原始碼
(venv4archer) [root@mysql-server SQLAdvisor]# cd sqladvisor/ (venv4archer) [root@mysql-server sqladvisor]# cmake -DCMAKE_BUILD_TYPE=debug ./ -- The C compiler identification is GNU 4.4.7 -- The CXX compiler identification is GNU 4.4.7 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Configuring done -- Generating done -- Build files have been written to: /data1/SQLAdvisor/SQLAdvisor/sqladvisor (venv4archer) [root@mysql-server sqladvisor]# make Linking CXX executable sqladvisor [100%] Built target sqladvisor (venv4archer) [root@mysql-server sqladvisor]# ls -l 總用量 580 -rw-r--r-- 1 root root 12096 8月 6 14:43 CMakeCache.txt drwxr-xr-x 5 root root 4096 8月 6 14:44 CMakeFiles -rw-r--r-- 1 root root 1632 8月 6 14:43 cmake_install.cmake -rw-r--r-- 1 root root 694 8月 6 14:15 CMakeLists.txt -rw-r--r-- 1 root root 53195 8月 6 14:15 main.cc -rw-r--r-- 1 root root 4794 8月 6 14:43 Makefile -rw-r--r-- 1 root root 257 8月 6 14:15 README -rwxr-xr-x 1 root root 502541 8月 6 14:44 sqladvisor
5. 測試
(venv4archer) [root@mysql-server sqladvisor]# ./sqladvisor -h 172.31.0.68 -P 23305 -u inception -p 'inception' -d test -q "select * from test" -v 1 2018-08-06 14:49:04 13887 [Note] 第1步: 對SQL解析最佳化之後得到的SQL:select `*` AS `*` from `test`.`test` 2018-08-06 14:49:04 13887 [Note] 第2步:表test 的SQL太逆天,沒有最佳化建議 2018-08-06 14:49:04 13887 [Note] 第3步: SQLAdvisor結束!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2199275/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- centos6 安裝EPELCentOS
- CentOS6 安裝 RedisCentOSRedis
- centos 6.x 安裝 gogsCentOSGo
- CentOS6.x安裝RabbitMQCentOSMQ
- centos6上安裝dockerCentOSDocker
- CentOS 6 NFS的安裝配置CentOSNFS
- CentOS6.X系統安裝CentOS
- Redhat/Centos6.x安裝ChromeRedhatCentOSChrome
- CentOS6安裝ZendOptimizer(ZendGuardLoader)CentOS
- CentOS6yum方式安裝lnmpCentOSLNMP
- centos6 下的apache安裝CentOSApache
- centos7 安裝mongo6CentOSGo
- SQL最佳化工具(MYSQL)——SQLAdvisor安裝使用MySql
- CentOS 6 安裝MAVEN及系統配置CentOSMaven
- Linux系統安裝(CentOS6)LinuxCentOS
- CentOS 6 安裝 APC(Alternative PHP Cache)CentOSPHP
- CentOS 6 安裝配置教程【完整版】CentOS
- centos6安裝telnet服務CentOS
- centos7安裝reids6CentOS
- Centos6 下安裝Nginx+Mysql+PHPCentOSNginxMySqlPHP
- 在 Centos/RHEL 6.X 上安裝 WettyCentOS
- CentOS6.x安裝php5.6.xCentOSPHP
- CentOS6下mysql的安裝與配置CentOSMySql
- httpd-2.4 編譯安裝(centos6)httpd編譯CentOS
- 在Centos7上安裝Redis6CentOSRedis
- Centos6下使用yum安裝MariaDBCentOS
- CentOS6 編譯安裝 redis-3.2.3CentOS編譯Redis
- CentOS學習筆記 – 6. docker安裝CentOS筆記Docker
- CentOS6/7 使用saltstack源安裝saltstackCentOS
- CentOS 6安裝Oracle報錯解決方案CentOSOracle
- CentOS6安裝dovecot並提供sasl功能CentOS
- CentOS6 基於 Python 安裝 SentryCentOSPython
- CentOS 6 下RPM方式安裝MySQL5.6CentOSMySql
- CentOS 6.x安裝完成後的優化CentOS優化
- 在 CentOS6 上安裝 Zabbix2.4 ServerCentOSServer
- centos6下安裝部署hadoop2.2CentOSHadoop
- CentOS 6.X 上安裝配置 NFS 目錄共享CentOSNFS
- centos6安裝最新syslog-ng推送hdfsCentOS