简体   繁体   English

我如何将我的mysql数据库带入主从配置中以进行数据备份以及插入和选择的分离

[英]How can i take my mysql database into Master Slave configuration for data backup and separation of inserts and selects

I have a huge database almost 5M records and its growing at a high speed. 我有一个庞大的数据库,几乎有500万条记录,并且高速增长。 I have a Query for report generation which joins 4 tables and the time it takes is not pretty. 我有一个用于生成4个表的报表查询,花费的时间并不长。 I want to replicate my database on a slave instance and separate inserts and select. 我想在一个从属实例上复制数据库,并单独插入并选择。 So when i select data it goes to master and on inserts goes to slave and replicates the data whenever either one is updated. 因此,当我选择数据时,它会变为主数据,插入数据时将变为从数据,并在任何一个更新时复制数据。 Whats your suggestion on this. 您对此有何建议?

In MySQL terminology, user insertions and updates are directed to the Master, such changes are then forwarded to the Slave (so it is the other way around). 在MySQL术语中,用户的插入和更新被定向到主服务器,然后将这些更改转发到从属服务器(因此是相反的方式)。

If you want a bi-directional synchronisation, you will need to consider circular replication ( here is a good tutorial). 如果要进行双向同步,则需要考虑循环复制( 是一个很好的教程)。

The next step is clustering , but this is a bit more complex to handle. 下一步是集群化 ,但这要处理起来有点复杂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM