How to get Redis running on Azure?
Solution 1
- Download Redis for Windows - see the section 'Redis Service builds for Windows' on https://github.com/ServiceStack/ServiceStack.Redis. I ended up using the win64 version from dmajkic https://github.com/dmajkic/redis/downloads
- Create an Azure worker role, delete the default class (you don't need c# code at all). Add the file redis-server.exe from the downloaded redis source (the exe can be found in redis/src).
-
In the service definition file add the following config
<WorkerRole name="my.Worker" vmsize="Small"> <Runtime executionContext="limited"> <EntryPoint> <ProgramEntryPoint commandLine="redis-server.exe" setReadyOnProcessStart="true" /> </EntryPoint> </Runtime> <Imports> <Import moduleName="Diagnostics" /> <Import moduleName="RemoteAccess" /> <Import moduleName="RemoteForwarder" /> </Imports> <Endpoints> <InternalEndpoint name="Redis" protocol="tcp" port="6379" /> </Endpoints> </WorkerRole>
-
You can refer to the redis server from your web role using the following
var ipEndpoint = RoleEnvironment.Roles["my.Worker"].Instances[0].InstanceEndpoints["Redis"].IPEndpoint; host = string.Format("{0}:{1}", ipEndpoint.Address, ipEndpoint.Port);
Hope that helps.
Solution 2
FYI, the above-mentioned Redis on Windows project from MS Open Tech now has an Azure installer available, which makes it easy to get Redis up and running on a PaaS worker role. Here's a detailed tutorial: http://ossonazure.interoperabilitybridges.com/articles/how-to-deploy-redis-to-windows-azure-using-the-command-line-tool (Full disclosure: I'm on the MS Open Tech team.)
Solution 3
There is MS Open Tech: Redis on Windows project. Redis on Windows is available on GitHub (https://github.com/MSOpenTech/redis) however still not labelled as ready for production yet.
Another post is an example of application using Redis:"SignalR with Redis Running on a Windows Azure Virtual Machine"
FNMT8L9IN82
.Net Developer since 2004. Got a Master of IT from Swinburne Uni, Melbourne AU.
Updated on June 15, 2022Comments
-
FNMT8L9IN82 almost 2 years
I have seen several references to people running Redis on Azure, but no implementation or any sort of 'howto' on it. Has anyone seen such an example?
-
FNMT8L9IN82 about 12 yearsAwesome! Thank you very, very much!
-
JP Hellemons about 11 yearsIt would be nice to have a small GUI (WPF application) for
RedisInstWA.exe
to make it more accessible to people to run Redis on Azure. I have used the linux virtual machine method because of my limited knowledge about the azure config files. But still curious what performs better, PaaS worker role or centOs virtual machine. -
Doug Mahugh almost 11 yearsHi JP, just saw your comment. Great idea about a GUI front end -- would you be willing to log it as a request on the Guthub repo? (github.com/MSOpenTech/redis/issues) I'll follow up to try to make it happen. As for perf comparisons between PaaS and IaaS, we'll be looking into that but don't have results yet.
-
JP Hellemons almost 11 yearsSure, will do! github.com/MSOpenTech/redis/issues/50 p.s. i didn't got it to work with the tutorial so I ended up using a virtual linux machine with this tutorial: blogs.msdn.com/b/tconte/archive/2012/06/08/…