How to flush the dispatcher cache when there are farms with separate cache folders
Learn how to flush the dispatcher cache when there are farms with separate cache folders. Set Host header and configure Agent User ID.
Description description
Environment
Experience Cloud Services
Issue/Symptoms
How to flush the dispatcher cache when there are farms with separate cache folders.
Resolution resolution
To set up one dispatcher flush agent per dispatcher farm, set the Host header and configure the Agent user ID with a user that has read access to relevant paths.
In the solutions below, we assume the following:
- You are using Apache HTTP Server 2.2 or later version
- Multiple VirtualHosts configured
- Multiple dispatcher farms with separate caches
For example:
Apache https VirtualHost configurations:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.geometrixx.com
ServerAlias *.geometrixx.com
DocumentRoot /var/www/html/cache-www-geometrixx-com
...
</VirtualHost>
<VirtualHost *:80>
ServerName www.geometrixx-outdoors.com
ServerAlias *.geometrixx-outdoors.com
DocumentRoot <Global Doc root>/site2
Include <Configurations specific to site2>
</VirtualHost>
DocumentRoot /var/www/html/cache-www-geometrixx-outdoors-com
In the dispatcher configuration, you have multiple farms configured to handle different sites by hostname (virtualhosts):
/virtualhosts
{
"*geometrixx.com*"
}
/renders
{
...
}
/cache {
/docroot "/var/www/html/cache-www-geometrixx-com"
Set up multiple Flush Agents
If you only have a handful of separate dispatcher farms (five or less), then configuring multiple flush agents is an easy solution.
ln -s /var/www/html/cache-www-geometrixx-com/libs /var/www/html/shared-cache
-
Open http://aem-host:port/miscadmin for each AEM publish instance.
-
Browse to Replication
>
Agents on Publish. -
Click Edit.
-
Under the Agent User ID, enter the name for a user which you create later that would be associated with this agent. You could use a naming convention with the hostname of the site. For example: “flush-agent-www-geometrixx-com”.
-
Select the Extended tab .
-
Under HTTP Headers, add another header. For value, enter “Host: www.geometrixx.com” where “www.geometrixx.com” should be replaced by one of the sites’ DNS hosts.
-
Click Ok to save.
-
Go to http://aem-host:port/useradmin and create the user from step 4.
-
On the Permissions tab of the user, grant the user read access to any paths that you would like the agent to be allowed to flush for the referenced site. For example: /content/geometrixx, /content/dam, /etc, /libs, /apps, /var.
-
Click Save.
-
Repeat steps 1 - 10 for all other sites on each publish instance. You will be creating one flush agent for each site on each publish instance.
-
On the web server, share common paths using symlinks. For example, you could set symlinks for /content/dam, /etc., /libs, /apps, and /var to a common cache location. Then /content and anything under the root of the cache would be separately cached. Here’s an example command for the /libs folder
code language-none ln -s /var/www/html/cache-www-geometrixx-com/libs /var/www/html/shared-cache
-
Now, when you activate pages under a specific site, the flush request is only directed to the applicable flush agent.