超赞!墙裂推荐一个 MySQL 自动化运维工具!

时间:2020-11-30 15:46:45   收藏:0   阅读:9
超赞!墙裂推荐一个 MySQL 自动化运维工具!
收录于话题
#MySQL从入门到放弃
26个

点击上方“民工哥技术之路”,选择“设为星标”
回复“1024”获取独家整理的学习资料!

在这之前,民工哥也给大家介绍过一款开源的SQL管理工具:自动补全、回滚!介绍一款可视化 sql 诊断利器。
今天,民工哥再给大家推荐一款SQL审核利器:goinception。

goinception介绍

goInception是一个集审核、执行、备份及生成回滚语句于一身的MySQL运维工具, 通过对执行SQL的语法解析,返回基于自定义规则的审核结果,并提供执行和备份及生成回滚语句的功能。

github地址:https://github.com/hanchuanchuan/goInception

文档:https://hanchuanchuan.github.io/goInception/

goinception架构

技术图片

goinception安装

官方提供了几种的安装方式,如下。

[root@centos7 ~]# git clone https://github.com/hanchuanchuan/goInception.git
[root@centos7 ~]# cd goInception
[root@centos7 ~]# make parser
[root@centos7 ~]# go build -o goInception tidb-server/main.go

[root@centos7 ~]# docker pull hanchuanchuan/goinception
[root@centos7 ~]# mkdir goinception
[root@centos7 ~]# tar zxf goInception-linux-amd64-v1.2.3.tar.gz -C ./goinception/
[root@centos7 ~]# cd goinception/
[root@centos7 goinception]# ll
total 38476
drwxr-xr-x 2 root root        33 Aug 30 03:48 config
-rwxr-xr-x 1  501 games 39399424 May 22 07:45 goInception

解压完成后,在config目录下会看到一个默认的配置文件:config.toml.default,大家可以根据实际情况修改。

goInception采用TiDB源码重构,所以部分参数可参考TiDB相关文档

config.toml文件由几部分组成,分别为最外层配置如host,port等,以及各分组如[inc],[log]等。示例(该示例仅为展示config.toml文件结构,详细参数请参考):https://github.com/hanchuanchuan/goInception/blob/master/config/config.toml.default


host = "0.0.0.0"
port = 4000
path = "/tmp/tidb"

[log]
# 日志参数
level = "info"
format = "text"

[log.file]
# 日志文件参数
filename = ""
max-size = 300

[inc]
# 审核选项
enable_nullable = true
enable_drop_table = false
check_table_comment = false
check_column_comment = false
# 等等...

[osc]
# pt-osc参数
osc_on = false
osc_min_table_size = 16

[ghost]
# gh-ost参数
ghost_allow_on_master = true

配置修改完成后,就可以正常启动了。


[root@centos7 goinception]# ./goInception -config=config/config.toml
[root@centos7 ~]# netstat -lntp|grep 4000
tcp6   0   0 :::4000    :::*    LISTEN    1250/./goInception 

使用实例

/*--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、结果信息

给用户返回的信息有两种,

2、自带备份功能

自带备份功能,首先服务启动时配置config.toml(放在 [inc] 段)

参数  默认
可选范围
说明

backup_host ""  string  备份数据库IP地址
backup_port 0   int 备份数据库端口
backup_user ""  string  备份数据库用户名
backup_password ""  string  备份数据库密码
并且在执行sql时,添加 --backup=true 或 --backup=1 选项。

3、审核规则

相关的审核规则,审核选项等详细信息,可以参考:https://hanchuanchuan.github.io/goInception/rules.html

对比Inception

1、功能对比

技术图片

2、速度
技术图片

3、使用

技术图片
这类工具在一定程度上解放了DBA的双手,而且还能在很大程度上避免出错的情况,从而保证SQL的执行正确率,同时还提供SQL回滚功能,在出错时进行回滚,保证数据安全与完整性。
技术图片
技术图片
技术图片
技术图片

推荐阅读 点击标题可跳转
Bug!Redis 6.0.8紧急发布,请尽快升级!
在华为鸿蒙OS上尝鲜,我的第一个“hello world”
最全Linux/C/C++学习思维导图,请收藏!
只需一步,永久白嫖!请低调使用!
Docker容器网络-基础篇
为什么 HTTPS 是安全的?
SSH 只能用于远程 Linux 主机?那说明你见识太小了!
技术图片

收录于话题 #MySQL从入门到放弃
26

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!