How to install external Garnet on Windows Server and Connecting MDSS to it?

Overview 

This article describes how to install Microsoft Garnet 1.0.91 as a Windows Service and connect MetaDefender Storage Security (MDSS) to it. Garnet can serve as a Redis-compatible replacement for the MDSS cache. 

Prerequisites 

Requirement 

Details 

Windows Server 

Any supported version (2019 / 2022 recommended). 

.NET 10 Runtime 

Required to run GarnetServer.exe. Download from https://dotnet.microsoft.com/en-us/download/dotnet/9.0 under Run server apps > Windows x64 Installer. 

Garnet 1.1.10 

Download win-x64-based-readytorun.zip from https://github.com/microsoft/garnet/releases/tag/v1.0.91 

Administrator access 

Required to create and manage Windows Services. 

 

Step 1 — Install the .NET 9 Runtime 

If .NET 9 is not already installed, download the installer manually from the Microsoft .NET download page and run it. Verify the installation with: 

dotnet --list-runtimes 

You should see Microsoft.NETCore.App 9.0.x listed in the output. 

Step 2 — Extract Garnet 

Extract the contents of win-x64-based-readytorun.zip to a permanent location, for example: 

C:\Garnet\ 

Ensure the following files are present after extraction: 

  • net9.0\GarnetServer.exe 

  • net9.0\Service\Garnet.worker.exe 

 

Step 3 — Create the Configuration File 

Create a file named garnet.conf, if not already present at C:\Garnet\net9.0\garnet.conf with the following content: 

{ 
  "Port": 6379, 
  "Address": "0.0.0.0", 
  "MemorySize": "5g", 
  "IndexSize": "64m", 
  "IndexMaxSize": "1g", 
  "ObjectStoreHeapMemorySize": "1g", 
  "MutablePercent": 90, 
  "PageSize": "4m", 
  "ExpiredKeyDeletionScanFrequencySecs": 120, 
  "ExpiredObjectCollectionFrequencySecs": 60, 
  "EnableStorageTier": false, 
  "CompactionType": "None", 
  "CompactionFrequencySecs": "0", 
  "CompactionForceDelete": true, 
  "SegmentSize": "16m", 
  "CompactionMaxSegments": 2, 
  "ObjectStoreCompactionMaxSegments": 2, 
  "ObjectStoreSegmentSize": "16m" 
} 

Note: Set MemorySize large enough to hold all live cache data in memory so live keys are not dropped when the log fills. 

Note: PageSize must be kept small (4m) so memory is reclaimed in page-sized chunks. 

Note: Storage tier and compaction are disabled; in OPSWAT testing, disk compaction was unreliable under load with storage tier enabled. 

 

Step 4 — Install Garnet as a Windows Service 

Open Command Prompt as Administrator and run the following command. Garnet.worker.exe is a proper Windows Service host that correctly handles Service Control Manager (SCM) communication. 

sc create Garnet binPath= "\"C:\Garnet\net9.0\Service\Garnet.worker.exe\" --config-import-path \"C:\Garnet\net9.0\garnet.conf\"" start= auto DisplayName= "Garnet Cache Server" 

Note: Run this in Command Prompt (cmd.exe), not PowerShell. In PowerShell, sc is aliased to Set-Content and the command will fail. If you must use PowerShell, replace sc with sc.exe. 

Start the service: 

sc.exe start Garnet 

Verify it is running: 

sc.exe query Garnet 

The output should show STATE: 4 RUNNING. 

 

Step 5 — Open the Firewall Port (if MDSS is on a separate host) 

If MDSS runs on a different machine, allow inbound traffic on port 6379: 

netsh advfirewall firewall add rule name="Garnet" dir=in action=allow protocol=TCP localport=6379 

Note: Skip this step if Garnet and MDSS are on the same host. 

 

Step 6 — Connect MDSS to Garnet 

In your MDSS configuration, set the Redis connection string to point to the Garnet server. Garnet is Redis-protocol compatible, so no additional changes are required. 

CACHE_SERVICE_URI=<garnet-server-ip>:6379 

Note: If you configured a password in garnet.conf, include it in the URI:  
CACHE_SERVICE_URI=<garnet-ip>:6379,password=<password>. 

 

Troubleshooting 

Service fails to start (exit code 1053) 

Verify that .NET 9 Runtime is installed and visible to the system account. Run dotnet --list-runtimes in an elevated prompt to confirm. 

Service starts then immediately stops 

Check Windows Event Viewer under Windows Logs > Application for error details. Ensure garnet.conf is valid JSON and the path in the sc create command is correct. 

MDSS cannot connect to Garnet 

Confirm the service is running with sc.exe query Garnet. Verify the firewall rule is in place if MDSS is on a separate host. Test connectivity with powershell: Test-NetConnection -ComputerName <ip> -Port 6379 

sc command fails in PowerShell 

Use cmd.exe instead, or prefix the command with sc.exe in PowerShell.