[英]Setting up Redis on Azure cloud service worker role
I'm creating a cloud service where I have a worker role running some heavy processing in the background, for which i would like a Redis instance to be running locally on the worker. 我正在创建一个云服务,其中有一个工作人员角色在后台运行一些繁重的处理,为此,我希望Redis实例在该工作人员本地运行。
What i want to do is set up the worker role project in a way that the Redis instance is installed/configured when the worker is deployed. 我要做的是以部署工作人员时安装/配置Redis实例的方式设置工作人员角色项目。
The redis database would be cleared on every job startup. Redis数据库将在每次作业启动时清除。
I've looked at the MSOpenTech redis for windows with nuget installation, but i'm unsure how i would get this working on the worker role instance. 我已经看过了MSOpenTech的Redis用的NuGet安装Windows,但我不能确定我怎么会得上的工人角色实例这个工作。 Is there a smart way to set it up, or would it be by command-line calls? 是否有聪明的方法来设置它,还是通过命令行调用来设置它?
Thanks. 谢谢。
I'm not expecting to get this marked as an answer, but just wanted to add the add that this is a really bad approach for a real-world deployment . 我不希望将其标记为答案,而只是想添加一个补充,即对于实际部署而言 ,这是一种非常糟糕的方法 。
I can understand why you might want to do this from a learning perspective, however in a production environment its a really bad idea, for several reasons: 我可以从学习的角度理解为什么要这样做,但是在生产环境中,这确实是个坏主意,原因有以下几个:
I would recommend that you take a look at the Azure Redis Cache SaaS offering (see http://azure.microsoft.com/en-gb/services/cache/ ) which offers a fully managed, highly-available, implementation of the Redis Cache. 我建议您看一下Azure Redis缓存SaaS产品(请参阅http://azure.microsoft.com/en-gb/services/cache/ ),该产品提供了Redis的完全托管的,高度可用的实现。缓存。 I use it on several projects and can highly recommend it. 我在几个项目上使用它,可以高度推荐它。
To install any software on a worker role instance, you'd need to set this up to happen as a startup task. 要在辅助角色实例上安装任何软件,您需要将其设置为启动任务。
You'll reference startup tasks in your ServiceDefinition.csdef file, in the <Startup>
element, with a reference to your command file which installs whatever software you want (such as Redis). 您将在ServiceDefinition.csdef文件中的<Startup>
元素中引用启动任务,并引用命令文件来安装所需的任何软件(例如Redis)。
I haven't tried installing Redis in a worker role instance, so I can't comment about whether this will succeed. 我没有尝试在辅助角色实例中安装Redis,因此无法评论它是否会成功。 And you'll also need to worry about opening the right ports (whether external- or internal-facing), and scaling (eg what happens when you scale to two worker role instances, both running redis?). 而且,您还需要担心打开正确的端口(无论是面向外部的端口还是面向内部的端口)并进行扩展(例如,当扩展到两个都运行redis的辅助角色实例时会发生什么情况?)。 My answer is specific to how you install software on a role instance. 我的答案是特定于您如何在角色实例上安装软件的。
More info on startup task setup is here . 有关启动任务设置的更多信息,请参见此处 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.