Starting a Caching service
Windows PowerShell plays an extremely important role in the overall management of Windows Server AppFabric. There are hundreds of cmdlets and functions available that allow administrators (and developers alike) to perform day-to-day management tasks on AppFabric. As Caching is one of the biggest features in Windows Server AppFabric, it is no surprise that AppFabric Caching has a dedicated set of PowerShell cmdlets that allow developers and administrators to interact with the distributed Cache environments in an interactive and streamlined manner.
In this recipe, we will look at how to use PowerShell cmdlets to interact with the AppFabric Caching service.
Note
There are two ways that you can configure your Windows Server AppFabric installation/environment. One option is to use the Windows Server AppFabric Configuration wizard (that we have extensively used in this chapter) and another option is to use the Windows Server AppFabric PowerShell cmdlets. Using PowerShell to manage AppFabric Caching introduces a number of useful possibilities, including but not limited to automating build and deployment scenarios, and enabling command line monitoring and troubleshooting.
Getting ready
Assuming that you have the Windows Server AppFabric administration feature installed, you can launch the AppFabric PowerShell console via Administrative tools (available under Start | Control Panel | Administrative Tools) or by going to the Windows Server AppFabric folder under Program Files and selecting Caching Administration Windows PowerShell:
How to do it...
After starting the Caching Administration Windows Powershell console with administrative privileges, we can start our Cache Cluster for the first time:
- To set the context of the Windows PowerShell session, we will execute the
use-CacheCluster
command first. - Once the context has been set, we will execute the
start-CacheCluster
command. This should result in a status that shows that the Caching Service is up and running: - Once the Caching Service is up and running, we can query it for the caches that are available in this cluster by using the
Get-Cache
command.
How it works...
The Caching Administration PowerShell commandlets give us complete control for managing an AppFabric Cache Cluster. When starting PowerShell sessions and running on a non-host computer, you must provide the -Provider
(xml or System.Data.SqlClient)
and ConnectionString
(file path for XML or connection string for database).
Note that Cache services do not automatically start after a system reboot, so the Start-CacheCluster
command must be invoked. We can also use the Start-CacheHost
command with HostName
and Port
parameters to start a particular host in the cluster.
We will see much more on each of these PowerShell commands in the following chapters of this book.