Releases
GitHub
Find releases at https://github.com/microsoft/garnet/releases.
.NET Tool
Garnet can be installed as a .NET tool:
> dotnet tool install --global garnet-server
>
> garnet-server
NuGet
Find releases at https://www.nuget.org/packages/Microsoft.Garnet. The NuGet contains Garnet as a library for you to self-host in an application. This can be based on our GarnetServer application code available here. A minimal sample is shown below:
using Garnet;
try
{
using var server = new GarnetServer(args);
server.Start();
Thread.Sleep(Timeout.Infinite);
}
catch (Exception ex)
{
Console.WriteLine($"Unable to initialize server due to exception: {ex.Message}");
}
Docker
On Linux
docker run --network=host --ulimit memlock=-1 ghcr.io/microsoft/garnet
On Linux configured with basic authentication, replace {{replace_password_here}}
with your password
docker run --network=host --ulimit memlock=-1 ghcr.io/microsoft/garnet --auth Password --password {{replace_password_here}}
On MacOS
docker run -p 6379:6379 --ulimit memlock=-1 ghcr.io/microsoft/garnet
You can then use redis-cli
to connect to 127.0.0.1:6379
.
redis-cli
127.0.0.1:6379> set key value
OK
127.0.0.1:6379> get key
"value"
127.0.0.1:6379>
Dockerfile links:
Docker Compose
Make sure you have installed Docker and Docker Compose.
Download Garnet Docker Compose File
wget https://raw.githubusercontent.com/microsoft/garnet/main/docker-compose.yml
Launch Garnet
docker compose up -d
Confirm image is up
docker ps | grep garnet
# 249b468dcda1 ghcr.io/microsoft/garnet "/app/GarnetServer -…" 21 seconds ago Up 20 seconds 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp garnet-garnet-1
Log follow
docker logs -f garnet-garnet-1
Connect clients
As before, you can then use redis-cli
or any client library in your application to connect to 127.0.0.1:6379
.
redis-cli
127.0.0.1:6379> set key value
OK
127.0.0.1:6379> get key
"value"
127.0.0.1:6379>