如何使Redis在Azure上运行? [英] How to get Redis running on Azure?
本文介绍了如何使Redis在Azure上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经看到一些关于在Azure上运行Redis的人的参考,但是没有实现或任何形式的方法".有人看到过这样的例子吗?
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?
推荐答案
- 下载Windows的Redis-请参见 https://github.com/ServiceStack/ServiceStack上的"Redis Service builds for Windows"部分. .Redis .我最终使用了dmajkic的win64版本 https://github.com/dmajkic/redis/downloads
- 创建一个Azure辅助角色,删除默认类(根本不需要c#代码).从下载的redis源中添加文件redis-server.exe(可以在redis/src中找到该exe).
-
在服务定义文件中,添加以下配置
- 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>
您可以使用以下内容从Web角色引用Redis服务器
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);
希望有帮助.
这篇关于如何使Redis在Azure上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文