Skip to content

skyhackvip/service_discovery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

服务注册发现

内容介绍

  • 微服务为什么引入服务注册发现
  • 服务注册中心设计原理
  • Golang 代码实现服务注册中心

项目使用

  • 服务构建
cd cmd
go build -o discovery main.go
./discovery -c configs.yaml
  • 服务注册
curl -XPOST http://127.0.0.1:6666/api/register -H 'Content-Type:application/json' -d'{"env":"dev", "appid":"testapp","hostname":"testhost1","addrs":["rpc:aaa","rpc:bbb"],"status":1,"replication":true}'
  • 服务发现
curl -XPOST http://127.0.0.1:6666/api/fetch -H 'Content-Type:application/json' -d'{"env":"dev", "appid":"testapp","status":1}'

curl -XPOST http://127.0.0.1:6666/api/fetchall
  • 服务续约
curl -XPOST http://127.0.0.1:8866/api/renew -H 'Content-Type:application/json' -d'{"env":"dev","appid":"testapp","hostname":"testhost","replication":true}'
  • 服务取消
curl -XPOST http://127.0.0.1:8866/api/cancel -H 'Content-Type:application/json' -d'{"env":"dev","appid":"testapp","hostname":"testhost","replication":true}'

代码解读

服务注册发现设计与实现

服务注册发现2:实现集群

扫码关注微信公众号 技术岁月 支持:

技术岁月

About

服务注册发现

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages