Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Redis running on Azure? [closed]

Tags:

redis

azure

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?

like image 672
noocyte Avatar asked Apr 13 '12 12:04

noocyte


People also ask

How do I know if Redis is running?

you can do it by this way. $redis = new Redis(); $redis->connect('127.0. 0.1', 6379); echo $redis->ping(); and then check if it print +PONG , which show redis-server is running.

Can we stop Azure Redis cache?

For the time being, there is no deactivate or disable command.

How do I test Redis cache in Azure?

You can use redis-benchmark.exe to load test your Redis server. Ensure that the load testing client and the Azure Cache for Redis are in the same region. Use redis-cli.exe and monitor the cache using the INFO command. If your load is causing high memory fragmentation, you should scale up to a larger cache size.

How do I know if Redis cache is working?

You should enter an interactive session where you see every command sent to redis. Reload your page and on your terminal you should see some SET* operations storing the cache data. Reload again and if your cache works, you should see some GET* operations retrieving the cached data.


1 Answers

  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
  2. 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).
  3. 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> 
  4. 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.

like image 166
brian.stackoverflow Avatar answered Sep 23 '22 13:09

brian.stackoverflow