您好,登錄后才能下訂單哦!
1.克隆代碼
#cd /usr/local/src/
#git clone https://github.com/Meituan-Dianping/SQLAdvisor.git
2.安裝依賴包
#yum install -y make cmake libaio-devel libffi-devel glib2 glib2-devel bison gcc gcc-c++
3.編譯sqladvisor時依賴perconaserverclient_r, 因此需要安裝Percona-Server-shared-56。有可能需要配置軟鏈接例如:
#cd /usr/lib64/
#ln -s libperconaserverclient_r.so.18 libperconaserverclient_r.so
4.安裝percona56 yum源及安裝:
#wget http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
#yum install percona-release-0.1-3.noarch.rpm -y
#yum install Percona-Server-shared-56 -y
5. 編譯sqladvisor的依賴項sqlparser(源碼目錄)
#cd /usr/local/src/SQLAdvisor/
#cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser -DIGNORE_AIO_CHECK=/usr/share/doc/libaio-0.3.109 ./
#make && make install
6.編譯sqladvisor(源碼目錄)
#cd ./sqladvisor/
#cmake -DCMAKE_BUILD_TYPE=debug ./
#make
7.完成測試
#cp /usr/local/src/SQLAdvisor/sqladvisor/sqladvisor /usr/bin/sqladvisor
#sqladvisor -h 127.0.0.1 -P 3306 -u root -p '123456' -d test -q "sql語句" -v 1
8.簡化命令
#vim /etc/sql.cnf
[sqladvisor]
username=xxx
password=xxx
host=xxx
port=xxx
dbname=xxx
#sqladvisor -f /etc/sql.cnf -q "sql語句" -v 1
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。