Get the App
SLTechnology News&Howtos  ›  Database  › 

How to install SQLAdvisor in CentOS 6

Shulou Source: shulou.com Published: 2022-05-31 15:54:51 11月14日 Update

This article is about how to install SQLAdvisor in CentOS 6. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Pull the latest code from git

[BEGIN] 14:13:04 on 2018-8-6 (venv4archer) [root@mysql-server data1] # mkdir SQLAdvisor (venv4archer) [root@mysql-server data1] # cd SQLAdvisor (venv4archer) [root@mysql-server SQLAdvisor] # git clone https://github.com/Meituan-Dianping/SQLAdvisor.git is being cloned to 'SQLAdvisor'...remote: Counting objects: 1460, done.remote: Total 1460 (delta 0), reused 0 (delta 0), pack-reused 1460 recipient: 100% (1460 Counting objects) 19.92 MiB | 473.00 KiB/s, done. Done. (venv4archer) [root@mysql-server SQLAdvisor] # lsSQLAdvisor in processing delta

two。 Install dependency packages

(venv4archer) [root@mysql-server SQLAdvisor] # yum install cmake libaio-devel libffi-devel glib2 glib2-devel-y (venv4archer) [root@mysql-server SQLAdvisor] # yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm(venv4archer) [root@mysql-server yum.repos.d] # yum makecache (venv4archer) [root@mysql-server yum.repos.d] # yum install Percona-Server-shared-56

3. Compile dependency 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 Muir-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] # makeScanning dependencies of target INFO_BIN [0] Built target INFO_BINScanning dependencies of target INFO_SRC [0] Built target INFO_SRCScanning dependencies of target abi_check [0] Built target abi_checkScanning 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

Establish a soft connection for the percona package

(venv4archer) [root@mysql-server sqladvisor] # cd / usr/lib64/ (venv4archer) [root@mysql-server lib64] # ln-s libperconaserverclient_r.so.18 libperconaserverclient_r.so

4. Install SQLAdvisor source code

(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] # makeLinking CXX executable sqladvisor [100%] Built target sqladvisor (venv4archer) [root@mysql-server sqladvisor] # ls-l Total consumption 580 Muhammad -1 root root 12096 August 6 14:43 CMakeCache.txtdrwxr-xr-x 5 root root 4096 August 6 14:44 CMakeFiles-rw-r--r-- 1 root root 1632 August 6 14:43 cmake_install.cmake-rw-r--r-- 1 root root 694 August 6 14:15 CMakeLists.txt-rw-r--r-- 1 root root 53195 August 6 14:15 main.cc-rw-r--r-- 1 root root 4794 8 Monthly 6 14:43 Makefile-rw-r--r-- 1 root root 257 August 6 14:15 README-rwxr-xr-x 1 root root 502541 August 6 14:44 sqladvisor

5. test

(venv4archer) [root@mysql-server sqladvisor] #. / sqladvisor-h 172.31.0.68-P 23305-u inception-p 'inception'-d test-Q "select * from test"-v 12018-08-06 14:49:04 13887 [Note] step 1: SQL:select `* `AS` * `from `test`.`test` 2018-08-06 14:49:04 [Note] step 2: table test SQL is too upside down No optimization recommendations 2018-08-06 14:49:04 13887 [Note] step 3: end of SQLAdvisor! Thank you for reading! This is the end of the article on "how to install SQLAdvisor in CentOS 6". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Tags: Content more articles good practical code objects suggestions articles source code usage see knowledge reference processing help related testing compilation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Xiaomi OPPO Reno Shulou Tech Info vpn