810 B
810 B
Service
This is an example of creating a micro service using the top level interface.
Prereqs
Micro services need a discovery system so they can find each other. Micro uses consul by default but its easily swapped out with etcd, kubernetes, or various other systems. We'll run consul for convenience.
-
Follow the install instructions - https://www.consul.io/intro/getting-started/install.html
-
Run Consul
$ consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul
Run the example
- Get the service
go get github.com/micro/go-micro/examples/service
- Run the server
$GOPATH/bin/service
- Run the client
$GOPATH/bin/service --client
And that's all there is to it.