Web Application not working with Redis installed on CentOS
-
We are currently running Redis 2.8.19 on Windows (choice made by predecessors), and I'm looking to try to run this on Linux instead (3.2.10-2 is what was installed from the epel repo). From what I understand Redis is functioning as a cache as the database used for our application is SQL Server.
From what I can see when comparing
/etc/redis.conf
on the Linux installation with the configuration file on the Windows installation, it appears that all of the default values were used on the Windows installation.To test, in the web.config file, I changed the
<add key="RedisEndPoint"
value to the IP address of the CentOS Redis server with port 6379. Once I make that change, and restart the site within IIS manager, a server application error is thrown. Below is the information from the warning in the Event Viewer.Event code: 3005 Event message: An unhandled exception has occurred. Event time: 12/19/2017 9:31:50 AM Event time (UTC): 12/19/2017 2:31:50 PM Event ID: 9920900c45cc46fa90d5edad7884593c Event sequence: 2 Event occurrence: 1 Event detail code: 0 Application information: Application domain: /LM/W3SVC/1/ROOT-9-131581674906414217 Trust level: Full Application Virtual Path: / Application Path: C:\inetpub\PathToApplication\ Machine name: DEVTESTWEB Process information: Process ID: 11932 Process name: w3wp.exe Account name: IIS APPPOOL\Insight Exception information: Exception type: HttpException Exception message: It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Func`1 multiplexerFactory, TextWriter log) at StackExchange.Redis.ConnectionMultiplexer.Connect(ConfigurationOptions configuration, TextWriter log) at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at Insight.Downtime.SaveToRedis(DateTime down, DateTime up, Int32 warningMinutes) in C:\code\Insight\src\Insight\Classes\Downtime.cs:line 77 Request information: Request URL: https://devtest.a-closer-look.com:443/ Request path: / User host address: 192.XXX.XXX.114 User: Is authenticated: False Authentication Type: Thread account name: IIS APPPOOL\Insight Thread information: Thread ID: 671 Thread account name: IIS APPPOOL\Insight Is impersonating: False Stack trace: at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) Custom event details:
I know that I've opened tcp port 6379 on the firewall of the CentOS machine. It looks like the IIS server is making a connection to my CentOS Redis server, as seen by this except from running
tail -f
on the Redis log while trying to load the website.11137:M 19 Dec 09:31:24.743 - Accepted 192.XXX.XXX.13:42627 11137:M 19 Dec 09:31:24.744 - Accepted 192.XXX.XXX.13:42628 11137:M 19 Dec 09:31:27.053 - 0 clients connected (0 slaves), 754784 bytes in use 11137:M 19 Dec 09:31:29.834 - Accepted 192.XXX.XXX.13:42629 11137:M 19 Dec 09:31:29.839 - Accepted 192.XXX.XXX.13:42630 11137:M 19 Dec 09:31:32.065 - 0 clients connected (0 slaves), 754784 bytes in use 11137:M 19 Dec 09:31:34.909 - Accepted 192.XXX.XXX.13:42631 11137:M 19 Dec 09:31:34.909 - Accepted 192.XXX.XXX.13:42632 11137:M 19 Dec 09:31:37.075 - 0 clients connected (0 slaves), 754784 bytes in use 11137:M 19 Dec 09:31:42.087 - 0 clients connected (0 slaves), 754784 bytes in use
I've tried having
protected-mode yes
enabled and commented out in/etc/redis.conf
. I've also tried havingsetenforce
set to 0, just to see if SELinux was a problem. On a side noteprotected-mode
isn't a parameter in the configuration file on with the Windows installation.I'm at a disadvantage trying to troubleshoot this because of lack of experience with Redis and also not being a dev for our web application, but I figure I'd post it here to see if you folks with experience with Redis have any suggestions about configuration.
-
Is SELinux enabled?
-
It is. Though, I did set enforcing to permissive
setenforce 0
, which didn't make a difference, I'll disable it and see what happens. -
Don't test Redis from your application. Test with a Redis testing tool like Redisping before trying the app.
-
Getting somewhere. Commenting out
protected-mode
in the config wasn't enough. I had to set it tono
. Now to re-enable SELinux and see if this still works. -
Yep, setting
protected-mode
tono
did the trick. SELinux was re-enabled and stuff works.Now the question is can I get stuff to work with the most current version of Redis and on Fedora.