traefik+etcd構建grpc微服務demo


1.下載安裝traefik

   

https://github.com/containous/traefik/releases

 

 

2.下載安裝etcd3

https://github.com/coreos/etcd/releases

 

3.配置traefik,監控etcd的k-v,traefik使用文檔地址 https://docs.traefik.io/master/user-guide/grpc/

[etcd]
prefix = "/myservice"
watch=true
endpoint = "127.0.0.1:2379"
#APIV3=true
useAPIV3 = true
[entryPoints]
  [entryPoints.http]
    address = ":8001"  //http1,htp2的入口地址
    compress = true
  [entryPoints.bar]
    address = ":8081"
[api]
  entryPoint = "bar" //admin的入口地址
  dashboard = true
  debug = true

 

4.將服務信息寫入ETCD 

put /myservice/backends/backend1/servers/server1/url h2c://backend.local:8080

put /myservice/frontends/frontend1/backend backend1

put /myservice/frontends/frontend1/routes/test_1/rule PathPrefix:/proto.HelloHttp/SayHello

 

5.啟動 SayHello的GRPC服務

 

6.啟動traefik 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM