Automatic completion and rollback! Introduce a visual sql diagnostic tool

About Yearning

=================

Yearning MYSQL is a SQL statement review platform. Provide multiple functions such as query auditing and SQL auditing, and support Mysql, which can solve the link between operation and maintenance and development to a certain extent, with rich functions, open source code, easy installation and deployment!

Project address: https: //gitee.com/cookieYe/Ye ...

note:

Yearning 1.x version requires inception to provide SQL audit and rollback functions.

Starting from Yearning 2.0, no need to rely on Inception, has already implemented SQL audit / rollback function by itself

Yearning function introduction

================

  • SQL query
  • Query Work Order
  • Export
  • Automatic completion, intelligent prompt
  • Query statement audit
  • SQL audit
  • Process Chemical List
  • SQL statement detection and execution
  • SQL rollback
  • Historical audit record
  • Push
  • E-mail work order push
  • Dingding Webhook Robot Work Order Push
  • User rights and management
  • Role division
  • User-based fine-grained permissions
  • registered
  • other
  • todoList
  • LDAP login
  • Dynamic audit rule configuration
  • AutoTask automatic execution

Yearning installation

Yearning does not rely on any third-party SQL audit tool as an audit engine, and has internally implemented audit / rollback related logic.

  • Rely only on the Mysql database. The mysql version must be 5.7 or above. The character set for creating the Yearning library should be UTF8mb4 (only the MySQL version required for Yearning)
  • The Yearning log only outputs the error level. If there is no log, it can be regarded as no operation error!
  • Yearning is developed based on 1080p resolution and only supports 1080p and above display access

Yearning download

Yearning-go official binary download package, download address  HTTPS: //github.com/cookieY/Ye ... . Select the software package you need to download to download.

Source code installation: You need to install some dependencies first, some related installation steps are as follows:

[root@test ~]# git clone https://github.com/cookieY/Yearning.git [root@test ~]# mv Yearning /usr/local/yearning [root@test ~]# cd /usr/local/yearning/ [root@test yearning]# cd install/ [root@test install]# ll total 26728 -rw-r--r-- 1 root root 57763 Apr 23 16:06 connections.py -rw-r--r-- 1 root root 16818 Apr 23 16:06 cursors.py -rw-r--r-- 1 root root 679 Apr 23 16:06 docker_start.sh -rw-r--r-- 1 root root 27270656 Apr 23 16:06 inception.tar -rw-r--r-- 1 root root 11762 Apr 23 16:06 Yearning.sh [root@test install]# tar xf inception.tar [root@test install]# cd inception/bin/ [root@test bin]# ll total 12472 -rw-r--r-- 1 501 games 722 Jan 3 10:39 inc.cnf -rwxr-xr-x 1 501 games 9016999 Oct 12 2017 Inception -rwxr-xr-x 1 501 games 3747312 Oct 12 2017 mysql

However, it is now official to download the .zip package directly and decompress it directly (so it is not recommended to use source code installation here), which is more convenient.

mysql> create database Yearning default character set utf8mb4 collate utf8mb4_unicode_ci;Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| Yearning           |
| mysql              |
| performance_schema | | sys           | +--------------------+ 5 rows in set (0.00 sec)

Just install the Mysql database in advance and configure it according to the previous requirements.

[root@CentOS7-1 ~]# ll
total 14036 -rw-------. root root     1320 Apr  8 05:08 anaconda-ks.cfg -rw-r--r--  root root 14349178 Apr 11 09:26 Yearning-2.2.0.linux-amd64.zip

Above we download the latest version 2.2.0 directly from github:

[root@CentOS7-1 ~]# cd Yearning-go/
[root@CentOS7-1 Yearning-go]# ll total 9772 -rw-r--r-- root root     127 Aug  1  2019 conf.toml drwxr-xr-x root root     116 Apr  22:32 dist -rw-r--r-- root root     620 Jan  21:06 docker-compose.yml -rw-r--r-- root root     597 Aug 21  2019 Dockerfile -rw-r--r-- root root     177 Aug 23  2019 # README -rwxr--r-- root root 9985356 Apr  22:35 Yearning -rw-r--r-- root root     283 Jan 15 03:55 yearning.service

Modify configuration file

vim conf.toml

[Mysql]
Db = "Yearning"
Host = "127.0.0.1"
Port = "3306"
Password = "xxxx"
User = "root" [General] #数据库加解密key,只可更改一次。 SecretKey = "dbcjqheupqjsuwsm"
SecretKey is a salt for encryption / decryption of token / database password. It is recommended that all users change the SecretKey before installing Yearning for the first time (there will be a security risk if they are not changed). The format: both uppercase and lowercase letters, and the length must be 16 digits.

Special Note: This key can only be changed during the initial installation! It cannot be changed again afterwards! If the key is changed again, the previously stored data source password cannot be decrypted, and eventually the relevant data source information cannot be obtained.

initialization

./Yearning -m

640.png

Be sure to perform -m initialization before starting -s! If you want to initialize again, you need to delete all the tables under the yearning library, otherwise repeated execution will be invalid.

Start service

#默认启动
./Yearning -s

#参数启动
./Yearning -s -b "192.168.1.9" -p "8000"

Using help


[root@CentOS7-1 Yearning-go]# ./Yearning -h
version: Yearning/2.2.0 general author: HenryYee Usage: Yearning [-m migrate] [-p port] [-s start] [-b web-bind] [-h help] [-c config file] Options: -s  启动Yearning  -m  数据初始化(第一次安装时执行)  -p  端口  -b  钉钉/邮件推送时显示的平台地址  -x  表结构修复,升级时可以操作。如出现错误可直接忽略。  -h  帮助  -c  配置文件路径  -k  用户权限变更为权限组(2.1.7以下升级至2.1.7及以上使用)  -f  初始化Admin用户密码

Open a browser  http://192.168.1.9 : 8000

Default password: admin / Yearning_admin

Introduction of related function modules

1. User module

Dashboard: Dashboard mainly displays Yearning data including the number of users / data sources / work orders / inquiries and other charts. In the personal information column, users can modify the password / email / real name, and can view the user permissions and apply permissions ( (The application permission is invalid after version 2.1.7).

My ticket: Show the ticket information submitted by the user. For the failed / rejected ticket, click the detailed information to modify the SQL and submit it. For the successful ticket, you can view the rollback statement and quickly submit the SQL.

Work order DLL: DDL related SQL submission review, view table structure / index, SQL syntax highlighting / auto completion.

DML review: DML related SQL submission review, SQL syntax highlighting / auto completion.

Query: query / export data SQL syntax highlighting / auto-complete completion DML statement submission.

2. Audit module

Work order review: DDL / DML administrator review and execution.

Query review: user query review.

Permission review: user permission review (below 2.1.7)

3. Management and management module

User management: create / modify / delete users

Database management: add / edit / delete data sources

User rights: user rights modification / clear

Function setting: set message push related information including Nail Robot / email, set LDAP related information, global configuration information, global configuration switch

Audit rules: set SQL detection rules

AutoTask automates tasks

New in version 2.1.4: users can automatically perform tasks by changing the function settings. When the submitted dml statement meets the corresponding task conditions. It will be executed automatically, without the need for reviewers. This function is limited to dml statements. Please use carefully!

to sum up

Yearning is a SQL auditing platform, which can solve the problems between operation and maintenance and development to a certain extent. Unfortunately, it only supports Mysql. If you are interested, you can try it!

Reference materials:
https://guide.yearning.io/
https: //gitee.com/cookieYe/Ye ...

 

 

Guess you like

Origin www.cnblogs.com/youkanyouxiao/p/12731294.html