etcdv3

command
v0.0.0-...-fabbfc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

etcdv3

本篇演示如何使用etcdv3。

内容

  • server.go - 服务端
  • client.go - 客户端
  • plugins.go - etcdv3插件

运行

运行服务端

go run server.go plugins.go --registry=etcdv3

运行客户端

go run client.go plugins.go --registry=etcdv3

其它

Go-micro中的原生注册包中是没有etcd的,故而micro api中也是没有的,因为micro指令是基于Go-Micro开发的。那怎么才能使指令micro api能够注册到etcd上呢?

我们就以etcdv3为例,给大家演示如何使用。

  1. 下载micro源码
git clone git@github.com:micro/micro.git

或者

git clone https://github.com/micro/micro.git

或者

go get -u github.com/micro/micro
cd $GOPATH/src/github.com/micro/micro
  1. 编译

2.1 切到源码目录

cd micro源码目录

2.2 增加插件文件plugins.go:

增加plugins.go到micro包的根目录

plugins.go

package main

import (
_ "github.com/micro/go-plugins/registry/etcdv3"
)

2.3 编译

go build -o mainWithEtcdv3 main.go plugins.go 
  1. 运行
./mainWithEtcdv3 --registry=etcdv3 api

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL