![]() |
VOOZH | about |
dotnet add package Microsoft.Orleans.Clustering.Redis --version 10.2.0
NuGet\Install-Package Microsoft.Orleans.Clustering.Redis -Version 10.2.0
<PackageReference Include="Microsoft.Orleans.Clustering.Redis" Version="10.2.0" />
<PackageVersion Include="Microsoft.Orleans.Clustering.Redis" Version="10.2.0" />Directory.Packages.props
<PackageReference Include="Microsoft.Orleans.Clustering.Redis" />Project file
paket add Microsoft.Orleans.Clustering.Redis --version 10.2.0
#r "nuget: Microsoft.Orleans.Clustering.Redis, 10.2.0"
#:package Microsoft.Orleans.Clustering.Redis@10.2.0
#addin nuget:?package=Microsoft.Orleans.Clustering.Redis&version=10.2.0Install as a Cake Addin
#tool nuget:?package=Microsoft.Orleans.Clustering.Redis&version=10.2.0Install as a Cake Tool
Microsoft Orleans Clustering for Redis provides cluster membership functionality for Microsoft Orleans using Redis. This allows Orleans silos to coordinate and form a cluster using Redis as the backing store.
To use this package, install it via NuGet:
dotnet add package Microsoft.Orleans.Clustering.Redis
using Microsoft.Extensions.Hosting;
using Orleans.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
var builder = Host.CreateApplicationBuilder(args)
.UseOrleans(siloBuilder =>
{
siloBuilder
// Configure Redis as the membership provider
.UseRedisClustering(options =>
{
options.ConnectionString = "localhost:6379";
options.Database = 0;
});
});
var host = builder.Build();
await host.StartAsync();
// Get a reference to a grain and call it
var client = host.Services.GetRequiredService<IClusterClient>();
var grain = client.GetGrain<IHelloGrain>("user123");
var response = await grain.SayHello("Redis");
// Print the result
Console.WriteLine($"Grain response: {response}");
// Keep the host running until the application is shut down
await host.WaitForShutdownAsync();
using Microsoft.Extensions.Hosting;
using Orleans.Hosting;
using Orleans;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
var clientBuilder = Host.CreateApplicationBuilder(args)
.UseOrleansClient(builder =>
{
builder
// Configure Redis as the gateway provider
.UseRedisGatewayListProvider(options =>
{
options.ConnectionString = "localhost:6379";
options.Database = 0;
});
});
var host = clientBuilder.Build();
await host.StartAsync();
var client = host.Services.GetRequiredService<IClusterClient>();
// Get a reference to a grain and call it
var grain = client.GetGrain<IHelloGrain>("user123");
var response = await grain.SayHello("Redis Client");
// Print the result
Console.WriteLine($"Grain response: {response}");
// Keep the host running until the application is shut down
await host.WaitForShutdownAsync();
You can configure Orleans Redis clustering using Microsoft.Extensions.Configuration (such as appsettings.json) instead of configuring it in code. When using this approach, Orleans will automatically read the configuration from the Orleans section.
Note: You can use either
"ProviderType": "Redis"or"ProviderType": "AzureRedisCache"- both are supported and functionally equivalent.
{
"ConnectionStrings": {
"redis": "localhost:6379"
},
"Orleans": {
"ClusterId": "my-cluster",
"ServiceId": "MyOrleansService",
"Clustering": {
"ProviderType": "Redis",
"ServiceKey": "redis"
}
}
}
{
"ConnectionStrings": {
"redis": "localhost:6379"
},
"Orleans": {
"ClusterId": "my-cluster",
"ServiceId": "MyOrleansService",
"Clustering": {
"ProviderType": "Redis",
"ServiceKey": "redis"
}
}
}
For applications using .NET Aspire, consider using the .NET Aspire Redis integration which provides simplified Redis configuration, automatic service discovery, health checks, and telemetry. The Aspire integration automatically configures connection strings that Orleans can consume via the configuration system.
using Microsoft.Extensions.Hosting;
using Orleans.Hosting;
using Microsoft.Extensions.DependencyInjection;
var builder = Host.CreateApplicationBuilder(args);
// Add service defaults (Aspire configurations)
builder.AddServiceDefaults();
// Add Redis via Aspire client integration
builder.AddKeyedRedisClient("redis");
// Add Orleans
builder.UseOrleans();
var host = builder.Build();
await host.StartAsync();
// Get a reference to a grain and call it
var client = host.Services.GetRequiredService<IClusterClient>();
var grain = client.GetGrain<IHelloGrain>("user123");
var response = await grain.SayHello("Aspire Redis");
Console.WriteLine($"Grain response: {response}");
await host.WaitForShutdownAsync();
This example assumes your AppHost project has configured Redis like this:
// In your AppHost/Program.cs
var builder = DistributedApplication.CreateBuilder(args);
var redis = builder.AddRedis("redis");
var orleans = builder.AddOrleans("orleans")
.WithClustering(redis);
builder.AddProject<Projects.MyOrleansApp>("orleans-app")
.WithReference(orleans);
builder.Build().Run();
For more comprehensive documentation, please refer to:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on Microsoft.Orleans.Clustering.Redis:
| Package | Downloads |
|---|---|
|
Cszy.Orleans
Cszy.Orleans是Cszy应用框架对Orleans的封装 |
|
|
VaultForce.Application
shared resources |
|
|
SiloX.Orleans.Clustering.Redis
Redis clustering module that for Microsoft Orleans. |
|
|
Scxy.Baiyi.Silo
Package Description |
|
|
Scxy.Baiyi.Client
Package Description |
Showing the top 2 popular GitHub repositories that depend on Microsoft.Orleans.Clustering.Redis:
| Repository | Stars |
|---|---|
|
microsoft/aspire-samples
Browse the sample apps demonstrating Aspire integration across C#, JavaScript, TypeScript, Python, Go, containers, databases, cloud, AI, and observability scenarios.
|
|
|
ss14Starlight/space-station-14
An open source project aimed at creating unique mechanics and a pleasant game atmosphere in the game Space Station 14
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.2.0 | 1,213 | 6/12/2026 |
| 10.1.1-preview.1 | 82 | 5/13/2026 |
| 10.1.0 | 33,488 | 4/14/2026 |
| 10.0.1 | 113,335 | 2/7/2026 |
| 10.0.0 | 16,868 | 1/20/2026 |
| 10.0.0-rc.2 | 5,172 | 12/31/2025 |
| 9.2.1 | 193,890 | 7/16/2025 |
| 9.2.0 | 2,958 | 7/14/2025 |
| 9.2.0-preview3 | 8,577 | 6/10/2025 |
| 9.2.0-preview2 | 616 | 6/4/2025 |
| 9.2.0-preview1 | 3,823 | 4/4/2025 |
| 9.1.2 | 118,192 | 2/13/2025 |
| 9.0.1 | 74,799 | 11/23/2024 |
| 9.0.0 | 9,904 | 11/14/2024 |
| 8.2.0 | 140,028 | 7/12/2024 |
| 8.2.0-preview1 | 483 | 5/22/2024 |
| 8.1.0 | 116,208 | 4/17/2024 |
| 7.2.7 | 1,952 | 10/15/2024 |