go-micro入门[翻译]

官方主页

Go Micro is a framework for microservice development.
GoMicro是一个微服框架。

Overview 概述

Go Micro provides the core requirements for distributed systems development including RPC and Event driven communication.
go micro为分布式开发提供核心基础,包含RPC和事件驱动式的通讯。
The micro philosophy is sane defaults with a pluggable architecture. We provide defaults to get you started quickly but everything can be easily swapped out.
Micro哲学是非常健壮默认使用插件架构。我们提供默认方式让你很快上手,而且所有插件很容易切换出去。

 
20716125-0c3e530958228ef3.png
架构示意图

Plugins are available at github.com/micro/go-plugins.

Follow us on Twitter or join the Slack community.

Features 特性

Go Micro abstracts away the details of distributed systems. Here are the main features.
Go Micro是对分布式系统的抽象。这里列举了主要特性。

  • Service Discovery - Automatic service registration and name resolution. Service discovery is at the core of micro service development. When service A needs to speak to service B it needs the location of that service. The default discovery mechanism is multicast DNS (mdns), a zeroconf system.
    服务发现-自动注册服务,名字解析。服务发现是微服务的核心。当A服务需要和B通话时,它需要定位B服务。默认的发现机制是mdns,是无需配置的系统。

  • Load Balancing - Client side load balancing built on service discovery. Once we have the addresses of any number of instances of a service we now need a way to decide which node to route to. We use random hashed load balancing to provide even distribution across the services and retry a different node if there’s a problem.
    负载均衡-客户端方负载均衡内建在服务发现中。一旦我们有某个服务的一些实例的地址,需要一个方法确定路由到哪个节点。我们使用随机hash负载均衡去平衡服务器之间,而且当某个节点出现问题是,将重新尝试其他节点。

  • Message Encoding - Dynamic message encoding based on content-type. The client and server will use codecs along with content-type to seamlessly encode and decode Go types for you. Any variety of messages could be encoded and sent from different clients. The client and server handle this by default. This includes protobuf and json by default.
    消息编码-基于内容类型的动态编码。客户端和服务器可以使用codecs配合content-type无缝的对Go类型做编码和解码。各种类型消息能在不同的客户端编码,发送。客户端和服务器默认情况下都会处理好这些工作。默认情况下包含protobuf和json。

  • Request/Response - RPC based request/response with support for bidirectional streaming. We provide an abstraction for synchronous communication. A request made to a service will be automatically resolved, load balanced, dialled and streamed. The default transport is http/1.1 or http2 when tls is enabled.
    请求/应答-RPC基于request/response,支持双向调用。我们提供同步通讯的抽象。一个服务器请求将会自动解析,负载均衡,连接远程微服和序列化传输数据。默认传输是http/1.1或者在tls允许的时候使用http2。

  • Async Messaging - PubSub is built in as a first class citizen for asynchronous communication and event driven architectures. Event notifications are a core pattern in micro service development. The default messaging is point-to-point http/1.1 or http2 when tls is enabled.
    异步消息-在消息驱动和异步通讯中,消息订阅和消息发布被内建在其中,并且当成first class citizen。默认消息是点对点的http1.1或者在tls有效的情况下启用http2。

    扫描二维码关注公众号,回复: 9238986 查看本文章
  • Pluggable Interfaces - Go Micro makes use of Go interfaces for each distributed system abstraction. Because of this these interfaces are pluggable and allows Go Micro to be runtime agnostic. You can plugin any underlying technology. Find plugins in github.com/micro/go-plugins.
    插件接口-Go Micro为每个分布式抽象都使用Go的接口。因为这些接口是可插拔的,允许Go Micro运行时透明。你可以插入任何底层技术。

Getting Started 开始

See the docs for detailed information on the architecture, installation and use of go-micro.
查看这个文档获取关于架构的详细信息。安装并且使用go-micro

发布了76 篇原创文章 · 获赞 13 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/erlang_hell/article/details/104259609