In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use MySQL automatic operation and maintenance tool goinception", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "how to use MySQL automatic operation and maintenance tool goinception" bar!
Goinception introduction
GoInception is a MySQL operation and maintenance tool that integrates audit, execution, backup and generation of rollback statements. By parsing the syntax of executing SQL, it returns the audit results based on custom rules, and provides the functions of executing and backing up and generating rollback statements.
Goinception architecture
Goinception installation
Officials have provided several installation methods, as follows.
1. Source code installation
Source code installation requires an environment of go v1.2 or above, using 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 mode
[root@centos7 ~] # docker pull hanchuanchuan/goinception
3. Binary installation (recommended)
Go directly to the official address: https://github.com/hanchuanchuan/goInception/releases/download/ to download the corresponding version of the file, after the download is completed, you can directly decompress and run.
[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 1501 games 39399424 May 22 07:45 goInception
After the decompression is completed, you will see a default configuration file in the config directory: config.toml.default, which you can modify according to the actual situation.
GoInception uses TiDB source code refactoring, so some parameters can be found in TiDB related documentation.
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], and so on. Example (this example is only to show the config.toml file structure, 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] # log parameter level = "info" format = "text" [log.file] # log file parameter filename = "" max-size = 300 [inc] # Audit option enable_nullable = true enable_drop_table = false check_table_comment = false check_column_comment = false # and so on. [osc] # pt-osc parameter osc_on = false osc_min_table_size = 16 [ghost] # gh-ost parameter ghost_allow_on_master = true
After the configuration modification is complete, you can start normally.
[root@centos7 goinception] #. / goInception-config=config/config.toml [root@centos7 ~] # netstat-lntp | grep 4000 tcp6 00:: 4000: * LISTEN 1250/./goInception
Use an example
/ *-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 introductions
1. Result information
There are two kinds of information returned to the user
One is that there are errors in the basic information submitted to the goInception, such as incomplete source information, or errors in the source information. In this case, the exception is reported directly, including the error code and error message, which is the same as the exception on the MySQL server, and can be handled normally outside.
Second, if there are no problems above, the result of the check will be told to the client in the form of a result set. Consistent with the mysql native result set. In the returned result set, each row of data is a submitted SQL statement. Within goInception, all submitted statement blocks are taken apart one by one and returned in the form of a result set. It is clear at a glance in the result set that there are any problems or states for each statement.
Note: if a syntax error occurs in the statement, it cannot continue, because goInception can no longer separate the remaining statements, then the rows of multiple behaviors and multiple result sets that have been normally checked before are returned, and the subsequent error statements are returned as one line, of course, the error message of this is a syntax error.
2. Built-in backup function
Comes with backup function. First configure config.toml when the service is started (put in the [inc] section)
Default optional range of parameters describes backup_host "" string backup database IP address backup_port0int backup database port backup_user "" string backup database user name backup_password "" string backup database password
And when you execute sql, add the-- backup=true or-- backup=1 options.
3. Audit rules
For more information about audit rules, audit options and so on, please see:
Https://hanchuanchuan.github.io/goInception/rules.html
Contrast Inception
1. Functional comparison
2. Speed
3. Use
This kind of tool liberates the hands of DBA to a certain extent, and can avoid errors to a great extent, thus ensuring the correct rate of SQL execution. At the same time, it also provides SQL rollback function, which can roll back in case of error to ensure data security and integrity.
Thank you for reading, the above is the content of "how to use MySQL Automation Operation and maintenance tool goinception". After the study of this article, I believe you have a deeper understanding of how to use MySQL Automation Operation and maintenance tool goinception, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.