Nacos2.2.1 + nginx 集群环境项目启动报错:com.alibaba.nacos.api.exception.NacosException: Client not connected,

Nacos2.2.1 + nginx 集群环境项目启动报错:com.alibaba.nacos.api.exception.NacosException: Client not connected, current status:STARTING

解决方式:
请先确保你的ngcos安装了 stream 组件
如未安装,请百度 Nginx配置TCP请求转发


worker_processes  1;

events {
    worker_connections  1024;
}

stream{
     
	upstream cluster{		#nacos集群的ip加端口
        server 192.168.42.129:8848;
        server 192.168.42.132:8848;
        server 192.168.42.134:8848;
    	}


       server{
         listen 1080;		#nacos默认偏移量监听的端口
         proxy_pass cluster;
		}
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;


    upstream cluster{		#nacos集群的ip加端口
        server 192.168.42.129:8848;
        server 192.168.42.132:8848;
        server 192.168.42.134:8848;
    }

    server {
        listen       80;		#nginx监听的端口
        
        server_name  localhost;
        
        location / {
        
	    proxy_pass http://cluster;
	    
        }
        
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

注意,请将上文中的ip和端口换成自己的ip和端口

配置完成后重启nginx

./nginx -c /usr/local/nginx/conf/nginx.conf

启动时需要指定自己的配置文件

项目启动成功

项目启动成功

你可能感兴趣的:(java,nginx,linux)