Awesome! I recommend a MySQL automated operation and maintenance tool!

Awesome! I recommend a MySQL automated operation and maintenance tool!

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

Click on "Migrant Workers Technical Road" above, select "Set as Star" and
reply "1024" to get exclusive learning materials!

Before that, the migrant worker also introduced an open source SQL management tool: automatic completion, rollback! Introduce a visual SQL diagnostic tool.
Today, the migrant worker recommends another SQL audit tool: goinception.

Introduction to goinception

goInception is a MySQL operation and maintenance tool that integrates auditing, executing, backing up and generating rollback statements. Through the grammatical analysis of executed SQL, it returns audit results based on custom rules, and provides execution and backup and generating rollback statements. Features.

github address: https://github.com/hanchuanchuan/goInception

Document: https://hanchuanchuan.github.io/goInception/

goinception architecture

Awesome!  I recommend a MySQL automated operation and maintenance tool!

goinception installation

The official provides several installation methods, as follows.

  • 1. Source code installation
    Source code installation requires an environment of go V1.2 or higher, and use go mod for dependency management.
[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
  • 2. docker way

[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

After decompression is complete, you will see a default configuration file in the config directory: config.toml.default, you can modify it according to the actual situation.

goInception uses TiDB source code reconstruction, so some parameters can refer to TiDB related documents

The config.toml file consists of several parts, which are the outermost configuration such as host, port, etc., and each group such as [inc], [log], etc. Example (This example only shows the structure of the config.toml file, please refer to the detailed parameters): 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

After the configuration modification is completed, it can be started normally.


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

Use case

/*--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;

Other introduction

1. Result information

There are two types of information returned to users,

  • One is that there are errors in the basic information submitted to goInception, such as incomplete source information or errors in source information. In this case, directly report exceptions, including error codes and error messages, which are the same as those of the MySQL server. It can be handled normally outside.
  • Second, if there is no such problem, the client will be informed of the check result in the form of a result set. Consistent with mysql native result set. In the returned result set, each row of data is a submitted SQL statement. GoInception internally disassembles all submitted statement blocks one by one and returns them in the form of a result set. For each statement, what is the problem or status? The results are clear at a glance.
    Note: If there is a grammatical error in the statement, you cannot continue because goInception can no longer separate the remaining statements. At this time, the multiple rows that have been checked normally before are returned with multiple result sets. The error statement is One line is returned, of course the error message is a syntax error.

2. Comes with backup function

With its own backup function, first configure config.toml when the service starts (placed in the [inc] section)

参数  默认
可选范围
说明

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

3. Audit rules

For detailed information on related audit rules and audit options, please refer to: https://hanchuanchuan.github.io/goInception/rules.html

Compare Inception

1. Function comparison

Awesome!  I recommend a MySQL automated operation and maintenance tool!

2. Speed
Awesome!  I recommend a MySQL automated operation and maintenance tool!

3. Use

Awesome!  I recommend a MySQL automated operation and maintenance tool!
This type of tool frees the hands of the DBA to a certain extent, and can also avoid errors to a large extent, thereby ensuring the correct rate of SQL execution. At the same time, it also provides the SQL rollback function to roll back in the event of an error. Data security and integrity.
Awesome!  I recommend a MySQL automated operation and maintenance tool!
Awesome!  I recommend a MySQL automated operation and maintenance tool!
Awesome!  I recommend a MySQL automated operation and maintenance tool!
Awesome!  I recommend a MySQL automated operation and maintenance tool!

Recommended reading Click the title to jump to the
bug! Redis 6.0.8 is released urgently, please upgrade as soon as possible!
Early adopters on Huawei Hongmeng OS, my first "hello world" is the
most complete Linux/C/C++ learning mind map, please collect it!
Just one step, permanent prostitute! Please use it low-key!
Docker Container Network-Fundamentals
Why is HTTPS secure?
Can SSH only be used on remote Linux hosts? That means you are too young!
Awesome!  I recommend a MySQL automated operation and maintenance tool!

Included in the topic #MySQL from entry to give up
26
Ge

Guess you like

Origin blog.51cto.com/mingongge/2554293