Mysql-proxy Introduction

Source: Internet
Author: User
Tags lua

# background

Today, colleagues share the theme is Mysql-proxy, so come down to understand, do not seek mastery, just know this thing

# Introduction

Mysql-proxy is MySQL's official MySQL middleware service, which provides access to several mysql-client upstream and several mysql-server to the backend.

It uses the MySQL protocol, and any upstream that uses mysql-client can be migrated to mysql-proxy without modifying any code.

The most basic usage of mysql-proxy is to request the intermediate layer of the relay as a request intercept:

Further, Mysql-proxy can analyze and modify the request. Intercepting queries and modifying results is done by writing LUA scripts.

Mysql-proxy allows users to specify LUA scripts to intercept requests, parse and modify requests, and also allow users to specify the results of the Lua script's return to the server

Make changes, add some result sets, or remove some result sets.

So, fundamentally, Mysql-proxy is an officially provided framework with good extensibility that can be used to accomplish:

    • SQL Interception and Modification

    • Performance analysis and monitoring

    • Read/write separation

    • Request routing

# Use

1. The purpose of sharing a colleague's use of proxy is because the test environment encountered the test/development classmate careless full table update/delete operation, resulting in abnormal test data, thus affecting the progress of the project, so he access to Mysql-proxy SQL statement interception Check, SQL statements can be sent to a DBA-provided SQL review service to determine if there is a problem with the SQL statement
2. Before there is such an experience, before the order through the demolition operation, the order table is divided into 128 libraries, is based on the order number to remove the library, but not all the table has the order number (historical structure of the pot), if there is a demand is based on the mobile phone number to query the order number, resulting in to traverse query 128 to determine Then we need proxy intervention, which was used by Ali's Mycat middleware

# Insufficient

Due to the addition of a layer of proxy will result in increased consumption of network requests, so performance has a certain impact;

Mysql-proxy Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.