天道酬勤,学无止境

microservices

Microservices with shared database? using multiple ORM's? [closed]

问题 关闭。 这个问题是基于意见的。 它目前不接受答案。 想改进这个问题? 更新问题,以便可以通过编辑这篇文章用事实和引用来回答它。 1 年前关闭。 改进这个问题 我正在学习微服务,我将使用微服务架构构建一个项目。 问题是,我的一个队友想要为所有服务使用一个数据库,共享所有表以便“数据不会重复”,每个服务都将使用不同的框架和语言构建,例如 django 和 rails,它们使用非常不同的 ORM标准。 什么是正确的方法? 因为我认为使用一个数据库将涉及大量“破解” ORM 以使其正常工作。 回答1 如果所有服务共享相同的数据库表,您不太可能从微服务架构中受益。 这是因为您有效地紧密耦合服务。 如果数据库表发生更改,所有服务都必须更改。 您必须了解,微服务架构的全部原因是减少开发团队之间的依赖关系,并允许他们通过快速发布独立前进。 以下是亚马逊首席技术官 Werner Vogels 的一句话(亚马逊开创了许多微服务风格的架构): 对我们来说,面向服务意味着用对数据进行操作的业务逻辑封装数据,并且只能通过已发布的服务接口进行访问。 不允许从服务外部直接访问数据库,并且服务之间不存在数据共享。 有关更多信息,请阅读此和此。 2021年更新: 一些评论者指出,共享一个物理数据库可能是可以的,例如通过在同一个数据库中为不同的服务使用不同的表或模式。 这当然是可能的

2022-05-16 18:47:04    分类:技术分享    database   database-design   orm   architecture   microservices

How to build front end for Microservices

问题 回答1 让我尝试直接回答您的 2 个问题,而不讨论任何一种方法。 这将如何实施? 如果您使用 MV* 模式,则可以使用模块化 Web 应用程序。 AngularJS 和 ReactJS 都支持构建模块化应用程序并通过 webpack 或 requireJs 按需加载模块。 由于您的 UI 由来自不同微服务的片段组成,因此您可能需要反向代理和一些 CDN 或缓存,以通过将客户端请求管理到单个主机(域)来加速页面加载。 如果我想为 Android 和 iOS 应用程序提供服务怎么办? 原生应用程序需要一个 API 层,您可以将微服务整合到一个 API 网关中,甚至可以在移动应用程序和实际微服务之间开发一个中介 API,以仅公开实际后端的一个简单子集。

2022-05-16 04:31:04    分类:技术分享    user-interface   architecture   microservices

Is it OK to pass on OAuth Access Token between services?

问题 在 SSO/OAuth/微服务的上下文中考虑以下场景: 用户使用 OAuth 的隐式流程成功登录到 Web 应用程序。 Web 应用程序从服务 A和服务 B请求一些数据,传递用户的访问令牌以授权这两个请求。 服务 A还调用服务 B (传递相同的访问令牌!)以构建对初始 Web 应用请求的响应。 现在,可以将用户的访问令牌从服务 A传递给服务 B吗? 或者服务 A是否应该使用“客户端凭据”授权来获取自己的访问令牌以授权调用服务 B ? 更新: 请假设这两个服务都属于同一个组织并且都信任同一个授权服务器。 此外,这两个服务都位于验证访问令牌的同一个 API 网关后面。 回答1 这取决于谁在控制 Web 应用程序,服务 A 和服务 B。如果它们都由同一方运行,则传递令牌没有问题,因为它位于同一个安全域中。 但是,如果服务 B 由第三方运行,那么事情就会变得有问题,因为服务 B 的管理员可以获取访问令牌并调用服务 A,就好像它是您的 Web 应用程序一样,可能会访问它不应该访问的资源. 您还会注意到,如果服务 A 和服务 B 由 2 个不同的方拥有,除了您之外,您的 Web 应用程序还应该分别获取两个不同的访问令牌来调用服务 A 和服务 B,以防止出现相同的安全问题。 所以答案真的是:这取决于谁在控制什么,即令牌是否跨越管理/安全域。 回答2 我看到的方式是,如果您有 2

2022-05-15 07:10:08    分类:技术分享    oauth   oauth-2.0   authorization   access-token   microservices

What is Rust strategy to uncommit and return memory to the operating system?

Allocate memory on heap is an expensive operation and so some programming languages avoid to give it back to the operating system, even if the allocated memory is not being used anymore. But for many scenarios, for example microservices running on cloud, you would to like to have low memory usage, otherwise the bill can be quite high. So in these cases it's really important to release the memory after it is not being used. What is Rust default strategy to uncommit and return memory to the operating system? How can that be changed?

2022-05-03 06:27:59    分类:问答    memory   memory-management   rust   microservices

Linking a docker container a subdirectory of another one

I am trying to setup multiple docker containers that can be accessed through one main container. For example: http://localhost:80 is the main container http://localhost:80/site1 is a separate container http://localhost:80/site2 is a separate container again I know that the --link flag has been deprecated and the new way of doing things is by using the --network flag. When I use the --link (for testing) I see an entry of the container I am linking to in the hosts file. That is where I am stuck. So I would like to set the above scenario up using the docker --networking option. Usage case: /Site1

2022-05-02 20:39:54    分类:问答    docker   networking   subdomain   microservices

Authentication between microservice approach

I am currently building an API based around a microservices architecture. I am using JWT to authenticate users. I understand that when a user sends a login request a JWT containing the users identity and their roles/permissions etc is returned. This token is then sent with the users subsequent requests to tell the server who is sending the request. I think this is the correct understanding. In a normal monolithic architecture this works well as explained. How can I transfer this to a microservices architecture to establish trust between microservices. I could forward the users JWT to

2022-05-02 18:39:14    分类:问答    authentication   jwt   microservices

JHipster 7.1.0: Failed to use jdl-import, throws Error looking for otherEntity User at

Im using java Openjdk 11.0.11, JHipster 7.1.0 and node v14.17.3 Im creating a simple microservice (one backend and one gateway) but JHipster fails to create using the jdl command (jdl-import), it throws Error: Error looking for otherEntity User at Tag,Product,Blog,Post at /Users/carestra/.nvm/versions/node/v14.17.3/lib/node_modules/generator-jhipster/generators/entity/index.js:560:19 at Array.forEach (<anonymous>) at EntityGenerator.loadRelationships (/Users/carestra/.nvm/versions/node/v14.17.3/lib/node_modules/generator-jhipster/generators/entity/index.js:556:36) at Object.<anonymous> (/Users

2022-05-02 18:04:52    分类:问答    microservices   jhipster

We have Anguler2 App, thinking to use AWS API Gateway as Backend, What is the alternate for API Gateway while devlopment and testing locally

We are developing an Angular App, and we need to use the Microservice Aggregation(AWS API Gateway) pattern. But we need to consume the REST Services which are going to deploy in API Gateway, to test while developing. We have Spring boot REST Services as microservices.

2022-05-02 07:44:02    分类:问答    spring-boot   microservices   aws-api-gateway

Actor design pattern and real-world examples

I’m currently learning about the Actor design pattern, or model, and it seems quite interesting. However, I’m struggling to find any decent real-world examples of how, or where, this model could be applied (other than the basic examples of a simple bank account with a balance, or Enemy coordinates for a game, etc). As part of my research I came across a sample e-commerce microservice application (eShopOnDapr) where the Order was an Actor. Would this be a real-world example of where the Actor model could be used? Can this, or should this, design pattern be used with microservices? Using the

2022-05-02 05:16:14    分类:问答    design-patterns   microservices   actor   cqrs

MassTransit. Consume equal objects defined in different namespaces

First of all, excuse my English, it's very bad. I am using MassTransit with Azure Service Bus for asynchronous communication between microservices. By their own definition, and to avoid generating dependencies between them, messages sent between different microservices are defined in each of them, that is, they are part of different namespaces. The automatic management of MassTransit causes queues and topics to be managed by the object type, which prevents the microservices that consume a message from receiving the messages sent by the microservice publisher. The same thing happens with two

2022-05-02 03:00:09    分类:问答    .net-core   ipc   microservices   azureservicebus   masstransit