connectionstring mysql,用于将3个主节点连接到MySQL的ConnectionString「建议收藏」

connectionstring mysql,用于将3个主节点连接到MySQL的ConnectionString「建议收藏」BackgroudIamdevelopinga.netproject,whichworkswithEF6andMySQLDB.ForHighAvailability,IamusingGaleracluster,soIhave3MySQLMasternodesupandrunning:master1,master2andmaster…

大家好,又见面了,我是你们的朋友全栈君。

connectionstring mysql,用于将3个主节点连接到MySQL的ConnectionString「建议收藏」

Backgroud

I am developing a .net project, which works with EF6 and MySQL DB. For High Availability, I am using Galera cluster, so I have 3 MySQL Master nodes up and running: master1, master2 and master3.

According to connectionstring.com I should be able to use the following connection string:

Server=master1, master2, master3;Database=myDataBase;

Uid=myUsername;Pwd=myPassword;

I have tried the above, and it does not work… I have seen this bug which explains multi-host connection string does not work.

Question

According to this link I can use mysql:loadbalance: in front of my JDBC connection string. The problem is I don’t know which MySQL Connector am I using? I believe I have installed the Standard/Default Nuget Packages for .net (MySQL.Data and MySQL.Data.EntityFramework). Any idea which MySQL Connector come with the above packages?

Any idea how can I use MySQL connector to load balance/connect the 3 Master nodes?

解决方案

This isn’t supported by MySQL.Data. As you observed, there are multiple bug reports (#81650, #88962) pointing out this problem, but it hasn’t been fixed in three years.

As explained here, there is an alternative MySQL library, MySqlConnector, that does support this connection string syntax. Unfortunately, there is no EF6 library available for it. (There is an EF.Core package, Pomelo.EntityFrameworkCore.MySql.)

A workaround would be to create a layer 4 load balancer in front of your three Galera nodes. Galera provides documentation on how to do this with HAProxy. Your C# MySQL client would connect to HAProxy, and it would load balance connections between your Galera servers.

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/158068.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • SpringBoot登录用户权限拦截器「建议收藏」

    SpringBoot登录用户权限拦截器「建议收藏」1.创建自定义拦截器类并实现HandlerInterceptor接口packagecom.xgf.online_mall.interceptor;importcom.xgf.online_mall.system.domain.User;importlombok.extern.slf4j.Slf4j;importorg.springframework.stereotype.Component;importorg.springframework.web.servlet.Handler

    2022年7月17日
  • NVIDIA Jetson TX1介绍(一)

    NVIDIA Jetson TX1介绍(一)NVIDIAJetsonTX1概述NVIDIAJetsonTX1是计算机视觉系统的SoM(system-on-module)解决方案。它组合了最新的NVIDIAMaxwellGPU架构,其具有ARMCortex-A57MPCore(Quad-Core)CPU族,实现性能与电源功耗的最大优化,满足下一代产品的工业视觉计算的要求。JetsonTX1SoM设计满足低功耗环境…

    2022年6月16日
  • Visual Studio——使用多字节字符集与使用Unicode字符集

    Visual Studio——使用多字节字符集与使用Unicode字符集vs配置选项“使用多字节字符集”和“使用Unicode字符集”的区别VS集成开发环境,字符集选择“使用多字节字符集”和“使用Unicode字符集”的直接区别就是:编译器是否增加了宏定义——UNICODE。当选择“使用Unicode字符集”时,编译器会增加宏定义——UNICODE;而选择“使用多字节字符集”时,编译器则不会增加宏定义——UNICODE。而是否增加了宏定义UNICODE,则…

    2022年10月22日
  • Oracle触发器和事务[通俗易懂]

    Oracle触发器和事务[通俗易懂] oracle触发器和事务2015年11月24日14:16:43 it_taojingzhan 阅读数:320编写触发器时,需要注意以下几点:l        触发器不接受参数。l        一个表上最多可有12个触发器,但同一时间、同一事件、同一类型的触发器只能有一个。并各触发器之间不能有矛盾。l        在一个表上的触发器越多,对在该表上的DML操作的性能影…

    2022年7月27日
  • 【Consul】Consul实践指导-Watch机制

    【Consul】Consul实践指导-Watch机制Watches是查看指定数据信息的一种方法,比如查看nodes列表、键值对、健康检查。当监控到更新时,可以调用外部处理程序——可以自定义。比如,发现健康状态发生变化可以通知外部系统健康异常。…

    2022年10月31日
  • Install Orace 11g on Solaris 10 Sparc 64 bit

    Install Orace 11g on Solaris 10 Sparc 64 bit

    2022年1月5日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号