Load Balancing for Openfire clusters using Nginx
Some time ago, we implemented Openfire cluster deployment. If we want to implement the application in the application, we still need a crucial task: load distribution, and the selected load tool is Nginx (the reason is simple: open source, free of charge ).
1. Install nginx (RedHat Enterprise Edition 6.5 64bit environment)
Download the latest upload file to the nginxofficial website. The nginx-1.9.3.tar.gz file is currently the latest.
The latest version is selected because tcp load support has been provided in the new version of nginx, and other projects do not need to be introduced;
Installation steps:
1. Use the tar command to decompress the project file: tar-zxvf nginx-1.9.3.tar.gz
2. Go to the decompressed project and path and re-compile the project:./configure -- prefix =/usr/local/nginx -- with-stream
Note:
If you need to use tcp load, you must input the parameter -- with-stream during compilation.
The system reports an error and prompts that the zlib or pcre Library is missing. The inventory is in the image file of the system. Follow the prompts to install the two libraries as follows:
1. Add the image file to the virtual machine.
2. Mount the image file to the path:
Mount -- bind/media/RHEL_6.5 x86_64 Disc 1/root/redhat6.5iso
3. Use the yum command to install the missing class Library:
Yum install pcre *
Yum install zlib *
3. Use the make and make install commands for installation.
Run the make command first, and then run the make install command.
4. modify the configuration
Use vi to edit the/usr/local/nginx/conf/nginx. conf configuration file and add the following configuration information.
Stream {
Upstream backend {
Hash $ remote_addr consistent;
Server 10.68.13.27: 5222 weight = 5;
Server 10.68.13.30: 5222 weight = 5;
}
Server {
Listen 5222;
Proxy_connect_timeout 10 s; # Set the connection timeout Time Required
Proxy_timeout 30 s; # Set the agent timeout Time Required
Proxy_pass backend;
}
}
5. Start
The START command of nginx in the latest version is/usr/local/nginx/sbin/nginx, and the stop command is/usr/local/nginx/sbin/nginx-s.
Detailed installation process of Openfire in CentOS
Openfire server configuration notes based on Jabber/XMPP protocol in CentOS 5.4
Install Openfire on Ubuntu 12.04
Openfire solves Chinese garbled characters After MySQL database is used
Openfire details: click here
Openfire: click here
This article permanently updates the link address: