search
HomeDatabaseMysql TutorialGolang 实现的 mysql-proxy

Golang1.1昨天发布,性能提升不少。让我想起去年写的mysql-proxy,于是拿出来又改了一下调用最为频繁的一个函数,发现性能已经非常理想。这里放出来给有兴趣的朋友试用。 目前支持的功能是读写分离(非事务,如果用事务的话不会分发到slave上)和slave的负载

Golang1.1昨天发布,性能提升不少。让我想起去年写的mysql-proxy,于是拿出来又改了一下调用最为频繁的一个函数,发现性能已经非常理想。这里放出来给有兴趣的朋友试用。
目前支持的功能是读写分离(非事务,如果用事务的话不会分发到slave上)和slave的负载均衡,未做失效检查。另外prepare可能会有问题。
如果有什么需求可以后续添加,golang改起来非常方便,当初这个proxy我也就1个礼拜完成的。

下载地址:http://www.mysqlab.net/products/mysql-proxy/lbproxy64.tar.gz (linux 64位)
(有需要win版本的可以密我)

配置:
1. 需要配置用于连接proxy的用户名和密码(sha1(plain password))
2. 需要配置连接后端master和slave的用户和密码(sha1(plain password))
3. slaves需要按照proxy.ini 格式写,因为解析ini文件的目前还没有容错
(本来是打算配置用web界面来做的,被其他事情给耽搁了)

启动:
目前启动方式很山寨
cd /path/to/proxy && ./proxy
(这个容易改,我已经有现成的python manager,套用过来就行)

大家有什么反馈可以q我或者这里留言(第一次需要审核,防止垃圾广告。)

Related posts:

  1. A new MySQL proxy written in Go — LegendBase Proxy for MySQL
  2. 由CSDN泄密想到的:MySQL数据库验证过程的改进、密码存储及验证方法的总结
  3. Go(golang) FastCGI Client
  4. daemon function for Go language(golang)(fixed for mac/darwin)

? 谭俊青 发布在 MySQL性能、MySQL Cluster集群、MySQL HA高可用等研究 - MySQL实验室, 2013.
可以任意转载, 但转载时务必以超链接形式标明文章原始出处 和 作者信息。
链接: http://www.mysqlab.net/blog/2013/05/golang-mysql-proxy/

标签:

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment