亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在 CloudRun 上反映 gRPC 服務的列表?

如何在 CloudRun 上反映 gRPC 服務的列表?

Go
慕尼黑8549860 2022-08-15 15:46:16
按照此示例執行以下操作:gRPC in Google Cloud Runhttps://github.com/grpc-ecosystem/grpc-cloud-run-example/blob/master/golang/README.md我已經部署了一個gRPC服務,并在CloudRun上進行了反思。使用 grpcurl 進行測試:https://github.com/fullstorydev/grpcurlgrpcurl \-proto protos/calculator.proto \-d '{"first_operand": 2.0, "second_operand": 3.0, "operation": "ADD"}' \${ENDPOINT}:443 \Calculator.CalculateGRPC 服務器反射協議 https://github.com/grpc/grpc/blob/master/doc/server-reflection.md現在我想按照這些說明使用反射。--- a/examples/helloworld/greeter_server/main.go+++ b/examples/helloworld/greeter_server/main.go@@ -40,6 +40,7 @@ import (        "google.golang.org/grpc"        pb "google.golang.org/grpc/examples/helloworld/helloworld"+       "google.golang.org/grpc/reflection" ) const (@@ -61,6 +62,8 @@ func main() {        }        s := grpc.NewServer()        pb.RegisterGreeterService(s, &pb.GreeterService{SayHello: sayHello})+       // Register reflection service on gRPC server.+       reflection.Register(s)        if err := s.Serve(lis); err != nil {                log.Fatalf("failed to serve: %v", err)        }https://github.com/grpc/grpc-go/blob/master/Documentation/server-reflection-tutorial.md#enable-server-reflection您嘗試了什么:本地測試。請注意:grpcurl -plaintext 表示不是 TLS。省略 -純文本表示 TLS。什么有效:############################# local testing############################request list:grpcurl -plaintext localhost:8080 listresult:Calculatorgrpc.reflection.v1alpha.ServerReflectionrequest ADD function:grpcurl -plaintext \    -d '{"first_operand": 2.0, "second_operand": 3.0, "operation": "ADD"}' \    localhost:8080 \    Calculator.Calculateresult:{  "result": 5}############################您嘗試的內容:GCP CloudRun 測試。請注意:grpcurl -plaintext 表示不是 TLS。省略 -純文本表示 TLS。什么有效:request:grpcurl \    -proto protos/calculator.proto \    -d '{"first_operand": 2.0, "second_operand": 3.0, "operation": "ADD"}' \    ${ENDPOINT}:443 \    Calculator.Calculateresult:{  "result": 5}什么不起作用:我想使用反射,所以省略:-proto protos/calculator.proto \我想使用TLS,所以省略了:-plaintext
查看完整描述

1 回答

?
哆啦的時光機

TA貢獻1779條經驗 獲得超6個贊

gRPC 反射需要雙向流式處理,因此請確保在部署時選中啟用 HTTP/2 選項 (--use-http2)。這將實現雙迪流。

此外,請確保使用 :443 端口,并在需要時通過添加身份驗證元數據向服務器進行身份驗證(請參閱服務到服務身份驗證文檔)。


查看完整回答
反對 回復 2022-08-15
  • 1 回答
  • 0 關注
  • 104 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號