微服务,amqp和服务注册表/发现 [英] Microservice, amqp and service registry / discovery

查看:184
本文介绍了微服务,amqp和服务注册表/发现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究微服务架构,实际上我在想什么.

I m studying Microservices architecture and I m actually wondering something.

我可以使用(反向)服务发现使请求能够在基于REST的微服务上运行,这一点我还可以.我需要知道在哪里进行服务(或至少在服务器群集的前端)来发出请求.因此,在这种情况下能够发现ip:port是有意义的.

I m quite okay with the fact of using (back) service discovery to make request able on REST based microservices. I need to know where's the service (or at least the front of the server cluster) to make requests. So it make sense to be able to discover an ip:port in that case.

但是我想知道在处理AMQP(仅基于基础,没有HTTP可能的调用)时使用服务注册表/发现的目的是什么?

But I was wondering what could be the aim of using service registry / discovery when dealing with AMQP (based only, without HTTP possible calls) ?

我的意思是,使用AMQP就像我需要它,我希望有人来回答我"一样,我不必知道谁是向我发送回复的服务器.

I mean, using AMQP is just like "I need that, and I expect somebody to answer me", I dont have to know who's the server that sent me back the response.

那么将服务注册表/发现与基于AMQP的微服务一起使用的目的是什么?

So what is the aim of using service registry / discovery with AMQP based microservice ?

感谢您的帮助

推荐答案

AMQP(实际上是任何MOM)为进程进行通信提供了一种方法,而不必考虑实际的IP地址,通信安全性,路由以及其他问题.这并不一定意味着任何进程都可以信任甚至不知道有关与其通信的进程的任何信息.

AMQP (any MOM, actually) provides a way for processes to communicate without having to mind about actual IP addresses, communication security, routing, among other concerns. That does not necessarily means that any process can trust or even has any information about the processes it communicates with.

消息队列确实解决了一半的过程:如何访问远程服务.但是他们没有解决另一半:哪种服务对我来说是正确的.换句话说,哪个服务:

Message queues do solve half of the process: how to reach the remote service. But they do not solve the other half: which service is the right one for me. In other words, which service:

  • 有我需要的资源
  • 可以信任(托管在可靠的服务器上,具有令人满意的服务实现,并且位于当地法律与您的要求兼容的国家,等等)
  • 收取您要支付的费用(尽管人们很少谈论微服务的费用)
  • 将在处理服务所需的整个时间段内出现-请记住,服务器变得越来越不稳定.一些服务器实际上是可以持续几分钟的容器.

这两个问题几乎是线性独立的.为了解决第二种问题,您在网格计算中拥有资源代理.为了确保正确管理上述最后一项,还进行了资源分配.

Those two problems are almost linearly independent. To solve the second kind of problems, you have resource brokers in Grid computing. There is also resource allocation in order to make sure that the last item above is correctly managed.

还有一些替代策略,例如多播使用服务的意图并等待提供的回复.例如,在这种情况下,您可能需要进行反向拍卖.

There are some alternative strategies such as multicasting the intention to use a service and waiting for replies with offers. You may have reverse auction in such a case, for instance.

简而言之,经验法则是,如果您不了解要使用哪种服务(硬编码或在某些配置文件中)的先验知识,则您的代理将必须进行协商,其中包括动态服务发现

In short, the rule of thumb is that if you do not have an a priori knowledge about which service you are going to use (hardcoded or in some configuration file), your agent will have to negotiate, which includes dynamic service discovery.

这篇关于微服务,amqp和服务注册表/发现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆