Skip to content

Latest commit

 

History

History

micro

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

go-micro && micro

快速入门

Go Micro

服务发现(Service Discovery)

Consul
  • Consul是GoMicro默认使用的服务发现系统,可以使用插件的方式进行修改。可以在 micro/go-plugins 查找etcd, kubernetes, zookeeper等系统的插件实现方式。
  • Consul安装
Multicast DNS

编写服务(Writing a service)

编写函数(Writing a Function)

Go Micro 包括支持了函数编程模型。

插件(Plugins)

默认情况下面go-micro在核心部分对每个接口只提供了很少的一些实现,但是他们完全可以以插件的形式实现。

可用的插件

包装器(Wrappers)

Go Micro以Wrappers实现中间件的概念。

Micro

Micro是微服务开发工具集合,目的是简化分布式系统的开发工作。包括如下五个组成部分:

  • Go Micro - 开发包:插件式的RPC开发框架。

  • API - API网关:单一的Http协议入口,动态的将HTTP请求转换为RPC请求(HTTP请求)。

    micro api --handler=rpc	# 将HTTP请求转换为RPC请求
    micro api # 默认的方式The default handler uses endpoint metadata from the registry to determine service routes
    micro api --handler=proxy  # 使用github.com/micro/go-web,HTTP代理实现
  • Web - 提供了dashboard 查询服务的Web界面。

  • CLI - 跟你的微服务交互的命令行接口。

  • Bot - The micro bot is a bot that sits inside your microservices environment which you can interact with via Slack, HipChat, XMPP, etc. It mimics the functions of the CLI via messaging.

  • Sidecar - go-micro代理。基于HTTP的,go-micro全特性实现。

    micro sidecar					# rpc 
    micro sidecar --handler=proxy	# http
    
  • New - The micro new command is a quick way to generate boilerplate templates for micro services.

  • Run - The micro run command manages the lifecycle of a microservice.

参考资料