MySQL 主/从与 Castle Activerecord

发布于 2024-09-06 01:32:32 字数 178 浏览 2 评论 0原文

我有一个现有的 Web 应用程序,使用 Castle Activerecord 与单个 MySQL 数据库进行交互。数据库最近被重新配置为复制到多个从站。

如何配置 Castle Activerecord 以直接写入 MySQL Master 并读取 MySQL Slave,或者是否有其他方法在此设置中透明地实现主/从操作?

I have an existing web application using Castle Activerecord to interact with a single MySQL database. The Database has recently been reconfigured to replicate to a number of Slaves.

How do you configure Castle Activerecord to direct writes to the MySQL Master and reads to the MySQL Slaves or are there other ways of achieving Master/Slave operation transparently in this setup?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空心↖ 2024-09-13 01:32:32

我从来没有这样做过,但我认为这种事情最好在数据库驱动程序级别处理。事实上, Connector/J 有一个特定的ReplicationDriver 用于此目的。 Connector/NET 文档 有对复制的相当模糊的引用:

主机、服务器、数据源、数据源、地址、地址、网络地址:

名称或网络地址
要连接的 MySQL 实例。
可以指定多个主机
用 & 分隔。这可能很有用
有多台 MySQL 服务器的地方
配置为复制,您是
不关心具体的服务器
您正在连接到。没有尝试是
由提供商进行同步
写入数据库所以应该小心
使用此选项时应采取。在
Unix环境下用Mono,这个可以
是 MySQL 的完全限定路径
套接字文件名。有了这个
配置,Unix套接字将是
用于代替 TCP/IP 套接字。
目前只有一个套接字名称
可以这样访问 MySQL
使用 Unix 的复制环境
目前不支持套接字。

I have never done this, but I think this kind of things are better handled at the DB-driver level. Indeed, Connector/J has a specific ReplicationDriver for this purpose. The Connector/NET documentation has a rather vague reference to replication:

Host, Server, Data Source, DataSource, Address, Addr, Network Address:

The name or network address of the
instance of MySQL to which to connect.
Multiple hosts can be specified
separated by &. This can be useful
where multiple MySQL servers are
configured for replication and you are
not concerned about the precise server
you are connecting to. No attempt is
made by the provider to synchronize
writes to the database so care should
be taken when using this option. In
Unix environment with Mono, this can
be a fully qualified path to MySQL
socket file name. With this
configuration, the Unix socket will be
used instead of TCP/IP socket.
Currently only a single socket name
can be given so accessing MySQL in a
replicated environment using Unix
sockets is not currently supported.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文