Load balancing common scheduling algorithm:
RR (Round Robin). The RR algorithm is the simplest and most commonly used algorithm, that is, polling scheduling.
LC (Least Connections). The LC algorithm, the minimum connection number algorithm, dynamically allocates the previous request based on the size of the node connections in the backend.
SH (Source Hashing). SH is based on the source access scheduling algorithm, this algorithm has some session sessions recorded on the server side of the scene, can be based on the source of Ip,cookie and other cluster scheduling
Case Environment:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/72/C9/wKiom1XtMzSAgulXAADvU00VHKs421.jpg "title=" 2015-09-07_143311.png "width=" "height=" 324 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:700PX;HEIGHT:324PX; " alt= "Wkiom1xtmzsagulxaadvu00vhks421.jpg"/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/C6/wKioL1XtN-bDMFWXAAK_JP5Yc0Q188.jpg "title=" 1.png " Width= "height=" 265 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:265px; "alt=" Wkiol1xtn-bdmfwxaak _jp5yc0q188.jpg "/>
1. Compile and install nginx
1) Install software support , Nginx the configuration and operation needs Pcre , zlib and other packages to provide the appropriate library and header files.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/CA/wKiom1XtO0jCxHJcAABLd4tN5wI909.jpg "title=" 1.png " alt= "Wkiom1xto0jcxhjcaabld4tn5wi909.jpg"/>
2) Create a run user, group
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/CA/wKiom1XtOqeyN6WlAABhlHWQdtw797.jpg "title=" 2.png " alt= "Wkiom1xtoqeyn6wlaabhlhwqdtw797.jpg"/>
3 ) Compile and install Nginx , enable Http_stub_status_module module to support status statistics , easy to view the server's link information
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/CA/wKiom1XtO2uRzZsCAAFSmpKjC8k445.jpg "title=" 3.png " alt= "Wkiom1xto2urzzscaafsmpkjc8k445.jpg"/>
4) Main program Nginx Create a linked file , for administrators to execute directly Nginx command, you can call Nginx the main program
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/C7/wKioL1XtPfLCKXZfAAENCtZwfGE483.jpg "title=" 4.png " alt= "Wkiol1xtpflckxzfaaenctzwfge483.jpg"/>
2.Nginx the Operation control
1) Check the configuration file
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/CA/wKiom1XtPJnS7J9FAAEFZq8_Pgs930.jpg "title=" 5.png " alt= "Wkiom1xtpjns7j9faaefzq8_pgs930.jpg"/>
2) Start, Stop Nginx , if the server is already installed http wait service, should be deactivated to avoid conflicts
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/72/CA/wKiom1XtPOrA9hADAAHbXoUGjPc572.jpg "title=" 6.png " alt= "Wkiom1xtpora9hadaahbxougjpc572.jpg"/>
Restart Nginx , Web testing
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/C7/wKioL1XtPziC1rJ6AAG_r_7yaHQ510.jpg "title=" 7.png " alt= "Wkiol1xtpzic1rj6aag_r_7yahq510.jpg"/>
two . Use Haproxy Build Web Cluster
Nginx2 Configuration Ibid .
1. Compile and install Haproxy
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/CA/wKiom1XtPTajGCbtAAGP6JoQKN4240.jpg "title=" 8.png " alt= "Wkiom1xtptajgcbtaagp6joqkn4240.jpg"/>
2.Haproxy Service Configuration
1) Establish Haproxy the configuration file
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/C7/wKioL1XtP4aSpdp1AADDyDI9vho576.jpg "title=" 9.png " alt= "Wkiol1xtp4aspdp1aaddydi9vho576.jpg"/>2) Haproxy Configuration Item Description . Global Configuration , Defaults as the default configuration , Listen Configuring for application Components
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/C7/wKioL1XtP93zxG26AAEviVK1i_I731.jpg "title=" 10.png "alt=" Wkiol1xtp93zxg26aaevivk1i_i731.jpg "/>
3) Create a self-launching script
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/72/C7/wKioL1XtQAKxocalAAHv5YXnl_k795.jpg "title=" 11.png "alt=" Wkiol1xtqakxocalaahv5yxnl_k795.jpg "/>
4) Test Web Cluster
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/72/CA/wKiom1XtPfzzEuP9AAGmM1iszNs117.jpg "title=" 12.png "alt=" Wkiom1xtpfzzeup9aagmm1iszns117.jpg "/>
This article from "Day Up" blog, please be sure to keep this source http://label.blog.51cto.com/10650689/1692333
Build a Web cluster using Haproxy