go micro v1.9.1 install

1. Installation protoc-gen-micro

1) protoc

To https://github.com/protocolbuffers/protobuf/releases download the compiled version protoc-3.9.1-win64.zip .

2) protoc the go plug protoc-gen-go

GIT_TAG="v1.2.0" # change as needed
go get -d -u github.com/golang/protobuf/protoc-gen-go
git -C "$(go env GOPATH)"/src/github.com/golang/protobuf checkout $GIT_TAG
go install github.com/golang/protobuf/protoc-gen-go

Also go directly to https://github.com/golang/protobuf/tree/v1.3.2 download.

Offline download manually compiled.

Enter $ GOPATH / src / github.com / golang / protobuf / protoc-gen-go

go build -o protoc-gen-go main.go

3) go get github.com/micro/protoc-gen-micro

If the development environment can not access, can be directly https://github.com/micro/protoc-gen-micro/tree/v0.8.0 download

Offline download need to manually compile similar protoc-gen-go.

进入src/github.com/micro/protoc-gen-micro

go build -o protoc-gen-micro main.go

2. Service Discovery

v1.9.1 version of the default service discovery changed mDNS, no additional installation.

For other ways, reference https://micro.mu/docs/go-micro.html

Consul
Consul can be used as an alternative service discovery system.
Discovery is pluggable. Find plugins for etcd, kubernetes, zookeeper and more in the micro/go-plugins repo.
Install guide
Pass --registry=consul to any command or the enviroment variable MICRO_REGISTRY=consul
MICRO_REGISTRY=consul go run main.go

3. Install go micro

go get -u -v github.com/micro/go-micro or to https://github.com/micro/go-micro/tree/v1.9.1 download

Guess you like

Origin www.cnblogs.com/xiaochuizi/p/11386876.html