问题
I need to use GRPC for inter communication between 2 micro services. But by default, cloud foundry use Go router that doesn't support Http2. And by default, many of cloud foundry installation doesn't expose TCP port itself. Is there any work around or is there any interface that will support this scenario?
I have tried using EUREKA with spring boot. It still uses HTTP1.1.
回答1:
You are correct, Gorouter doesn't support HTTP/2. To make HTTP/2 and/or gRPC work on CF, you have two options.
If you have the need for public clients (i.e.clients outside CF) to connect to your app, you need to use TCP routing. If your provider doesn't enable this by default, find another provider (see this list of public providers, hint Pivotal Web Services will provide TCP routes upon request) or self host.
If you only need to use HTTP/2 and/or gRPC between apps running on CF, you can use the container to container network. When you talk app to app, there are no restrictions (so long as you properly open required ports). You can use TCP, UDP and any protocol built on top of those. There some details about how this works here.
Hope that helps!
来源:https://stackoverflow.com/questions/55438084/how-does-grpc-work-in-cloud-foundry-gorouter-doesnt-support-http2