背景
学习黑马2022Redis教程,在开发P78达人探店功能,重新在前端登录的时候发现,所有的请求都需要发两遍才能成功。
 失败的请求报错:
 无法加载响应数据: No data found for resourcewith given identifier
 
排查
因为用到nginx,所以查看nginx配置文件
   server{
   	   # 此处省略若干配置
       location /api {  
            default_type  application/json;
            #internal;  
            keepalive_timeout   30s;  
            keepalive_requests  1000;  
            #支持keep-alive  
            proxy_http_version 1.1;  
            rewrite /api(/.*) $1 break;  
            proxy_pass_request_headers on;
            #more_clear_input_headers Accept-Encoding;  
            proxy_next_upstream error timeout;  
            #proxy_pass http://127.0.0.1:8081;
            proxy_pass http://backend;
        }
    }
    upstream backend {
        server 127.0.0.1:8081 max_fails=5 fail_timeout=10s weight=1;
        server 127.0.0.1:8082 max_fails=5 fail_timeout=10s weight=1;
    }  
幡然醒悟,之前测试集群环境下的并发问题开过两个实例。测试完后,后续其它开发只启动一个实例,配置文件没有改回去……



















