zoukankan      html  css  js  c++  java
  • proxy_next_upstream带来的坑和加载sticky模块

    1.若nginx配置的响应等待时间(proxy_read_timeout)为30秒,就会触发超时重试,将请求又打到另一台。如果处理中没有考虑到重复数据的场景,就会发生数据多次重复插入!

      proxy_next_upstream error | timeout | invalid_header | http_500 | http_502 | http_503 | http_504 | http_403 | http_404 | off ...;  

      proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;

    如果192.168.0.1这台服务器返回了超时或者500,那么访问 /example/ 时应该会自动重试到下一台服务器去,即到192.168.0.2去。

    proxy_next_upstream error timeout http_500 non_idemponent;
    proxy_connect_timeout 30s;
    proxy_read_timeout 30s;
    proxy_send_timeout 30s;

      默认情况下,当请求服务器发生错误或超时时,会尝试到下一台服务器。 参考:https://blog.csdn.net/bujidexinq/article/details/80406149

    2.proxy_next_upstream error timeout http_500 non_idemponent;

    像 post, lock, patch 这种会对服务器造成不幂等的方法,默认是不进行重试的,如果一定要进行重试,则要加上这个配置。

    https://zhuanlan.zhihu.com/p/35803906

    3.Nginx安装Sticky模块

      https://www.cnblogs.com/powerwu/articles/12619260.html

  • 相关阅读:
    基于CSS 和JS的网页SELECT下拉框美化,JQUERY 插件
    ini文件读写
    Hibernate 表关系描述之OneToMany
    Hibernate 表关系描述之ManyToMany
    Hibernate 初识
    Hibernate 表关系描述之OneToOne
    Struts配置文件初解
    Hibernate 初识(补充)
    struts 学习之04 "模型"
    (Struts)Action类及其相关类
  • 原文地址:https://www.cnblogs.com/hixiaowei/p/14218619.html
Copyright © 2011-2022 走看看