Answer the question
In order to leave comments, you need to log in
How to track the appearance of http traffic on the server?
In general, the bottom line is that there is nginx on which 2 hosts are registered in the upstream, 1 main and backup,
when http traffic (port 80) switches from the main server to the backup server, you need to reset the php cache, now the cache is reset manually by using the php / home/www/xxxx/current/app/cli.php cache clear prod
You need to do something so that when traffic appears on the backup server, the command php /home/www/xxxx/current/app/cli.php cache clear prod is executed , if someone tells me where to dig, I will be very grateful.
In theory, you need a script that will check for the appearance of http traffic and execute the command, how to check for the appearance of http traffic?
Answer the question
In order to leave comments, you need to log in
You don't need to reset it, it needs to be synced.
Memkesh, it is easily balanced, in fact, you balance the entire session and cache.
Of course, you can do something like
cat /var/log/nginx/access.log | grep "тут признак того что хиты нужные тебе пошли на него" | grep " тут признак по дате или через awk там омжно диапазон дат указывать." && /usr/bin/php /home/www/xxxx/current/app/cli.php cache clear prod
Such things must be done through some distributed storage like Zookeeper that stores information about the topology of servers. If a global event has arrived, then check the box in the "traffic on such and such a host" type "traffic on such and such a host" has appeared. And the responsible daemon or script will look into this flag and make decisions. Such buffering will save you from "multiple cache flushes" that you can't avoid without event buffering and deduplication. I speak as a developer because in distributed systems this is the most common mistake. Ignoring phantom and unnecessary events.
If there are two hosts, then traffic can switch very often. Up to the simultaneous execution of different requests here and there. So the idea of flushing the cache is so-so; especially since it is not clear on which host you are flushing the cache, and why you should do it at all.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question