Skip to content

Cluster membership provider for Microsoft Orleans that uses Redis

License

Notifications You must be signed in to change notification settings

oleggolovkov/Orleans.Clustering.Redis

 
 

Repository files navigation

Orleans.Clustering.Redis

Orleans membership provider for Redis

Build Status

Orleans is a framework that provides a straight-forward approach to building distributed high-scale computing applications, without the need to learn and apply complex concurrency or other scaling patterns.

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.

StackExchange.Redis StackExchange.Redis is a high performance general purpose redis client for .NET languages (C# etc).

Orleans.Clustering.Redis is a package that uses Redis as a backend for cluster membership, making it easy to run Orleans clusters dynamically.

TL;DR

If you want to quickly test it, clone this repo and go to the Samples Directory for instructions on how to run a sample cluster.

Overview

Redis is a straight key/value store. Membership data is stored into the key [clusterid.serviceid] as a hash.

Installation

Installation is performed via NuGet

From Package Manager:

PS> Install-Package Orleans.Clustering.Redis

.Net CLI:

# dotnet add package Orleans.Clustering.Redis

Configuration

A functional Redis database is required for this provider to work.

Silo

Tell Orleans runtime that we are going to use Redis as our Cluster Membership Provider:

var silo = new SiloHostBuilder()
        ...
        .UseRedisMembership(opt =>
        {
            opt.ConnectionString = "host:port";
            opt.Database = 0;
        })
        ...
        .Build();

ConnectionString tells the connector where to find the Redis database.

Database is an integer which tells the membership table which database to get after connecting to the Redis service.

More information on connection string configuration can be found at on the StackExchange.Redis driver site (https://stackexchange.github.io/StackExchange.Redis/Configuration.html).

Client

Now that our silo is up and running, the Orleans client needs to connect to the Redis database to look for Orleans gateways.

var client = new ClientBuilder()
        ...
        .UseRedisMembership(opt =>
        {
            opt.ConnectionString = "host:port";
            opt.Database = 0;
        })
        ...
        .Build();

At the moment the gateway list is provided by the underlying membership provider directly.

Enjoy your Orleans application running without need to specify membership manually!

About

Cluster membership provider for Microsoft Orleans that uses Redis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%