Use redis publish / subscribe to share data between servers?

now there is a problem that one server generates data and wants to give it to other servers to use. My idea now is to use the publish / subscribe function of redis to share data. I don"t know what the effect is. Have any great gods ever used it, ask for advice, or have other ideas, you can, thank you!

Oct.31,2021

you have found that the typical way to solve this kind of problem is to use message queuing (Message Queue), redis pub/sub is a minimalist model, if it can meet the requirements, then there is no problem, your idea is correct, but also feasible, in addition, you can try other message queuing middleware.


there are too many ways, but it depends on your usage scenario

  1. only needs one save and one read, and the database can be done
  2. you need to notify the data consumer after generating the data. You can use message queues such as redix or rabbitmq, or you can directly use
  3. such as http notification and rpc.

depends on the specific scenario, that is, how to "use" other servers? Don't add this and that to add unnecessary complexity to the system.

for example: data sharing, literally, all you need is a "centralized data store". If you already use mysql, save it in the table and other machines can read it. If you used to use redis, other people can read it. There is no need to publish or anything like that.

I just want to say that the architecture is only appropriate, not good or bad. Whether you need to use queues, publish / subscribe, or even call services remotely depends on your specific business needs

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7ac162-28e29.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7ac162-28e29.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?