這篇文章給大家分享的是有關(guān)CentOS 6如何安裝SQLAdvisor的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。
為神農(nóng)架林區(qū)等地區(qū)用戶提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及神農(nóng)架林區(qū)網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為網(wǎng)站設(shè)計(jì)、做網(wǎng)站、神農(nóng)架林區(qū)網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!
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 https://github.com/Meituan-Dianping/SQLAdvisor.git 正克隆到 'SQLAdvisor'... remote: Counting objects: 1460, done. remote: Total 1460 (delta 0), reused 0 (delta 0), pack-reused 1460 接收對(duì)象中: 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 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. 編譯依賴項(xiàng)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. 測(cè)試
(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步: 對(duì)SQL解析優(yōu)化之后得到的SQL:select `*` AS `*` from `test`.`test` 2018-08-06 14:49:04 13887 [Note] 第2步:表test 的SQL太逆天,沒(méi)有優(yōu)化建議 2018-08-06 14:49:04 13887 [Note] 第3步: SQLAdvisor結(jié)束!
感謝各位的閱讀!關(guān)于“CentOS 6如何安裝SQLAdvisor”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!
網(wǎng)頁(yè)標(biāo)題:CentOS6如何安裝SQLAdvisor
URL地址:http://jinyejixie.com/article44/jjheee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、服務(wù)器托管、做網(wǎng)站、App設(shè)計(jì)、全網(wǎng)營(yíng)銷推廣、網(wǎng)頁(yè)設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)