Client not connected, current status:STARTING

简介: Client not connected, current status:STARTING

上面的问题出现在springboot整合nacos的时候出现的

首先说明一点,我出现这个问题是使用了nacos集群,nacos版本为2.2.3,且使用了nginx做了负载均衡,如果您和我一样,那么可以接着往下看。

1️⃣:当nacos版本为2.x的时候新加入了一个概念为gRPC,同时,对应的端口为9848,9849。与主端口的偏移量为1000,主端口就是8848。

2️⃣:当使用VIP/nginx请求时候,要使用TCP,而非http,因为如果使用http的时候,会直接被nginx断开

⛵️:针对上面的两点,nginx配置做如下修改

# 注意1:stream是与http同级的
# 注意2:下面的proxy_pass 后接的没有加http://
# 注意3:每一个nacos-server是grpc所对应的端口,而非主端口
# 注意4:我使用的是nginx1.18.0,好像默认带stream模块,如果你使用的是低版本,需要在编译的时候加入此模块
stream{
    
    upstream nacos_servers {
        server nacos-server1:9848;
        server nacos-server2:9848;
        server nacos-server3:9848;
    }
    server {
        listen 80;
        proxy_pass nacos_servers;
    }
}

🔚:重启nginx即可


🌟:如果上面都已经改好了,就可以启动你的springboot项目了。

⚠️:注意:springboot中配置的server端口要为你nginx反向代理端口-1000,也就是如果你nginx反向代理端口为7848:80,那么你springboot中配置的nacos服务的端口就是6848

❓:为什么要需要减去1000?

🔗:搭建nacos单体、集群、docker-compose搭建nacos集群,实现nginx负载均衡

相关文章
|
5月前
Could not connect to ‘x.x.x.x ‘(port 22): Connection failed.Failed to start sshd.service:
Could not connect to ‘x.x.x.x ‘(port 22): Connection failed.Failed to start sshd.service:
|
5月前
|
Ubuntu Linux C语言
Could not establish connection to “xx.xx.xx.xx“:The VS Code Server faild to start.【重要解决方案】
Could not establish connection to “xx.xx.xx.xx“:The VS Code Server faild to start.【重要解决方案】
150 0
|
网络安全 Docker 容器
failed to create network error response from daemon filed to setup ip tables问题
failed to create network error response from daemon filed to setup ip tables问题
204 0
|
数据库
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Could not create connection to database server. Attempted reconnect 3 times. Giving up.
159 0
|
网络安全 开发工具
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
1025 0
【解决方案】A session ended very soon after starting. Check that the command in profile “XXX” is correct.
|
SQL 数据库 Windows
SQL Server 2005 sp_send_dbmail出现Internal error at FormatRowset (Reason: Not enough storage is available to complete this operation)
案例环境:   操作系统: Windows 2003 SE 32bit(SP2) 数据库版本:Microsoft SQL Server 2005 - 9.00.5069.00 (Intel X86)             Aug 22 2012 16:01:52           ...
1422 0