【发布时间】:2022-01-15 00:17:22
【问题描述】:
我有一个带有 Docker 的微服务架构。 每个微服务既是服务器又是客户端。我正在尝试对它们实施交互式查询。我想用纯文本交流。
服务器代码:
Server server = ServerBuilder.forPort(6666)
.addService((BindableService) this)
.build();
server.start();
客户端代码:
// Call the external instance
final ManagedChannel channel = ManagedChannelBuilder
.forAddress(hostStoreInfo.getHost(), hostStoreInfo.getPort())
.usePlaintext()
.build();
final InteractiveQueryApiGrpc.InteractiveQueryApiBlockingStub stub = InteractiveQueryApiGrpc.newBlockingStub(channel);
kafkaComplexMessage = stub.getOrder(request);
channel.shutdown();
每个 Docker 容器都是这样启动的:
docker run -p 8080:6666 -p 7070:6666 --env SERVER_PORT=8080 --network mynetwork mymicroservice:latest
当在本地状态存储中找不到数据时,我尝试远程访问正确的状态存储。但是,我收到此错误消息:
io.grpc.StatusRuntimeException: INTERNAL: http2 exception
(...)
Caused by: io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception: First received frame was not SETTINGS. Hex dump for first 5 bytes: 485454502f
当然,每个容器都有不同的端口,但我记录了所有内容并调用了正确的 IP 和端口。我的印象是服务器以纯文本形式运行 TSL 和客户端,我不确定如何降级服务器/禁用安全性。
【问题讨论】:
标签: spring-boot grpc grpc-java