mysql读写同步实现思路
PHP中文网
PHP中文网 2017-04-17 14:17:19
0
1
466

场景是这样的的:A程序从远程接口定期的读数据并进行分析存储到数据库中,B程序提供外部接口来访问数据库中的数据。有可能B在读数据的时候,A在写数据,这样不就乱套了吗?如何保证read和write不发生冲突?对mysql的表进行加锁吗?还是有其他的实现思路?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(1)
巴扎黑

1. Reading and writing are not conflicting. It’s just that the data being written may not be read when reading, or the complete data must be read after the writing is completed. Please check the concept of things
2. Reading and writing conflicts? There are read and write conflicts in the same table, unless it is guaranteed that it cannot be read when writing, then the myisam engine can handle it. Check the concept of table locks
3. In terms of things, there is no conflict between reading and writing, unless you are a big For data and the like, consider nosql. Otherwise the innodb engine is enough.

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