Redis Sentinel configuration during bootstrap

Hello,

I’m using the latest at this time from myget (4.0.43) and have noticed that when I publish out to our cloud environment these logging statements show up.Read from the bottom towards the top and about the middle you’ll see what concerning me. Have there been any recent changes to the Redis Sentinel code that would do this? It had never done this before.

Initializing Application LMS Receiver v:1.0.0.0 took 968.75ms. No errors detected.
22 Jul 2015 08:00:43.281 AM
Registering OneWay service ‘PostmanService’ with request ‘Postman’
22 Jul 2015 08:00:43.281 AM
Registering Reply service ‘SwaggerApiService’ with request ‘SwaggerResource’
22 Jul 2015 08:00:43.281 AM
Registering Reply service ‘SwaggerResourcesService’ with request ‘SwaggerResources’
22 Jul 2015 08:00:43.156 AM
Registering OneWay service ‘NativeTypesService’ with request ‘TypesJava’
22 Jul 2015 08:00:43.156 AM
Registering OneWay service ‘NativeTypesService’ with request ‘TypesSwift’
22 Jul 2015 08:00:43.141 AM
Registering OneWay service ‘NativeTypesService’ with request ‘TypesTypeScript’
22 Jul 2015 08:00:43.141 AM
Registering OneWay service ‘NativeTypesService’ with request ‘TypesVbNet’
22 Jul 2015 08:00:43.141 AM
Registering OneWay service ‘NativeTypesService’ with request ‘TypesFSharp’
22 Jul 2015 08:00:43.141 AM
Registering OneWay service ‘NativeTypesService’ with request ‘TypesCSharp’
22 Jul 2015 08:00:43.141 AM
Registering Reply service ‘NativeTypesService’ with request ‘TypesMetadata’
22 Jul 2015 08:00:43.047 AM
Started Background Thread: RedisPubSubServer 1
22 Jul 2015 08:00:43.047 AM
Starting all Redis MQ Server worker threads…
22 Jul 2015 08:00:42.984 AM
Started Background Thread: RedisPubSubServer 1
22 Jul 2015 08:00:42.969 AM
New Redis Slaves: 10.248.14.97:26379, 10.248.13.243:26379, 10.248.8.35:26379
22 Jul 2015 08:00:42.969 AM
New Redis Masters: 10.248.14.97:26379, 10.248.13.243:26379, 10.248.8.35:26379
22 Jul 2015 08:00:42.953 AM
New Redis Slaves: 10.248.14.97:26379, 10.248.13.243:26379, 10.248.8.35:26379
22 Jul 2015 08:00:42.953 AM
New Redis Masters: 10.248.14.97:26379, 10.248.13.243:26379, 10.248.8.35:26379
22 Jul 2015 08:00:42.953 AM
New Redis Slaves: 10.248.8.35:6379, 10.248.13.243:6379
22 Jul 2015 08:00:42.953 AM
New Redis Masters: 10.248.14.97:6379
22 Jul 2015 08:00:42.953 AM
New Redis Slaves: 10.248.8.35:6379, 10.248.13.243:6379
22 Jul 2015 08:00:42.953 AM
New Redis Masters: 10.248.14.97:6379
22 Jul 2015 08:00:42.922 AM
Set up Redis Sentinel on ServiceStack.Redis.RedisEndpoint
22 Jul 2015 08:00:42.906 AM
Set up Redis Sentinel on ServiceStack.Redis.RedisEndpoint
22 Jul 2015 08:00:42.906 AM
Set up Redis Sentinel on ServiceStack.Redis.RedisEndpoint
22 Jul 2015 08:00:42.828 AM
Set up Redis Sentinel on ServiceStack.Redis.RedisEndpoint
22 Jul 2015 08:00:42.797 AM
Registering Reply service ‘SblPortalServices’ with request ‘SblPortalXml’
22 Jul 2015 08:00:42.797 AM
Registering Reply service ‘InternetServices’ with request ‘InternetXml’
22 Jul 2015 08:00:42.797 AM
Registering Reply service ‘DirectApiServices’ with request ‘DirectApiXml’
22 Jul 2015 08:00:42.766 AM
Registering Reply service ‘MyServices’ with request ‘Hello’

Here is the relavent code from the apphost file.

public class ReceiverAppHost : AppHostBase
{
    private readonly ILog _log = LogManager.GetLogger("LMS.Receiver.ReceiverAppHost");

    public ReceiverAppHost()
        : base("LMS Receiver v:{0}".Fmt(typeof(DirectApiServices).Assembly.GetName().Version), 
        typeof(DirectApiServices).Assembly)
    {
        // Routes 
        Routes
            .Add<InternetXml>("/Leads/Internet/", "POST", "LMS - Internet")
            .Add<DirectApiXml>("/Leads/DirectApi/", "POST", "LMS - DirectApi");

        // Validation - just scan the Assemblies
        var assemblies = new[] { typeof(LeadInformationValidator).Assembly };
        Container.RegisterValidators(assemblies);                   
    }

    public override void Configure(Container container)
    {
        try
        {
            var tier = ConfigUtils.GetAppSetting("Tier");

            //Redis
            var sentinelHosts = ConfigUtils.GetAppSetting("Redis:Sentinel:Hosts").Split(',');
            var sentinel = new RedisSentinel(sentinelHosts, "master");
            var redisManager = sentinel.Start();
            container.Register(redisManager);
            
            //Cache
            var cacheClient = container.Resolve<IRedisClientsManager>().GetCacheClient();
            container.Register(cacheClient);

            //MQ Broker
            QueueNames.SetQueuePrefix("{0}.".Fmt(tier));
            var mqService = new RedisMqServer(container.Resolve<IRedisClientsManager>())
            {
                DisablePriorityQueues = true
            };
            container.Register<IMessageService>(mqService);
            container.Register(mqService.MessageFactory);
            mqService.Start();
            
            //Mappers
            container.Register<ILeadMapper>(c => new LeadMapper());

            //Plugins
            Plugins.Add(new RazorFormat());
            Plugins.Add(new ValidationFeature());
            Plugins.Add(new SwaggerFeature());
            Plugins.Add(new PostmanFeature());
            Plugins.RemoveAll(x => x is MarkdownFormat);

            //Filters

            SetConfig(new HostConfig
            {
                HandlerFactoryPath = "api",
                DebugMode = true,
                DefaultContentType = MimeTypes.Json
            });
        }
        catch (Exception exception)
        {
            _log.Error("Exception in configure method of app host", exception);
        }


    }
}

RedisSentinel has been rewritten to comply with Redis Sentinel Guidance for client libraries.

What’s the issue? the extra log entries?

Yeah, they caught me off guard (compared to the older way in 4.0.42), can you briefly explain each of the relevant statements so I can understand whats happening.

In your opinion everything looks correct on the surface?

And BTW, thanks for the rewrite, Sentinel is the way to go.

It’s logging the info it gets back from the Sentinel Server. I’ve downgraded the Info logging to Debug in this commit.

The RedisEndpoint logging should also be more user friendly.

Wow, I just pulled source, you’ve been busy ALL month giving it a lot of love. I see that you’re using my little windows setup too, I know it’s not production ready but at least we can run Sentinel locally.

Yeah proper Redis Sentinel support (i.e. as per redis guidance) required refactoring the Resolving/Pooling behavior in all Client Managers.

Yep the Integration tests use a modified version of your Windows sentinel setup which can be started/stopped directly the redis-server processes in an Integration Test which makes testing things easier.

I’m only half way done with the July commits, and I’m sure I’ll have to re-read them again just to grok the changes, but I’m looking for validation of those original logging statements. There is nothing alarming going on during initialization of the Redis client, is there?

No, the “New Redis Masters/Slaves” are just part of the initialization of the resolver, but they’re not normally used for in Redis Sentinel since on each connection it asks Redis Sentinel what the active slaves/masters are and uses those. The master/slave hosts are used as a fallback if the sentinels don’t have any active master/slaves.

The “Set up Redis Sentinel…” messages are just RedisSentinel connecting to each Sentinel Hosts to discover what are all the active Sentinel Hosts that are currently available.

Demis,

Ahh, I see a pattern now as each instance is added (from 1 to 3 in my case)… I now know what a normal bootstrap looks like from a glance.

Regards,
Stephen