Enable/Disable Local Host Cache (LHC) in XenDesktop /Force an Outage
To know about LHC check out my post: http://knowcitrix.com/local-host-cache-in-xendesktop/
To enable Local Host Cache, open powershell and enter:
Set-BrokerSite -LocalHostCacheEnabled $true -ConnectionLeasingEnabled $false
This cmdlet also disables the connection leasing feature. Do not enable both Local Host Cache and connection leasing.
To determine whether Local Host Cache is enabled, enter:
Check that the LocalHostCacheEnabled property is True, and that the ConnectionLeasingEnabled property is False.
To disable Local Host Cache (and enable connection leasing), in powershell console, enter:
Set-BrokerSite -LocalHostCacheEnabled $false -ConnectionLeasingEnabled $true
Force an outage or Enable LHC for db unavailable situation:
Note: You can use this process to test LHC by forcing an outage. In case of real time DB issue, you have to follow same process below to use LHC until your DB is restored. Note that failover to LHC doesn’t happen automatically when a database is failed. It is manual process to failover to LHC.
You might want to deliberately force a database outage.
- If your network is going up and down repeatedly. Forcing an outage until the network issues resolve prevents continuous transition between normal and outage modes.
- To test a disaster recovery plan.
- While replacing or servicing the site database server.
To force an outage, edit the registry of each server containing a Delivery Controller.
- In HKLM\Software\Citrix\DesktopServer\LHC, set OutageModeForced to 1. This instructs the broker to enter outage mode, regardless of the state of the database. (Setting the value to 0 takes the server out of outage mode.)
- In a Citrix Cloud scenario, the connector enters outage mode, regardless of the state of the connection to the control plane or primary zone.
Note: Citrix config synchronizer service and citrix high availability service, services should be running after you enable these commands.
Event logs indicate when synchronizations and outages occur.
Config Synchronizer Service
During normal operations, the following events can occur when the CSS copies and exports the broker configuration and imports it to the LocalDB using the High Availability Service (secondary broker).
- 503: A change was found in the principal broker configuration, and an import is starting.
- 504: The broker configuration was copied, exported, and then imported successfully to the LocalDB.
- 505: An import to the LocalDB failed; see below for more information.
High Availability Service
- 3502: An outage occurred and the secondary broker (High Availability Service) is performing brokering operations.
- 3503: An outage has been resolved and normal operations have resumed.
- 3504: Indicates which secondary broker is elected, plus other brokers involved in the election.
Several troubleshooting tools are available when an synchronization import to the LocalDB fails and a 505 event is posted.
CDF tracing: Contains options for the ConfigSyncServer and BrokerLHC modules. Those options, along with other broker modules, will likely identify the problem.
Report: You can generate and provide a report that details the failure point. This report feature affects synchronization speed, so Citrix recommends disabling it when not in use.
To enable and produce a CSS trace report, enter:
New-ItemProperty -Path HKLM:\SOFTWARE\Citrix\DesktopServer\LHC -Name EnableCssTraceMode -PropertyType DWORD -Value 1
The HTML report is posted at C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\CitrixBrokerConfigSyncReport.html
After the report is generated, disable the reporting feature:
Set-ItemProperty -Path HKLM:\SOFTWARE\Citrix\DesktopServer\LHC -Name EnableCssTraceMode -Value 0
Export the broker configuration: Provides the exact configuration for debugging purposes.
Export-BrokerConfiguration | Out-File < file-pathname>
For example, Export-BrokerConfiguration | Out-File C:\BrokerConfig.xml.
Manage Local Host Cache
SQL Server Express LocalDB
The Microsoft SQL Server Express LocalDB that Local Host Cache uses is installed automatically when you install a Controller or upgrade a Controller from a version earlier than 7.9. There is no administrator maintenance needed for the LocalDB. Only the secondary broker communicates with this database; you cannot use PowerShell cmdlets to change anything about this database. The LocalDB cannot be shared across Controllers.
The SQL Server Express LocalDB database software is installed regardless of whether Local Host Cache is enabled.
To prevent its installation, install or upgrade the Controller using the XenDesktopServerSetup.exe command, and include the /exclude “Local Host Cache Storage (LocalDB)” option. However, keep in mind that the Local Host Cache feature will not work without the database, and you cannot use a different database with the secondary broker.
Note: Installation of this LocalDB database has no effect on whether or not you install SQL Server Express for use as the site database.
Local Host Cache DB file location:
On Delivery controller navigate to this path:
To ensure reliability, the CitrixConfigSync Service makes a backup of the previously successful synchronized database import, before starting a new site database sync. If for any reason the sync does not succeed, the backup is used until a successful sync completes. You should not copy the database manually.
More info: https://docs.citrix.com/en-us/categories/solution_content/implementation_guides/local-host-cache-sizing-scaling.html
Want to learn more on Citrix Automations and solutions???
Subscribe to get our latest content by email.