Varnish Cache

Overview

This appendix explains how to install and configure Varnish Cache and its functions.

The topics in this appendix include the following:

Monitoring Varnish Cache

Checking the Varnish Cache Disk Usage

Cleaning up the Varnish Cache Log File

Cleaning up Varnish Cache

Cleaning up Specific URLs

Installing Varnish Cache

Follow these steps to install Varnish Cache:


Step 1 SSH to the server using the following credentials:

admin/admin

Step 2 Enter the yum install cpc-varnish command to install Varnish Cache.

After a few seconds, the system lists the components of Varnish Cache. Enter the Y command and press the Enter key to install the base services.

After a few minutes, the system completes the installation.


 

Configuring Varnish Cache

Follow these steps to configure Varnish Cache:


Step 1 In the PuTTY configuration window, enter the CPC CMS Host Name (or IP address). Then, click Open .

Step 2 Enter the login credentials provided to you. Then, press Enter . The CPC TUI Configuration Menu appears.

The main TUI menu opens.

Step 3 In the main menu, type the appropriate letter to go to the Patient Connect menu.

Step 4 In the Patient Connect menu, type the appropriate letter to go to the Configure Varnish menu.

Step 5 Provide IP address or Fully Qualify Domain Name (FQDN) of the CPC CMS server nuxeo_url=.


 

Maintaining the Cache

You can maintain the cache using Varnish Cache by monitoring it, checking its disk usage, and cleaning the log file.

Monitoring Varnish Cache

You can monitor Varnish Cache by viewing its parameters and logs as follows:

Viewing Varnish Cache Parameters

Follow these steps to view Varnish Cache parameters:


Step 1 SSH to the server using the following credentials:

admin/admin

Step 2 Enter the varnishstat command to view the list of parameters and their statistics of Varnish Cache.


Note Refer the Varnish documentation to know more details about these parameters.



 

Viewing Varnish Cache Logs

Follow these steps to view the Varnish Cache logs:


Step 1 SSH to the server using the following credentials:

admin/admin

Step 2 You can view the Varnish Cache logs in the following two formats:

1. Enter the varnishlog command to view the log.

The list of logs appear.

2. Enter the varnishncsa command to view the NCSA format of log.

The NCSA format of log appears.


 

Checking the Varnish Cache Disk Usage

Follow these steps to check the Varnish Cache memory and disk usage:


Step 1 SSH to th server using the following credentials:

admin/admin

Step 2 Enter the ps aux --sort -rss | grep varnish command.

The system displays the Varnish Cache memory and disk usage details.


 

Cleaning up the Varnish Cache Log File

Follow these steps to view the Varnish Cache logs:


Step 1 SSH to the server using the following credentials:

admin/admin

Step 2 To start capturing logs, start the varnishncsa service by running the varnishncsa start command.


Note To stop the varnishncsa service, run the varnishncsa stop command.


Step 3 Go the cd /var/log/varnish directory.

Step 4 Open the varnishncsa.log file to view all the Varnish Cache logs.

You can clean up the logs from the varnishncsa.log file.


 

Managing the Cache

You can clean up the cache, specific URLs, and all the images having Nuxeo text in their URLs using Varnish Cache.

Cleaning up Varnish Cache

Follow these steps to clean Varnish Cache:


Step 1 SSH to the server using the following credentials:

admin/admin

Step 2 Enter the varnishadm command to open Varnish Command Line Interface.

Step 3 To clear all the entries for a host, enter the ban req.http.host ~ <Hostname/IP> command. For example, ban req.http.host ~ 10.104.194.49.


Note The hostname/IP is the Varnish Cache VM hostname/IP.


Step 4 Enter the quit command to exit from the Varnish Command Line Interface.


 

Cleaning up Specific URLs

Follow these steps to clean the specific URLs:


Step 1 SSH to the server using the following credentials:

admin/admin

Step 2 Enter the varnishadm command to open Varnish Command Line Interface.

Step 3 To clear specific entry from the cache, enter the ban req.http.host ~ Hostname/IP && req.url ~ Full Resource Path command. For example, ban req.http.host ~ 10.104.194.49 && req.url ~ nuxeo/nxbigfile/default/bb5cf25e-5c40-4338-b697-b9f34f2b84f4/file:content/Relaxation.png.


Note The hostname/IP is the Varnish Cache VM hostname/IP.


Step 4 To clear all the images having the Nuxeo text in their URL, enter the ban req.http.host ~ Hostname/IP && req.url ~ Partial Resource Path command. For example, ban req.http.host ~ 10.104.194.49 && req.url ~ nuxeo.

Step 5 Enter the quit command to exit from the Varnish Command Line Interface.