How to get Redis running on Azure?

azure, redis

Solution

- 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.

Problem

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?

Original source

Related problems