本文将为您提供关于sql审核工具调研安装-sqlAdvisor和soar的详细介绍,我们还将为您解释sql审核平台是干什么的的相关知识,同时,我们还将为您提供关于1024开源首发|SQL审核工具SQL
本文将为您提供关于sql 审核工具调研安装 - sqlAdvisor 和 soar的详细介绍,我们还将为您解释sql审核平台是干什么的的相关知识,同时,我们还将为您提供关于1024 开源首发 | SQL 审核工具 SQLE、Advised,Advisor,Advice,Pointcut、centos 7 安装sql 审核工具 inception + archer、Centos7安装美团SQL优化工具SQLAdvisor的实用信息。
本文目录一览:- sql 审核工具调研安装 - sqlAdvisor 和 soar(sql审核平台是干什么的)
- 1024 开源首发 | SQL 审核工具 SQLE
- Advised,Advisor,Advice,Pointcut
- centos 7 安装sql 审核工具 inception + archer
- Centos7安装美团SQL优化工具SQLAdvisor
sql 审核工具调研安装 - sqlAdvisor 和 soar(sql审核平台是干什么的)
sql 审核工具调研
https://github.com/beiketianzhuang/data-platform-soar
1. 美团工具 sqlAdvisor 工具
采用 docker 去跑 centos 镜像
1. 获取 centos 镜像
docker pull centos
2. 运行 docker 镜像
docker run <IMAGE ID >
3. 进入 docker 容器
docker attach <容器id>
进入容器后就可以通过官方提供的安装方法安装了 (因为直接通过官方的安装出错了,所以后面安装时自己做了一些调整)
4. 克隆代码
cd /usr/local/src/
git clone https://github.com/Meituan-Dianping/SQLAdvisor.git
5. 安装依赖包
yum install -y make cmake libaio-devel libffi-devel glib2
glib2-devel bison gcc gcc-c++
6. 编译 sqladvisor 时依赖 perconaserverclient_r
cd /usr/lib64/
ln -s libperconaserverclient_r.so.18 libperconaserverclient_r.so
7. 安装 percona56 yum 源及安装:
#注意:若不带wget,请先安装
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
8. 编译 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
9. 编译 sqladvisor
cd ./sqladvisor/
cmake -DCMAKE_BUILD_TYPE=debug ./
make
10. 测试
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
2. 小米工具 soar
小米的soar安装简单方便,唯一注意的地方是:当时我安装的go的版本是1.9,导致编译的时候报错,后来改为了1.10的版本
具体请参考:https://github.com/XiaoMi/soar/blob/master/doc/install.md
1024 开源首发 | SQL 审核工具 SQLE
在 2017 、2018 年和 2019 年的 10 月 24 日,爱可生开源社区出品了 MySQL 分布式中间件 DBLE 、数据复制产品 DTLE 和全局事务框架 TXLE 。时隔两年,这三款产品在社区积累了更多的设计经验和用户反馈,有更多的企业和用户在生产环境中使用它们,实现了产品的快速迭代。
此次开源的 SQLE ,它是一款面向数据库使用者和管理者的 SQL 审核工具,旨在规范 SQL 审核上线流程,提高 SQL 质量。社区保持每年开源一款产品的传统,为丰富 MySQL 开源生态添砖加瓦。
SQLE 支持多场景审核,支持标准化上线流程,原生支持 MySQL 审核且数据库类型可扩展的 SQL 审核工具。
主要功能
平台管理
- 支持用户和角色管理;
- 支持配置上线数据库;
- 支持基于角色的资源隔离;
- 支持配置审核规则模板;
- 支持对不同的数据库应用不同的规则模板。
SQL 审核
- 支持工单审批流程,支持工单隔离;
- 支持邮件推送审批事件;
- 支持 SQL 上线;
- 支持生成回滚语句;
- 支持审核 MyBatis XML 文件;
- 支持审核建议按 SQL 归类去重展示;
- 支持审核报告下载。
SQL 审核计划
- 支持通过标准接口收集来自业务的 SQL 统计信息;
- 提供 MyBatis 文件扫描上传程序(scanner),可集成CI/CD;
- 支持静态审核,即脱离上线数据库审核;
- 支持定时审核,既有 SQL 进行生成审核报告。
企业版功能
- 支持审核白名单;
- 支持审批流程可视化配置;
- 支持 MySQL 慢日志采集进行 SQL 审核。
特性一览
自动化审核
- 支持多SQL同工单关联审核
- 支持审核 MyBatis 文件
- 完备的SQL规范与规则库,解决SQL规范难题
- 自定义SQL规则模板,解决不同业务规则不统一问题
- 支持白名单,解决利旧特例SQL的审核难题
标准化上线流程
- SQL审核流程按需自定义,满足企业内部不同流程管理要求
- 支持多级审批,支持快速上线
多场景审核
- 支持事前事后审核,覆盖开发、测试、上线、生产等环节
开放接口
- 标准HTTP API接口可与客户内部流程系统对接
多数据库支持
- 支持通过插件的形式扩展可审核上线的数据库类型,无需升级软件,导入审核插件即可获对应数据库类型的审核上线能力,使用平台所有功能。
支持服务
- 专业的传输组件专家队伍
- 活跃的开源社区交流氛围
- 7×24 小时的护航团队支持
- 稳定的研发测试团队保障
- 提供企业级的管家式服务支持
使用场景
规范上线流程:
多场景审核:
项目地址:
https://github.com/actiontech/sqle
文档地址:
https://actiontech.github.io/sqle-docs-cn/
QQ群:
SQLE 官方QQ社区交流群:637150065
开源福利活动:
即日起至 2021年11月24日,用户试用 SQLE ;
在有效活动时间内提交使用感受或对产品的建议;社区将以内容的优质、可用性等为标准,挑选出5位用户,赠与丰富奖品,剩余的参与者也将获赠精美的周边。
活动时间: 即日起至 2021年11月24日
活动规则:
- 试用用户需要在11月24日 23:59:59 前提交使用感受或对产品的建议;
- 11月25日,将在【SQLE官方QQ群:637150065】公布获奖结果,大家务必先加群;
- 选中的5位用户奖品为500元京东卡一张,其余用户也可获赠精美周边一份;
本活动最终解释权归爱可生开源社区所有
Advised,Advisor,Advice,Pointcut
Advised->在Spring中创建了AOP代理之后,就能够使用org.springframework.aop.framework.Advised
接口对它们进行管理。 任何AOP代理都能够被转型为这个接口,不论它实现了哪些其它接口
Advisor->类似使用Aspect的@Aspect注解的类
Advice->@Before、@After、@AfterReturning、@AfterThrowing、@Around
Pointcut->@Pointcut
package com.enjoy.cap10.aop; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.AfterThrowing; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; //日志切面类 @Aspect public class LogAspects { @Pointcut("execution(public int com.enjoy.cap10.aop.Calculator.*(..))") public void pointCut(){}; //@before代表在目标方法执行前切入, 并指定在哪个方法前切入 @Before("pointCut()") public void logStart(JoinPoint point){ System.out.println("除法运行....参数列表是:{}"); } @After("pointCut()") public void logEnd(){ System.out.println("除法结束......"); } @AfterReturning("pointCut()") public void logReturn(){ System.out.println("除法正常返回......运行结果是:{}"); } @AfterThrowing("pointCut()") public void logException(){ System.out.println("运行异常......异常信息是:{}"); } @Around("pointCut()") public Object Around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{ System.out.println("@Arount:执行目标方法之前..."); Object obj = proceedingJoinPoint.proceed();//相当于开始调div地 System.out.println("@Arount:执行目标方法之后..."); return obj; } }
centos 7 安装sql 审核工具 inception + archer
系统环境: Centos7 + python2.7 + python3 ....
下载
源码地址:https://github.com/mysql-inception/inception
Inception安装
1、安装相关依赖包
yum install bison ncurses-libs libncurses5-dev ncurses-devel wget
git cmake openssl gcc-c++ -y
注意:centos7 系统自带的bison的版本过高,在后面测试的时候会报错!
下载地址: wget http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz
2、安装inception
git clone https://github.com/mysql-inception/inception
cd inception
sh inception_build.sh debug
debug就是编译目录,编译后所有的生成文件都在这个目录下面,包括可执行文件Inception。可执行文件在debug/sql目录下面:
[root@mysql sql]# pwd
/root/inception/debug/sql
[root@mysql sql]# ls
CMakeFiles dummy.bak Inception libbinlog.a librpl.a libsql.a Makefile sql_builtin.cc sql_yacc.h
cmake_install.cmake gen_lex_hash lex_hash.h libmaster.a libslave.a libsqlgunitlib.a share sql_yacc.cc
[root@mysql3 sql]#
3、创建配置目录,将可执行文件Inception拷贝到/opt/inception/bin目录
[root@mysql sql]# mkdir -p /data/inception
[root@mysql sql]# mkdir -p /data/inception/bin
[root@mysql sql]# mkdir -p /data/inception/temp
[root@mysql sql]# cp Inception /data/inception/bin/
编辑配置文件:
[root@mysql sql]# cat /etc/inc.cnf
[inception]
general_log=1
general_log_file=/opt/inception/inception.log
port=6669
socket=/opt/inception/inc.socket
character-set-client-handshake=0
character-set-server=utf8
inception_remote_system_password=123456
inception_remote_system_user=root
inception_remote_backup_port=3306
inception_remote_backup_host=127.0.0.1
inception_support_charset=utf8mb4
inception_enable_nullable=0
inception_check_primary_key=1
inception_check_column_comment=1
inception_check_table_comment=1
inception_osc_min_table_size=1
inception_osc_bin_dir=/opt/inception/temp
inception_osc_chunk_time=0.1
inception_ddl_support=1
inception_enable_blob_type=1
inception_check_column_default_value=1
启动
[root@mysql sql]# nohup /data/inception/bin/Inception --defaults-file=/etc/inc.cnf &
[1] 2398
[root@mysql sql]# nohup: ignoring input and appending output to `nohup.out''
[root@mysql sql]# ps -ef|grep Inception
root 2414 23520 0 23:15 pts/0 00:00:00 /opt/inception/bin/Inception --defaults-file=/etc/inc.cnf
root 2419 23520 0 23:22 pts/0 00:00:00 grep Inception
登录验证
[root@mysql sql]# mysql -uroot -h127.0.0.1 -P6669
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: Inception2.1.50 1
Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the current input statement.
mysql> inception get variables;
+------------------------------------------+-------------------------------------------------+
| Variable_name | Value |
+------------------------------------------+-------------------------------------------------+
| autocommit | OFF |
| bind_address | * |
| character_set_system | utf8 |
| character_sets_dir | /src/inception-master/debug/sql/share/charsets/ |
| connect_timeout | 10 |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| general_log | ON |
| general_log_file | /opt/inception/inception.log |
| inception_check_autoincrement_datatype | ON |
| inception_check_autoincrement_init_value | ON |
| inception_check_autoincrement_name | ON |
| inception_check_column_comment | ON |
| inception_check_column_default_value | ON |
| inception_check_dml_limit | ON |
| inception_check_dml_orderby | ON |
| inception_check_dml_where | ON |
| inception_check_identifier | ON |
| inception_check_index_prefix | ON |
| inception_check_insert_field | ON |
| inception_check_primary_key | ON |
| inception_check_table_comment | ON |
| inception_check_timestamp_default | ON |
| inception_ddl_support | ON |
| inception_enable_autoincrement_unsigned | ON |
| inception_enable_blob_type | ON |
| inception_enable_column_charset | OFF |
| inception_enable_enum_set_bit | OFF |
| inception_enable_foreign_key | OFF |
| inception_enable_identifer_keyword | OFF |
| inception_enable_not_innodb | OFF |
| inception_enable_nullable | OFF |
| inception_enable_orderby_rand | OFF |
| inception_enable_partition_table | OFF |
| inception_enable_pk_columns_only_int | OFF |
| inception_enable_select_star | OFF |
| inception_enable_sql_statistic | ON |
| inception_max_char_length | 16 |
| inception_max_key_parts | 5 |
| inception_max_keys | 16 |
| inception_max_primary_key_parts | 5 |
| inception_max_update_rows | 10000 |
| inception_merge_alter_table | ON |
| inception_osc_alter_foreign_keys_method | none |
| inception_osc_bin_dir | /opt/inception/temp |
| inception_osc_check_alter | ON |
| inception_osc_check_interval | 5.000000 |
| inception_osc_check_replication_filters | ON |
| inception_osc_chunk_size | 1000 |
| inception_osc_chunk_size_limit | 4.000000 |
| inception_osc_chunk_time | 0.100000 |
| inception_osc_critical_thread_connected | 1000 |
| inception_osc_critical_thread_running | 80 |
| inception_osc_drop_new_table | ON |
| inception_osc_drop_old_table | ON |
| inception_osc_max_lag | 3.000000 |
| inception_osc_max_thread_connected | 1000 |
| inception_osc_max_thread_running | 80 |
| inception_osc_min_table_size | 1 |
| inception_osc_on | ON |
| inception_osc_print_none | ON |
| inception_osc_print_sql | ON |
| inception_osc_recursion_method | processlist |
| inception_password | |
| inception_read_only | OFF |
| inception_remote_backup_host | 127.0.0.1 |
| inception_remote_backup_port | 3306 |
| inception_remote_system_password | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| inception_remote_system_user | root |
| inception_support_charset | utf8mb4 |
| inception_user | |
| interactive_timeout | 28800 |
| max_allowed_packet | 1073741824 |
| max_connect_errors | 100 |
| max_connections | 151 |
| net_buffer_length | 16384 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| port | 6669 |
| query_alloc_block_size | 8192 |
| query_prealloc_size | 8192 |
| socket | /opt/inception/inc.socket |
| thread_handling | one-thread-per-connection |
| thread_stack | 262144 |
| time_format | %H:%i:%s |
| version | Inception2.1.50 |
| version_comment | Source distribution |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
| wait_timeout | 28800 |
+------------------------------------------+-------------------------------------------------+
rows in set (0.00 sec)
mysql> exit
Bye
[root@mysql sql]#
可以看到所有的变量,安装成功!
使用Inception
DDL审核
[root@mysql ~]# cat inception.py
#!/usr/bin/python
#-\*-coding: utf-8-\*-
import pymysql
sql=''/*--user=testdev;--password=testdev;--host=127.0.0.1;--execute=1;--port=3306;*/\
inception_magic_start;\
use testdb;\
CREATE TABLE adaptive_office(id int);\
inception_magic_commit;''
try:
conn=pymysql.connect(host=''127.0.0.1'',user=''root'',password=''123456'',db='''',port=6669)
cur=conn.cursor()
ret=cur.execute(sql)
result=cur.fetchall()
num_fields = len(cur.description)
field_names = [i[0] for i in cur.description]
print field_names
for row in result:
print row[0], "|",row[1],"|",row[2],"|",row[3],"|",row[4],"|",
row[5],"|",row[6],"|",row[7],"|",row[8],"|",row[9],"|",row[10]
cur.close()
conn.close()
except pymysql.Error,e:
print "Mysql Error %d: %s" % (e.args[0], e.args[1])
[root@mysql ~]#
运行结果:
[root@mysql ~]# python inception.py
[u''ID'', u''stage'', u''errlevel'', u''stagestatus'', u''errormessage'', u''SQL'', u''Affected_rows'', u''sequence'', u''backup_dbname'', u''execute_time'', u''sqlsha1'']
| CHECKED | 0 | Audit completed | None | 2 | CHECKED | 1 | Audit completed | Set engine to innodb for table ''adaptive_office''.
Set charset to one of ''utf8mb4'' for table ''adaptive_office''.
Set comments for table ''adaptive_office''.
Column ''id'' in table ''adaptive_office'' have no comments.
Column ''id'' in table ''adaptive_office'' is not allowed to been nullable.
Set Default value for column ''id'' in table ''adaptive_office''
Set a primary key for table ''adaptive_office''. |
常见错误及解决
[root@mysql ~]# python inception.py
Traceback (most recent call last):
File "inception.py", line 10, in <module>
conn=pymysql.connect(host=''192.168.1.123'',user=''root'',password=''123456'',db='''',port=6669)
File "/usr/local/lib/python2.7/site-packages/pymysql/__init__.py", line 88, in Connect
return Connection(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/pymysql/connections.py", line 679, in __init__
self.connect()
File "/usr/local/lib/python2.7/site-packages/pymysql/connections.py", line 891, in connect
self._request_authentication()
File "/usr/local/lib/python2.7/site-packages/pymysql/connections.py", line 1054, in _request_authentication
if int(self.server_version.split(''.'', 1)[0]) >= 5:
ValueError: invalid literal for int() with base 10: ''Inception2''
解决办法:
[root@mysql ~]# vi /usr/local/lib/python2.7/site-packages/pymysql/connections.py
... ...
def _request_authentication(self):
# https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse
self.server_version = ''5.6.24-72.2-log'' #添加此行
if int(self.server_version.split(''.'', 1)[0]) >= 5:
... ...
使用中的其他错误见:
https://riverdba.github.io/2017/04/13/inception-install/#
命令行不是很友好,追求web界面的请继续,接下来安装archer
我的安装环境:
python3 + mysql5.7 + django1.8
安装python3
wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz
tar -zxvf Python-3.4.1.tgz
cd Python-3.4.1
./configure && make && make install
安装setuptools
[root@mysql ~]# wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
[root@mysql ~]# tar -zxvf setuptools-19.6.tar.gz
[root@mysql ~]# cd setuptools-19.6
[root@mysql setuptools-19.6]# python3 setup.py build
[root@mysql setuptools-19.6]# python3 setup.py install
... ...
creating ''dist/setuptools-19.6-py3.4.egg'' and adding ''build/bdist.linux-x86_64/egg'' to it
removing ''build/bdist.linux-x86_64/egg'' (and everything under it)
Processing setuptools-19.6-py3.4.egg
Copying setuptools-19.6-py3.4.egg to /opt/python3/lib/python3.4/site-packages
Adding setuptools 19.6 to easy-install.pth file
Installing easy_install script to /opt/python3/bin
Installing easy_install-3.4 script to /opt/python3/bin
Installed /opt/python3/lib/python3.4/site-packages/setuptools-19.6-py3.4.egg
Processing dependencies for setuptools==19.6
Finished processing dependencies for setuptools==19.6
安装pip
[root@mysql ~]# wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
[root@mysql ~]# tar -zxvf pip-8.0.2.tar.gz
[root@mysql ~]# cd pip-8.0.2
[root@mysql pip-8.0.2]# python3 setup.py build
[root@mysql pip-8.0.2]# python3 setup.py install
... ...
creating ''dist/pip-8.0.2-py3.4.egg'' and adding ''build/bdist.linux-x86_64/egg'' to it
removing ''build/bdist.linux-x86_64/egg'' (and everything under it)
Processing pip-8.0.2-py3.4.egg
creating /opt/python3/lib/python3.4/site-packages/pip-8.0.2-py3.4.egg
Extracting pip-8.0.2-py3.4.egg to /opt/python3/lib/python3.4/site-packages
Adding pip 8.0.2 to easy-install.pth file
Installing pip3 script to /opt/python3/bin
Installing pip3.4 script to /opt/python3/bin
Installing pip script to /opt/python3/bin
Installed /opt/python3/lib/python3.4/site-packages/pip-8.0.2-py3.4.egg
Processing dependencies for pip==8.0.2
Finished processing dependencies for pip==8.0.2
安装Django
使用pip3安装:pip3 install Django==1.8.17
安装Crypto和pymysql
[root@mysql3 ~]# pip3 install Crypto
[root@mysql3 ~]# pip3 install pycrypto
[root@mysql3 ~]# pip3 install pymysql
[root@mysql3 ~]# vi /opt/python3/lib/python3.4/site-packages/pymysql/connections.py
在if int(self.server_version.split(‘.’, 1)[0]) >= 5: 这一行之前加上以下这一句并保存,记得别用tab键用4个空格缩进:
self.server_version = ''5.6.24-72.2-log''
修改后如下图:
配置archer
1、下载archer
[root@mysql ~]# mkdir -p /data/
[root@mysql ~]# cd /data
[root@mysql data]# git clone https://github.com/jly8866/archer.git
[root@mysql data]# ls archer/*
archer debug.sh docs manage.py README.md requirements.txt screenshots sql startup.sh stop.sh
2、创建archer DB和inception DB
root@(none) 04:04:54>create database archer;
Query OK, 1 row affected (0.00 sec)
root@(none) 04:05:12>grant all on archer.* to archer_rw@''%'' identified by ''archer_rw'';
Query OK, 0 rows affected (0.03 sec)
root@(none) 04:06:42>flush privileges;
Query OK, 0 rows affected (0.02 sec)
root@(none) 04:13:39>create database inception_db;
Query OK, 1 row affected (0.00 sec)
root@(none) 04:13:46>grant all on inception_db.* to incep_rw@''%'' identified by ''incep_rw'';
Query OK, 0 rows affected (0.00 sec)
root@(none) 04:14:23>flush privileges;
Query OK, 0 rows affected (0.00 sec)
3、修改/data/archer/settings.py,如下内容:
#该项目本身的mysql数据库地址
DATABASES = {
''default'': {
''ENGINE'': ''django.db.backends.mysql'',
''NAME'': ''archer'',
''USER'': ''archer_rw'',
''PASSWORD'': ''archer_rw'',
''HOST'': ''127.0.0.1'',
''PORT'': ''3306''
}
}
#inception组件所在的地址
INCEPTION_HOST = ''127.0.0.1''
INCEPTION_PORT = ''6669''
#查看回滚SQL时候会用到,这里要告诉archer去哪个mysql里读取inception备份的回滚信息和SQL.
#注意这里要和inception组件的inception.conf里的inception_remote_XX部分保持一致.
INCEPTION_REMOTE_BACKUP_HOST=''127.0.0.1''
INCEPTION_REMOTE_BACKUP_PORT=3306
INCEPTION_REMOTE_BACKUP_USER=''incep_rw''
INCEPTION_REMOTE_BACKUP_PASSWORD=''incep_rw''
4、通过model创建archer本身的数据库表
[root@mysql]# cd /data/archer
[root@mysql archer]# python3 manage.py makemigrations
No changes detected
[root@mysql archer]# python3 manage.py makemigrations sql
Migrations for ''sql'':
0001_initial.py:
- Create model users
- Create model master_config
- Create model workflow
[root@mysql archer]# python3 manage.py migrate
Operations to perform:
Synchronize unmigrated apps: messages, staticfiles
Apply all migrations: sessions, auth, contenttypes, sql, admin
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
Rendering model states... DONE
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying sql.0001_initial... OK
Applying admin.0001_initial... OK
Applying sessions.0001_initial... OK
查看表是否创建成功:
[root@mysql archer]# mysql -uarcher_rw -parcher_rw -h127.0.0.1 -P3306 -Darcher -e "show tables;"
Warning: Using a password on the command line interface can be insecure.
+----------------------------+
| Tables_in_archer |
+----------------------------+
| auth_group |
| auth_group_permissions |
| auth_permission |
| django_admin_log |
| django_content_type |
| django_migrations |
| django_session |
| sql_master_config |
| sql_users |
| sql_users_groups |
| sql_users_user_permissions |
| sql_workflow |
+----------------------------+
5、创建django admin管理员
[root@mysql archer]# python3 manage.py createsuperuser
Username: admin
Email address: admin@foxmail.com
Password: admin
Password (again): admin
Superuser created successfully.
该用户可以登录django admin来管理model。
启动acher
[root@mysql archer]# vi debug.sh
#!/bin/bash
python3 manage.py runserver 0.0.0.0:9123
[root@mysql3 archer]# sh debug.sh
Performing system checks...
System check identified no issues (0 silenced).
April 15, 2017 - 16:39:11
Django version 1.8.17, using settings ''archer.settings''
Starting development server at http://0.0.0.0:9123/
Quit the server with CONTROL-C.
注意:
1.如果有RuntimeError: Compression requires the (missing) zlib module 报错
解决办法:
yum install zlib -y
yum install zlib-devel -y
安装完成后,重新编译 python3 make && make install 就ok!!
2.如果有AttributeError: ''module'' object has no attribute ''HTTPSConnection'' 报错
解决办法:
yum -y install openssl openssl-devel
安装完成后,重新编译 python3 make && make install 就ok!!
剩下的就是web界面配置
链接:https://riverdba.github.io/2017/04/15/archer-install/
如果有什么安装问题,可以加我qq:1305464670 一起学习,一起进步!
Centos7安装美团SQL优化工具SQLAdvisor
1 下载源码
git clone https://github.com/Meituan-Dianping/SQLAdvisor.git
2 安装依赖环境
yum install cmake libaio-devel libffi-devel glib2 glib2-devel bison gcc gcc-c++
yum install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm
yum install -y Percona-Server-shared-56
3 依赖libperconaserverclient_r
cd /usr/lib64/
ln -s libperconaserverclient_r.so.18 libperconaserverclient_r.so
4 编译源码sqladvisor的依赖
cd SQLAdvisor/
cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./
make && make install
5 编译sqladvisor
cd SQLAdvisor/sqladvisor/
cmake -DCMAKE_BUILD_TYPE=debug ./
make
6 测试安装效果
./sqladvisor --help
使用说明详见GitHub地址
https://github.com/Meituan-Dianping/SQLAdvisor
今天关于sql 审核工具调研安装 - sqlAdvisor 和 soar和sql审核平台是干什么的的分享就到这里,希望大家有所收获,若想了解更多关于1024 开源首发 | SQL 审核工具 SQLE、Advised,Advisor,Advice,Pointcut、centos 7 安装sql 审核工具 inception + archer、Centos7安装美团SQL优化工具SQLAdvisor等相关知识,可以在本站进行查询。
本文标签: