Home  >  Article  >  Database  >  How do redis and mysql generally cooperate?

How do redis and mysql generally cooperate?

(*-*)浩
(*-*)浩Original
2019-11-20 13:58:5311932browse

redis and mysql cooperation solution

How do redis and mysql generally cooperate?

##Apply Redis to read and write data, and use queue processing at the same time The server writes data to mysql regularly. (Recommended Learning: Redis Video Tutorial ) ## At the same time, pay attention to avoid conflicts. When redis starts, go to MySQL to read all the table key values ​​and store in redis, write data to redis When, the redis primary key is automatically incremented and read. If the mysql update fails, the cache needs to be cleared and the redis primary key needs to be synchronized in time.

Option one:


The program writes Redis and MySQL at the same time

How do redis and mysql generally cooperate?

Option two :

Program to write MySQL, use Gearman to call MySQL UDF, and complete writing to Redis

How do redis and mysql generally cooperate?##Option 3:

The program writes MySQL, parses binlog, puts the data into the queue and writes Redis

How do redis and mysql generally cooperate?Option 4:

Program Write Redis, and put the write into MQ and write MySQL

The above is the detailed content of How do redis and mysql generally cooperate?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn