V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zealinux
V2EX  ›  程序员

有没有简单的只支持读写分离的 proxy 服务

  •  
  •   zealinux · 2021-03-01 17:55:40 +08:00 · 1559 次点击
    这是一个创建于 1123 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用了几个高 star 的项目,立马发现 bug 出来。不能在生产环境用。

    不知道有没有简单的只支持读写分离的项目,几个项目感觉是 KPI 出来的,极其复杂。 功能很多,bug 也很多。

    我的需求:

    A => RW-proxy-server => 写:主库 || 读:slave0,slave1
    

    不需要其他什么乱七八糟的分表功能。

    隐约觉得应该有这样专注的项目,可能是用 golang 写的。 求推荐

    10 条回复    2021-11-05 13:51:16 +08:00
    liprais
        1
    liprais  
       2021-03-01 17:58:01 +08:00
    你要的这个本来就足够复杂了,随便写写肯定 bug 满天飞
    DollarKiller
        2
    DollarKiller  
       2021-03-01 18:00:17 +08:00
    zealinux
        3
    zealinux  
    OP
       2021-03-01 18:08:36 +08:00
    @DollarKiller 关键不在复制,而是现在已经创建了一个副本。
    关键点应该中间服务包装 mysql 协议,鉴权,解析 sql 和分发流量
    DollarKiller
        4
    DollarKiller  
       2021-03-01 18:25:23 +08:00
    @zealinux 文档看仔细点 Server package supplies a framework to implement a simple MySQL server which can handle the packets from the MySQL client. You can use it to build your own MySQL proxy. The server connection is compatible with MySQL 5.5, 5.6, 5.7, and 8.0 versions, so that most MySQL clients should be able to connect to the Server without modifications.
    bthulu
        5
    bthulu  
       2021-03-01 19:18:33 +08:00
    mysql 客户端我记得原生支持读写分离的啊, 什么服务都不需要用
    bthulu
        6
    bthulu  
       2021-03-01 19:22:29 +08:00
    jdbc 里直接在 url 里设好就行了, jdbc:mysql:replication://master:3306,slave1:3306,slave2:3306/test
    当事务为 readonly 的时候, jdbc 驱动会自动去 slave 读数据.
    dfzj
        7
    dfzj  
       2021-03-01 20:10:39 +08:00
    shardingsphere
    SmiteChow
        8
    SmiteChow  
       2021-03-02 09:51:21 +08:00
    A 自己肯定知道操作是读 /写,不需要代理。
    xiaoyanbot
        9
    xiaoyanbot  
       2021-11-05 13:34:03 +08:00
    有意思, 值得关注
    xiaoyanbot
        10
    xiaoyanbot  
       2021-11-05 13:51:16 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2576 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:55 · PVG 23:55 · LAX 08:55 · JFK 11:55
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.