如何为混合HTTP1.1,HTTP2.0和GRPC流量后端设置GCP负载量
1 : https://i.sstatic.net/eyw1w.pngdestrong text **
我配置了2 VMS,1 VM将与HTTP1.1一起使用,并为2个后端创建另一个VM,一个后端用于HTTP2,另一个后端与GRPC相结合。问题在于,即使我为第二个VM实例组配置了名为ports的HTTP2和GRPC。我只收到HTTP1.1请求,但不收到HTTP2.0,并且在检查另一个应用程序时(不在负载均衡器健康检查中)时,GRPC健康检查正在失败。以下是我的http2&的nginx配置。 GRPC后端。
server {
listen 80;
server_name pqsaquilagcp.gcptest.anqlave.net;
client_max_body_size 50m;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 80;
listen 443 ssl http2;
server_tokens off;
server_name pqsaquilagcp.gcptest.anqlave.net;
client_max_body_size 50m;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 81 http2;
server_tokens off;
server_name grpc.pqsaquilagcp.gcptest.anqlave.net;
client_max_body_size 600m;
client_body_timeout 600s;
grpc_read_timeout 600s;
grpc_send_timeout 600s;
grpc_connect_timeout 600s;
location / {
proxy_buffer_size 512k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 512k;
grpc_pass grpc://127.0.0.1:8080;
}
}
[![enter image description here][1]][1]
1: https://i.sstatic.net/Eyw1w.png**strong text**
I configured HTTPS load balancer with 2 VMs, 1 VM will work with http1.1 and another VM is created for 2 backends, one backend is for http2, and another backend with gRPC. The problem is that even though I configured http2 and grpc named ports for the 2nd VM instance group. I'm getting http1.1 requests only but not http2.0 and also gRPC health checks are failing while checking on another application(not in load balancer health checks). Below are my Nginx configs for http2 & grpc backends.
server {
listen 80;
server_name pqsaquilagcp.gcptest.anqlave.net;
client_max_body_size 50m;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 80;
listen 443 ssl http2;
server_tokens off;
server_name pqsaquilagcp.gcptest.anqlave.net;
client_max_body_size 50m;
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
server {
listen 81 http2;
server_tokens off;
server_name grpc.pqsaquilagcp.gcptest.anqlave.net;
client_max_body_size 600m;
client_body_timeout 600s;
grpc_read_timeout 600s;
grpc_send_timeout 600s;
grpc_connect_timeout 600s;
location / {
proxy_buffer_size 512k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 512k;
grpc_pass grpc://127.0.0.1:8080;
}
}
[![enter image description here][1]][1]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您的屏幕截图中,我只看到配置为使用端口80的后端。您的NGINX服务器在端口80上没有启用TLS加密。
如果您使用HTTP/2,则必须使用TLS。不支持无加密的HTTP/2。 link
才能将GRPC与Google Cloud Applications一起使用,您必须对在http/2上端。
在这里讨论这些概念:
外部http(s)
From your screenshot, I only see backends configured to use port 80. Your Nginx server does not have TLS encryption enabled on port 80.
If you use HTTP/2, you must use TLS. HTTP/2 without encryption is not supported. link
To use gRPC with your Google Cloud applications, you must proxy requests end-to-end over HTTP/2.
Those concepts are discussed here:
External HTTP(S) Load Balancing overview