MySql - 两个从数据库复制

发布于 2024-12-08 18:00:17 字数 616 浏览 0 评论 0原文

我想实现同一服务器复制,这样就会有两个数据库在同一服务器上复制一个数据库

这是我在 my.ini 中的配置,

enter code here


server-id=1

log-bin

report-host=master-is-slave-host
log-bin=localhost-binlog  
relay-log=localhost-relaylog

replicate-same-server-id=1

binlog-do-db=test
replicate-rewrite-db=test->myslave

**#replicate-rewrite-db=test->myslave2 does not work**

 replicate-do-table=myslave.tblslave

**#replicate-do-table=myslave2.tblslave does not work**

上面的代码可以很好地从同一服务器上的 db test 复制到 myslave

我也想实现从 db test 复制到同一服务器上的 myslave2 以及 myslave

基本上它将是一个主数据库和两个从数据库复制同一主数据库

问候, 里兹万

I want to achieve same server replication, such a way there will be two databases replicating one database on same server

Here is my configuration in my.ini

enter code here


server-id=1

log-bin

report-host=master-is-slave-host
log-bin=localhost-binlog  
relay-log=localhost-relaylog

replicate-same-server-id=1

binlog-do-db=test
replicate-rewrite-db=test->myslave

**#replicate-rewrite-db=test->myslave2 does not work**

 replicate-do-table=myslave.tblslave

**#replicate-do-table=myslave2.tblslave does not work**

the above code works fine for replication from db test to myslave on same server

I also want to achieve replication from db test to myslave2 on same server along with myslave

Basically it will be one master db and two slave db replicating the same master db

Regards,
Rizwan

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

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

发布评论

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

评论(1

演多会厌 2024-12-15 18:00:17

这是我的 my.cnf 代码:

[mysqld]
server-id=1
report-host=master-is-slave-host
log-bin=/var/log/mysql/mysql-bin.log
log-bin-index=/var/log/mysql/mysql-bin.index
relay-log=/var/log/mysql/mysql-relay-bin.log
relay-log-index=/var/log/mysql/mysql-relay-bin.index
expire_logs_days=10
replicate-same-server-id=1
binlog-do-db=masterdb
log-error=/var/log/mysql/error.log
replicate-rewrite-db=masterdb->slavedb
replicate-do-table=slavedb.some_table

Here is my code from my.cnf:

[mysqld]
server-id=1
report-host=master-is-slave-host
log-bin=/var/log/mysql/mysql-bin.log
log-bin-index=/var/log/mysql/mysql-bin.index
relay-log=/var/log/mysql/mysql-relay-bin.log
relay-log-index=/var/log/mysql/mysql-relay-bin.index
expire_logs_days=10
replicate-same-server-id=1
binlog-do-db=masterdb
log-error=/var/log/mysql/error.log
replicate-rewrite-db=masterdb->slavedb
replicate-do-table=slavedb.some_table
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文