Load balancing for SOLR clusters using Nginx on Linux

Source: Internet
Author: User
Tags set time solr

Load balancing for SOLR clusters using Nginx on Linux

When building the SOLR cluster on Linux, load balancing is required, but there is no F5 big-IP load balancer switch in the test environment, so the WebLogic ProxyServer, and Apache have been tried, and the effect is poor, After two servers have been load balanced, the speed of concurrent response is not as fast as a single load balancer. The final use of nginx, the effect is very good, the following will be installed on the Linux installation steps to describe.

1 Installation Preparation

Nginx software version: Nginx 1.2.5

Installation package: rhel_nginx-1.2.5-1.el5.ngx.x86_64.rpm

Operating system: RedHat 5 64-bit

2 installation Configuration

2.1 Installing Nginx

Using commands

Rpm-i rhel_nginx-1.2.5-1.el5.ngx.x86_64.rpm

Installation

The default installation location is:/usr/sbin/

The main profile location is:/etc/nginx/nginx.conf

Other configuration files are located in the/ETC/NGINX/CONF.D directory:

2.2 Configuring Nginx

2.2.1 Configuring ports

Input

Vi/etc/nginx/conf.d/default.conf

Open configuration file

Locate the server segment and modify listen 80 for the required port

2.2.2 Configuring load Balancing

Input

Vi/etc/nginx/conf.d/default.conf

Open configuration file

At the beginning of the file, enter:

upstream <span style= "Background-color:rgb ( 255,255,0) ">nginxproxy</SPAN>{ 
        Server 192.168.1.100:7022 Max_ fails=3 fail_timeout=5h; 
        Server 172.23.1.101:7022 max_fails=3 fail_timeout=5h; 

proxy_connect_timeout   1; 
proxy_send_timeout        300; 
proxy_read_ timeout        300; 

Where the server segment in upstream Bslgis is the server IP and port that needs to be load balanced, if the connection exceeds the Proxy_connect_timeout set time and the number of max_fails settings is exceeded, the server is considered down. The server will no longer be accessed within the time period set by Fail_timeout.

Locate the location segment configuration in the "server{}" section and enter

Proxy_pass Http://nginxproxy;

The final location section is as follows:

Location/{
root/usr/share/nginx/html;
Index index.html index.htm;
Proxy_pass Http://nginxproxy;
}

The complete configuration file is as follows:

2.3 Start Nginx

Start command: Nginx If you are prompted to find a command, try entering the full path:/usr/sbin/nginx

Stop command:nginx-s stop

Restart:nginx-s Reload

Smooth change of Nginx configuration file (without restarting Nginx)

Check that the configuration file is correct:nginx-t

Use

Ps-ef |grep "Nginx:master" |grep-v "grep"

The output is as follows:

Root 3735 1 008:48? 00:00:00 nginx:masterprocess Nginx

ID number of the Nginx master process found, 3735

The Nginx configuration can be updated with command Kill-hup 3735

To view the installation location of Nginx,

RPM-QPL nginx-1.2.5-1.el5.ngx.i386.rpm

Load balancing for SOLR clusters using Nginx on Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.