nginx配置nacos的grpc连接
报错信息: java.util.concurrent.TimeoutException: Waited 3000 milliseconds (plus 501200 nanoseconds delay) for com.alibaba.nacos.shaded.io.grpc.stub.ClientCallsKaTeX parse error: Expected '}', got 'EOF' at end of input: ….ProtoLiteUtilsMessageMarshaller@5981f4a6, responseMarshaller=com.alibaba.nacos.shaded.io.grpc.protobuf.lite.ProtoLiteUtils
M
e
s
s
a
g
e
M
a
r
s
h
a
l
l
e
r
@
63
d
f
a
d
a
0
,
s
c
h
e
m
a
D
e
s
c
r
i
p
t
o
r
=
c
o
m
.
a
l
i
b
a
b
a
.
n
a
c
o
s
.
a
p
i
.
g
r
p
c
.
a
u
t
o
.
R
e
q
u
e
s
t
G
r
p
c
MessageMarshaller@63dfada0, schemaDescriptor=com.alibaba.nacos.api.grpc.auto.RequestGrpc
MessageMarshaller@63dfada0,schemaDescriptor=com.alibaba.nacos.api.grpc.auto.RequestGrpcRequestMethodDescriptorSupplier@6f231ced}}}}}]] at com.alibaba.nacos.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:508) ~[nacos-client-2.0.4.jar:na] java.util.concurrent.ExecutionException: com.alibaba.nacos.shaded.io.grpc.StatusRuntimeException: UNAVAILABLE: io exception at com.alibaba.nacos.shaded.com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:566) ~[nacos-client-2.0.4.jar:na] at com.alibaba.nacos.shaded.com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:445) ~[nacos-client-2.0.4.jar:na]
解决方案:
1、暴露 nacos 集群的端口偏移1000
例如:nacos默认端口8848,需要把9848(8848+1000)也暴露出来
2、修改 nginx.conf 的文件
http {
upstream lb-nocos{
server 127.0.0.1:8845 weight=1;
server 127.0.0.1:8847 weight=1;
server 127.0.0.1:8849 weight=1;
}
server {
listen 8848;
server_name localhost;
location / {
proxy_pass http://lb-nocos;
}
}
}
stream {
upstream lb-nocos-tcp{
server 127.0.0.1:9845 weight=1;
server 127.0.0.1:9847 weight=1;
server 127.0.0.1:9849 weight=1;
}
server {
listen 9848;
proxy_pass lb-nocos-tcp;
}
}
集群部署参考:https://blog.csdn.net/weixin_51311218/article/details/122617027
|