goInception二进制文件安装部署

#下载二进制包(根据需求下载对应版本)

wget https://github.com/hanchuanchuan/goInception/releases/download/v1.3.0/goInception-linux-v1.3.0-1-g140054c.tar.gz

#解压包

tar -xvf goInception-linux-v1.3.0-1-g140054c.tar.gz

#启动

./goInception -config=config/config.toml

[root@hadoop02 goInception]# netstat -tunlp|grep 4000

tcp6 2 0 :::4000 :::* LISTEN 2137/./goInception

[root@hadoop02 goInception]# kill -9 2137

[root@hadoop02 goInception]# ./goInception -config=config/config.toml &

mysql -h127.0.0.1 -P4000

inception show variables;

审核规则修改

审核规则有很多,大家可以参考官方文档。此处说明如何修改审核规则:

1、登录goinception审核server

mysql -h127.0.0.1 -P400

2、查看参数

inception show levels;# 筛选指定审核名称inception show levels like '%blob%';# 筛选指定级别inception show levels where value=2;# 筛选指定关键字inception show levels where `desc` like '%index%';

3、设置审核级别

inception set level er_no_where_condition = 2;

4、修改参数

inception set check_dml_where = 1;

调用示例

goInception延用inception的使用方式,在审核的sql开始前添加注释来指定远端服务器,并在sql的前后添加特殊标识以区分待审核语句,示例如下:

/*--user=root;--password=root;--host=127.0.0.1;--check=1;--port=3306;*/inception_magic_start;use test;create table t1(id int primary key);inception_magic_commit;

测试案例

1、python测试脚本

#!/usr/bin/env python3# -*- coding:utf-8 -*-import pymysqlimport prettytable as pttb = pt.PrettyTable()#修改为自己线上服务器连接信息sql = '''/*--user=root;--password=xxx;--host=xxx;--check=0;--port=3306;--execute=1;--backup=1;*/inception_magic_start;use testdb; create table t1(id int primary key,c1 int);insert into t1(id,c1)values(1,1);inception_magic_commit;'''conn = pymysql.connect(host='127.0.0.1', user='', passwd='',                       db='', port=4000, charset="utf8mb4")cur = conn.cursor()ret = cur.execute(sql)result = cur.fetchall()cur.close()conn.close()tb.field_names = [i[0] for i in cur.description]for row in result:    tb.add_row(row)print(tb)

2、执行结果

3、线上库结果

4、备份库结果

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值