mysql的主从复制、读写分离,关于从的问题
大家讲道理
大家讲道理 2017-04-17 14:55:01
0
1
661

a=主库,快速插入数据
b=从库,复制主库数据

疑问:主库只有主键索引,复制过来后,我能不能给从库建立其他字段的索引?还是两个库的结构必须一模一样?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(1)
Peter_Zhu

Theoretically, the data from the slave database is not synchronized to the main database, and changes to the data structure of the slave database do not affect the data in the main database. This can be done.

But there are potential problems:

  • The slave database has a unique index on a certain field, but the master database does not have such a setting. Synchronization data may fail to be inserted, causing synchronization interruption

  • The slave library directly modified the structure, and the data of the main library could not be stored in the database at all, and the synchronization failed

  • When the primary machine fails, the data structure of the backup machine is inconsistent, which affects recovery and business replacement

SO, it’s up to you

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template