Git Product home page Git Product logo

microservices's Introduction

microservices's People

Contributors

allenxuxu avatar jhzlf avatar suyaoli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microservices's Issues

trace的一些问题

首先,感谢例子,受益良多。
调用Inject时候,应该使用sp.Tracer().Inject,否则在jaeger中链路无法串起来。

关于micro分布式部署的问题

背景: 想实现在三台服务器主机完成微服务分布式部署
目标: 其中任意一台服务器宕机不影响整个业务使用
image

准备工作: 在三台服务器上完成consul 集群部署
image
现在server1上 , 运行 micro api , hello-srv, hello-api 工作正常 , http://192.168.0.1:8080/hello 接口访问成功

然后我尝试在server2 上重复server1操作 ,同样指定 --registry=consul --registry_address=192.168.0.1:8500,
但是发现访问http://192.168.0.1:8080/hello, server1中 micro api log 会出现:

2020-04-01 03:44:47.493251 I | hystrix breaker err: hystrix: timeout
2020-04-01 03:44:47.493531 I | http: proxy error: context canceled
2020-04-01 03:44:47.493547 I | status code 502

而且server2中的也没有接受到请求

所以现在有几个问题想请教一下:

  1. 如果想达成任意一台服务器宕机不影响整个业务使用的目的, 我应该怎么部署应用, 是不是应该每一个server 都要部署一个 micro api , hello-srv, hello-api ?
  2. 在server 1-3 中 registry_address该怎样指定?
  3. 部署完成后, 访问接口http://192.168.0.1:8080/hello接口里的ip是 server1 还是 server2 或 server3 ?

userSRV 服务启动报错

consul服务器不在本地主机userSRV无法启动一起报错
protoc --proto_path=/Users/allen/dev/go/src:. --micro_out=. --go_out=. proto/user/user.proto
go build -o ../../build/userSRV main.go
../../build/userSRV --registry=consul --registry_address=192.168.31.30:8500
2019/05/20 15:27:43 error loading source consul: Get http://127.0.0.1:8500/v1/kv/micro/config/?recurse=: dial tcp 127.0.0.1:8500: connect: connection refused
make: *** [run] Error 1

micro api 这边会偶然出现502

你好, 我clone代码后加了几个接口,都可以运行起来, 测试发现, 长时间不访问后调用接口, 偶然会出现502错误, 还没有解决, google 也没找到有用的信息, 来请教一下
`
192.168.0.1 - - [03/Mar/2020:01:45:06 +0000] "GET /metrics HTTP/1.1" 200 1479 "" "Prometheus/2.16.0"
2020-03-03 01:45:21.403572 I | auth plugin received: /metrics
2020-03-03 01:45:21.404120 I | GET-/metrics
192.168.0.1 - - [03/Mar/2020:01:45:21 +0000] "GET /metrics HTTP/1.1" 200 1478 "" "Prometheus/2.16.0"

2020-03-03 01:45:26.622715 I | auth plugin received: /device/activate
2020-03-03 01:45:26.623343 I | POST-/device/activate
2020-03-03 01:45:27.652417 I | hystrix breaker err: hystrix: timeout
210.22.74.67 - - [03/Mar/2020:01:45:26 +0000] "POST /device/activate HTTP/1.1" 200 0 "" ""
2020-03-03 01:45:27.654895 I | http: proxy error: context canceled
2020-03-03 01:45:27.665910 I | http: superfluous response.WriteHeader call from github.com/gorilla/handlers.(*responseLogger).WriteHeader (handlers.go:65)
2020-03-03 01:45:27.666027 I | status code 502

2020-03-03 01:45:36.403598 I | auth plugin received: /metrics
2020-03-03 01:45:36.404147 I | GET-/metrics
192.168.0.1 - - [03/Mar/2020:01:45:36 +0000] "GET /metrics HTTP/1.1" 200 1482 "" "Prometheus/2.16.0"

`

request gateway 405

访问api模块: http://localhost:8081/user/test

{
message: "Hi, this is the Greeter API"
}

但是访问gateway 405
request url : http://localhost:8080/user/test

{
id: "go.micro.client.transport",
code: 500,
detail: "405 Not Allowed: <html> <head><title>405 Not Allowed</title></head> <body bgcolor="white"> <center><h1>405 Not Allowed</h1></center> <hr><center>nginx/1.8.1</center> </body> </html> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> ",
status: "Internal Server Error"
}

auth和broker注释掉也报这个错误,请问gateway如何访问其他微服务模块的呢? 谢谢。

panic: WriteHeader called after Handler finished

部署在云服务器上会panic: WriteHeader called after Handler finished

micro Api panic 必现步骤 :
1. 先把熔断阀值调高
hystrix.DefaultMaxConcurrent = 100000
hystrix.DefaultVolumeThreshold = 100000
2. 熔断超时调低
hystrix.DefaultTimeout = 100
3 .用压测工具 webbench 高并发请求接口必panic "panic: net/http: CloseNotify called after ServeHTTP finished"
在这之前想请教下 Demo里面 user-api里超时设置 hystrix.DefaultTimeout = 5000 , 但是我在breaker/hystrix.go打印依然是默认的1000, 在api/user/main.go设置是不是没有生效? 所以上述的步骤里面几句代码是加在了, breaker/hystrix.go init()函数里面
image

image

image

Consul issue

Hi @Allenxuxu, nice to meet you! I'm learning with your code, thanks for share!

Can you help me with the issue below?

$ make run                                                                                                                                                   
go build -o ../../build/userAPI main.go
../../build/userAPI  --registry=consul
2019/05/03 21:32:48 error loading source consul: source not found: /micro/config/
make: *** [run] Error 1

关于micro api的一些问题

感谢你写的go-micro例子,关于micro api想请教一下啊:1,micro api 你把auth trace breaker 等中间件全部让api网关执行,会影响性能么?2,micro api 感觉是所有请求的入口,如果网关后端对应着几十个服务,所有的请求都走网关,会不会成为性能瓶颈啊,对网关可以做负载均衡吗?还有如何防单点故障呢?对于api网关我一直困惑这几点。谢谢。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.