zoukankan      html  css  js  c++  java
  • nginx实现openfire负载均衡

    Nginx版本必须是1.9以上,不然不支持tcp连接,要么加入其他插件

    在nginx.conf文件中加入下图中的代码,图中的ip与端口配成自己的,配置好后,客户端请求listen监听的端口,ip为nginx所在服务器的地址,openfire服务器名称在集群中是一样的。例如我测试配置的:

    Nginx所在服务地址:http://192.168.1.248

    Listen监听端口:6222

    Openfire服务器名称:test

    stream {       

          upstream openfire5222 {                       

                    hash $remote_addr consistent;                               

                    server 192.168.1.249:5222 weight=5;                                                       

                    server 192.168.1.248:5222 weight=5;             

            }       

            server {                       

                listen 6222;                               

                proxy_connect_timeout 10s; #设置连接超时时长  必须                         

                proxy_timeout 30s;  #设置代理超时时长          必须                   

                proxy_pass openfire5222;               

            }

    }

  • 相关阅读:
    Linux如何查找大文件或目录总结
    Linux下动态调整LVM文件系统大小
    ios学习路线图
    js模块,类,继承,命名空间,私有属性等相关概念梳理
    <代码大全2>记录
    2017读书计划
    Spring声明式事务
    Spring-Aop
    Spring静态工厂和扫描器
    Spring-IOC
  • 原文地址:https://www.cnblogs.com/shihaiming/p/5924536.html
Copyright © 2011-2022 走看看