Install Guide

Framework

Go Micro is an RPC framework for development microservices in Go

Dependencies

You will need protoc-gen-micro for code generation

Install

  1. go get github.com/micro/go-micro

Runtime

Micro provides a runtime for accessing and managing microservices

Install

From source

  1. go get github.com/micro/micro

Docker image

  1. docker pull micro/micro

Latest release binaries

  1. # Mac OS or Linux
  2. curl -fsSL https://micro.mu/install.sh | /bin/bash
  3. # Windows
  4. powershell -Command "iwr -useb https://micro.mu/install.ps1 | iex"

Usage

Run the greeter service

  1. go get github.com/micro/examples/greeter/srv && srv

List services

  1. micro list services

Get Service

  1. micro get service go.micro.srv.greeter

Output

  1. service go.micro.srv.greeter
  2. version 2019.11.09.10.34
  3. ID Address Metadata
  4. go.micro.srv.greeter-e25a5edd-0936-4d32-b4d7-e62bf454d5f7 172.17.0.1:33031 broker=http,protocol=mucp,registry=mdns,server=mucp,transport=http
  5. Endpoint: Say.Hello
  6. Request: {
  7. name string
  8. }
  9. Response: {
  10. msg string
  11. }

Call service

  1. micro call go.micro.srv.greeter Say.Hello '{"name": "John"}'

Output

  1. {
  2. "msg": "Hello John"
  3. }