HOWTO获得Redis的上Azure上运行? [英] Howto get Redis running on Azure?
本文介绍了HOWTO获得Redis的上Azure上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我见过多次提到在Azure上运行Redis的人,但没有实现或任何种类上HOWTO的。有没有人见过这样的例子吗?
解决方案
- 下载的Redis的Windows - 请参见Redis的服务构建的Windows在<一个href=\"https://github.com/ServiceStack/ServiceStack.Redis\">https://github.com/ServiceStack/ServiceStack.Redis.最后我用从dmajkic <一个Win64中的版本href=\"https://github.com/dmajkic/redis/downloads\">https://github.com/dmajkic/redis/downloads
- 创建一个Azure的辅助角色,删除默认类(你不需要C#code在所有)。从下载redis的源文件添加redis的-SERVER.EXE(exe文件可以在Redis的/ src目录中找到)。
-
在服务定义文件中添加以下配置
&LT; WorkerRole NAME =my.Workervmsize =小&GT;
&LT;运行时的ExecutionContext =有限&GT;
&LT;&入口点GT;
&LT; ProgramEntryPoint命令行=Redis的-SERVER.EXEsetReadyOnProcessStart =真/&GT;
&LT; /入口点&GT;
&LT; /运行&GT;
&LT;进口&GT;
&LT;进口MODULENAME =诊断/&GT;
&LT;进口MODULENAME =远程访问/&GT;
&LT;进口MODULENAME =RemoteForwarder/&GT;
&LT; /进口&GT;
&LT;&端点GT;
&LT; InternalEndpoint NAME =Redis的协议=TCP端口=6379/&GT;
&LT; /端点&GT;
&LT; / WorkerRole&GT; -
您可以用指从您的网络角色Redis的服务器以下
VAR ipEndpoint = RoleEnvironment.Roles [my.Worker]实例[0] .InstanceEndpoints [的Redis] IPEndpoint。;
主机=的String.Format({0}:{1},ipEndpoint.Address,ipEndpoint.Port);
希望有所帮助。
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?
解决方案
- 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.
这篇关于HOWTO获得Redis的上Azure上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文