Meituan-Dianping / Meituan-Dianping/SQLAdvisor

SQLAdvisor 安装 aws环境

Open
#26 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
5.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

#SQLAdvisor 安装

---
### 1. SQLAdvisor安装
>环境:Linux 86_64 GNU/Linux

#### 1.1 拉取最新代码
```
git clone https://github.com/Meituan-Dianping/SQLAdvisor.git
```

#### 1.2 安装依赖项

```
1. yum | apt-get install cmake libaio-devel libffi-devel glib2 glib2-devel
2. yum | apt-get install --enablerepo=Percona56 Percona-Server-shared-56
```

`第2步安装失败,调整:`
1. `cd /d2platform/`
2. `wget https://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.25-73.1/binary/redhat/6/x86_64/Percona-Server-5.6.25-73.1-r07b797f-el6-x86_64-bundle.tar`
3. ` tar -xvf Percona-Server-5.6.25-73.1-r07b797f-el6-x86_64-bundle.tar`
4. `rpm -ivh Percona-Server-shared-56-5.6.25-rel73.1.el6.x86_64.rpm`
`或者`
1. `yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm`

`上面两步是在issue里面看到的。我都装了。。`

**注意**

1. 跟据glib安装的路径,修改SQLAdvisor/sqladvisor/CMakeLists.txt中的两处include_directories针对glib设置的path。glib yum 安装默认不需要修改路径
2. 编译sqladvisor时依赖perconaserverclient_r, 因此需要安装Percona-Server-shared-56。`有可能需要配置软链接例如:1. cd /usr/lib64/ 2. ln -s libperconaserverclient_r.so.18 libperconaserverclient_r.so`
3. 有可能需要配置percona56 yum源: `yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm`

#### 1.3 编译依赖项sqlparser
`cd SQLAdvisor`
```
1. cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./
2. make && make install
```

**注意**

1. DCMAKE_INSTALL_PREFIX为sqlparser库文件和头文件的安装目录,其中lib目录包含库文件libsqlparser.so,include目录包含所需的所有头文件。
2. DCMAKE_INSTALL_PREFIX值尽量不要修改,后面安装依赖这个目录。

#### 1.4 安装SQLAdvisor源码
```
1. cd SQLAdvisor/sqladvisor/
2. cmake -DCMAKE_BUILD_TYPE=debug ./
3. make
4. 在本路径下生成一个sqladvisor可执行文件,这即是我们想要的。
```
---

eg:

./sqladvisor -h ***.com -P 3306 -u *** -p '***' -d db_billing -q "select * from tb_cashier limit 10" -v 1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the installation steps in the issue alongside SQLAdvisor/sqladvisor/CMakeLists.txt, with attention to the glib include paths and the Percona client dependency. Reproduce the documented build on the stated Linux x86_64 environment and clarify the AWS-specific setup; done means a newcomer can follow the instructions through a successful sqladvisor build and invocation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, linux, mysql
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.