Install SOAR and related environment configuration under Linux

Preface

SOAR (SQL Optimizer And Rewriter) is an automated tool for optimizing and rewriting SQL. Developed and maintained by the database team of Xiaomi artificial intelligence and cloud platform

Github https://github.com/XiaoMi/soar

 

installation steps

1. Install go environment

  https://blog.csdn.net/javanbme/article/details/112607083

2. Download the source code

  Method 1 Link: https://pan.baidu.com/s/1r4aJNCvG_rL9BmQfVptvhA  Password: iwdj put in the /opt/soar directory

  Way two 

cd /opt
mkdir soar
cd soar
wget -c https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.linux-amd64

3. Rename

mv soar.linux-amd64  soar

4. Add permissions

chmod a+x /opt/soar/soar

5. Create a configuration file

touch /opt/soar/soar.yaml

  Add the following configuration for reference:  https://github.com/XiaoMi/soar/blob/dev/doc/config.md   

# 线上环境配置
online-dsn:
  addr: 127.0.0.1:3306
  schema: test
  user: root
  password: newpass
  disable: false
# 测试环境配置
test-dsn:
  addr: 127.0.0.1:3306
  schema: test
  user: root
  password: newpass
  disable: false
# 是否允许测试环境与线上环境配置相同
allow-online-as-test: true
# 是否清理测试时产生的临时文件
drop-test-temporary: true
# 语法检查小工具
only-syntax-check: false
sampling-statistic-target: 100
sampling: false
# 日志级别,[0:Emergency, 1:Alert, 2:Critical, 3:Error, 4:Warning, 5:Notice, 6:Informational, 7:Debug]
log-level: 7
log-output: /opt/soar/soar.log
# 优化建议输出格式
report-type: markdown
ignore-rules:
- ""
# 黑名单中的 SQL 将不会给评审意见。一行一条 SQL,可以是正则也可以是指纹,填写指纹时注意问号需要加反斜线转义。
blacklist: /opt/soar/soar.blacklist
# 启发式算法相关配置
max-join-table-count: 5
max-group-by-cols-count: 5
max-distinct-count: 5
max-index-cols-count: 5
max-total-rows: 9999999
spaghetti-query-length: 2048
allow-drop-index: false
# EXPLAIN相关配置
explain-sql-report-type: pretty
explain-type: extended
explain-format: traditional
explain-warn-select-type:
- ""
explain-warn-access-type:
- ALL
explain-max-keys: 3
explain-min-keys: 0
explain-max-rows: 10000
explain-warn-extra:
- ""
explain-max-filtered: 100
explain-warn-scalability:
- O(n)
query: ""
list-heuristic-rules: false
list-test-sqls: false
verbose: true

6. Installation Verification

echo 'select * from film' | ./soar

7. Expansion-web interface display. And part of the SQL optimization display can be performed (can be ignored)

https://github.com/xiyangxixian/soar-web

 

 

Guess you like

Origin blog.csdn.net/javanbme/article/details/112620976
Recommended