同一角色的实例之间的Azure网络通信 [英] Azure network communication between instances of the same role
问题描述
能否同一角色的多个角色实例可以通过从 RoleEnvironment
所有这些实例听了特定端点获取VIP(虚拟IP)地址互相交谈?如果是这样,则返回VIP可负载平衡应用到( RoleEnvironment
方法)实例本身调用者。
Can multiple role instances of the same role can talk to each other by obtaining VIP (Virtual IP) address for a specific endpoint listened by all those instances from RoleEnvironment
? If so, is returned VIP can be load balanced to the caller (of RoleEnvironment
methods) instance itself.
推荐答案
角色实例可以通过内部端点互相交谈。不同于输入端点,它们只对其他实例可见(不管作用)部署内
Role instances can talk to each other via internal endpoints. Unlike input endpoints, they are only visible to other instances within a deployment (regardless of the role).
直接对话,通过内部端点,完全绕开了外部VIP负载均衡。所以,如果你有,你试图连接到(比方说这就是你的REST服务驻留)三个工作角色的情况下,你所要做的跨越3个实例自己的负载平衡。
Talking directly, via internal endpoint, bypasses the external-VIP load balancer completely. So, if you have three worker role instances that you're trying to connect to (say that's where your REST service resides), you'd have to do your own load-balancing across the 3 instances.
内部端点的工作是一样的输入端点那么简单。首先设置一个:
Working with internal endpoints is just as straightforward as input endpoints. First set one up:
然后抢单随意。例如(由字的最原始意义上的):
Then grab one at random. For example (by the crudest sense of the word):
var random = new Random();
var role = RoleEnvironment.Roles["WorkerRole1"];
var instanceNumber = random.Next() % role.Instances.Count;
var ipendpoint = role.Instances[instanceNumber].InstanceEndpoints["myservice"].IPEndpoint;
var address = ipendpoint.Address;
var port = ipendpoint.Port;
请注意:您仍然可以接触到的任何角色的输入端点,从任何作用。在这一点上,你会进行负载平衡,就像从外部世界的任何其他业务。你会担心安全以及(而使用内部端点不这样做)。
Note: You can still reach out to an input endpoint on any role, from any role. At that point, you'll be load-balanced just like any other traffic coming from the outside world. And you'll have to worry about security as well (whereas with internal endpoints you don't).
这篇关于同一角色的实例之间的Azure网络通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!