我们打算做一主两从的配置。我们的目标如下。我们有大量的传入记录,因此我们计划执行以下操作:
Master - has only past 7 days records Slave 1 - as same as Master (only 7 days records) but we are going to run some stored procedure to consolidate the records
Slave 2 - has all the records ( mostly last 3 months records ) ( we are planning to use SET sql_log_bin = 0 to stored procedure when ever we delete the records ( olderthan 7 days records in master ))
这里有问题,
是否可以在slaves中运行store procedure来合并和删除数据?
除了读取,我们还可以在 slave 中执行哪些操作?
使用 sql_log_bin = 0
安全吗?
最佳答案
根据我对 myql 主/从配置的经验,我建议如下:
不要使用存储过程来合并或删除数据 - 除非您在不会被复制的第二个模式中执行此操作!
如果您执行读取以外的操作,您的从站将不同步 - 对于复制模式! - 因此对于未复制的模式,您可以做任何您想做的事。
对于 sql_log_bin,请参阅 what's difference between sql_log_bin and log_bin in MySQL? 的答案- 我猜让 sql_log_bin 打开会更好。
关于Mysql 主从,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52754361/