Home > database >  Data consistency problem
Data consistency problem

Time:10-09

How to ensure that data in a Mysql and Redis to save data

CodePudding user response:

What is the business scenario

CodePudding user response:

It all depends on your specific business requirements, this is to belong to high concurrency you read or write high concurrency is handling is also different, is to require strong unanimously agree or the treatment is different also,

Routine: while mysql data update, send a message to the message queue, the message receiver to receive news updates redis data,

CodePudding user response:

refer to the second floor rumlee response:
it depends on your specific business requirements, this is to belong to high concurrency you read or write high concurrency is handling is also different, is to require strong unanimously agree or the treatment is different also,

Routine: while mysql data update, send a message to the message queue, the message receiver to receive news updates redis data,


High concurrency to read or write high concurrency is handling is also different, is to require strong unanimously agree or the treatment is different also, what is the difference between the processing of the scenes, can introduce?

CodePudding user response:

Thanks invitation!
Can be done using the ideas of transaction:
If Mysql and Redis are inserted into the success, success is seen as inserting data
If there is a insert it fails the fallback: delete another insert record of success,
I do with the idea that Mysql and mongo's data consistency

CodePudding user response:

1. Save to Mysql, then saved to a Redis; Instead a big probability data inconsistency;
2. The timing of data in the database synchronization to Redis;
3. Redis data set the period of validity, failure after loaded from the database,
  • Related