I have 2 python servers running independently of one another but sharing the same database. They need to communicate with each other about when certain changes have been made to the database so the other server (if running) can reload cached data.
What would be my best options for communicating between two such programs?
I’ve thought of using sockets but it seems like a lot of work. Either one program will be polling connect whenever the other is off, or they both need to have server/client capabilities. I looked into named pipes but didn’t see any easy portable solution (needs to run on windows and unix).
The easiest way is to use the database itself as a means of communication. Add a table for logging updates. Then, either machine can periodically query to see if the underlying data has been changed.
Another easy form of communication is email using the smtplib module. Our buildbots and version control repository use this form of communication.
If you want something with a little more “industrial” strength, consider using RabbitMQ or somesuch for messaging between servers.