Hi guys,
I’m using ServerEvents with Redis backplane, and this is my apphost
namespace Mares.Api.Server.Common
{
public class MaresAppHost : AppSelfHostBase
{
public MaresAppHost(Assembly[] assembliesWithServices)
: base("Mares API", assembliesWithServices)
{
MaresEnvironment.Instance.RegisterLicense();
}
public string HostUrl => $"http://*:{ApplicationVariables.Instance.APIPort}/";
public override void Configure(Container container)
{
ServiceEnvironment.Container = container;
Plugins.Add(new ServerEventsFeature());
Routes.AddFromAssembly(base.ServiceAssemblies.ToArray());
var redisHost = ApplicationVariables.Instance.RedisHost;
if (!string.IsNullOrEmpty(redisHost))
{
container.Register<IRedisClientsManager>(
new RedisManagerPool(redisHost));
container.Register<IServerEvents>(c =>
new RedisServerEvents(c.Resolve<IRedisClientsManager>()));
container.Resolve<IServerEvents>().Start();
}
SetConfig(new HostConfig
{
DebugMode = true,
EnableFeatures = Feature.All,
});
//Prevents Json serialized to add __type part on json string for anonymous types serialization
//Read this: -http://stackoverflow.com/questions/18842685/servicestack-sessions-doesnt-work-when-using-jsconfig-excludetypeinfo
JsConfig.ExcludeTypeInfo = true;
JsConfig.DateHandler = DateHandler.ISO8601;
}
}
}
the Redis instance is a Windows Service installed as described here
With this configuration there is no failover when the redis instance goes down. My goal is to have a kind of redis “cluster”, maybe using Sentinel, so my apphosts will connect to this cluster instead of the single redis instance.
Can I do it? if yes, can you please give me some links?
Best regards
Enrico