2012-04-13 80 views
35

我已经看到几个人在Azure上运行Redis的引用,但没有实现或任何类型的“howto”。有没有人看过这样的例子?如何让Redis在Azure上运行?

+0

请链接到这些参考? – kristianp 2012-04-13 14:04:04

+0

查看关于此问题的评论:http://stackoverflow.com/questions/5766815/does-azure-support-things-like-mongodb-and-redis – noocyte 2012-04-16 05:12:33

+1

现在,Microsoft现在将Redis作为Azure中的一项服务运行: http://azure.microsoft.com/en-us/documentation/services/cache/#redis – noocyte 2014-09-24 12:51:47

回答

47
  1. 下载Redis for Windows - 请参阅https://github.com/ServiceStack/ServiceStack.Redis上的'Redis Service for Windows'一节。我结束了使用dmajkic的win64版本https://github.com/dmajkic/redis/downloads
  2. 创建一个Azure辅助角色,删除默认类(根本不需要c#代码)。从下载的redis源文件中添加文件redis-server.exe(该文件可以在redis/src中找到)。
  3. 在服务定义文件从您的Web角色使用以下

    var ipEndpoint = RoleEnvironment.Roles["my.Worker"].Instances[0].InstanceEndpoints["Redis"].IPEndpoint; 
    host = string.Format("{0}:{1}", ipEndpoint.Address, ipEndpoint.Port); 
    

希望帮助添加以下配置

<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> 
  • 你可以参考Redis的服务器。

  • +0

    太棒了!非常非常感谢你! – noocyte 2012-04-17 12:19:27

    14

    仅供参考,上述从MS​​开放技术的Windows项目现在是否有可用Azure的安装程序,这使得它很容易得到的Redis起来的Redis并在PaaS工作者角色上运行。这里有一个详细的教程:http://ossonazure.interoperabilitybridges.com/articles/how-to-deploy-redis-to-windows-azure-using-the-command-line-tool(全面披露:我在MS开放技术团队。)

    +0

    为RedisInstWA.exe提供一个小型GUI(WPF应用程序)让人们更容易在Azure上运行Redis,这将是一件好事。由于我对azure配置文件的知识有限,因此我使用了linux虚拟机方法。但仍然好奇PaaS的工作角色或centos虚拟机的性能会更好。 – 2013-04-08 12:48:31

    +0

    嗨JP,刚刚看到你的评论。关于GUI前端的好主意 - 您是否愿意将它作为Guthub回购请求记录下来? (https://github.com/MSOpenTech/redis/issues)我会继续努力实现目标。至于PaaS和IaaS之间的性能比较,我们将研究这一点,但还没有结果。 – 2013-06-17 15:18:07

    +0

    当然,会做! https://github.com/MSOpenTech/redis/issues/50 p.s.我没有得到它的教程,所以我最终使用本教程使用虚拟linux机器:http://blogs.msdn.com/b/tconte/archive/2012/06/08/running-redis-在-A-的CentOS Linux的虚拟机,在窗口,azure.aspx – 2013-06-18 08:29:49