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;               

            }

    }

  • 相关阅读:
    Android使用SQLite数据库(2)
    Android使用SQLite数据库(1)
    使用Eclipse为Android定义style
    SharedPreferences写入和读出数据
    AlertDialog.Builder弹出对话框
    Android退出时关闭所有Activity的方法
    获取PC或移动设备的所有IP地址
    Android文件的分割和组装
    到底什么是跨域?附解决方案!
    超详细 Nginx 极简教程
  • 原文地址:https://www.cnblogs.com/shihaiming/p/5924536.html
Copyright © 2011-2022 走看看