Nginx學習之負載均衡fair模塊
寫在開始
前麵對Nginx的三種負載均衡實現做了一個簡單的介紹,這裏分享一個第三方的負載均衡模塊nginx-upstream-fair。
模塊介紹
The Nginx fair proxy balancer enhances the standard round-robin load balancer provided
with Nginx so that it will track busy back end servers (e.g. Thin, Ebb, Mongrel)
and balance the load to non-busy server processes.
簡單翻譯一下,fair采用的不是內建負載均衡使用的輪換的均衡算法,而是可以根據頁麵大小、加載時間長短智能的進行負載均衡。
下載地址:nginx-upstream-fair
解壓:
unzip nginx-upstream-fair-master.zip
模塊安裝
未安裝Nginx
切換到Nginx目錄執行一下操作
配置:
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --add-module=/home/nginx-upstream-fair-master
編譯安裝
make && make intstall
安裝過Nginx
切換到Nginx目錄執行一下操作
配置
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --add-module=/home/nginx-upstream-fair-master
編譯
make
複製Nginx
cp objs/nginx /usr/local/nginx/nginx
配置實現
upstream backserver {
fair;
server 192.168.0.14;
server 192.168.0.15;
}
注意事項
已安裝Nginx,配置第三方模塊時,隻需要--add-module=/第三方模塊目錄,然後make編譯一下就可以,不要 make install 安裝。編譯後複製objs下麵的Nginx到指定目錄下。
配置中path自行定義即可。
小站:https://blog.52itstyle.com/
最後更新:2017-04-12 12:30:31
上一篇:
ELK統一日誌係統的應用
下一篇:
Spark:超越Hadoop MapReduce
探秘視頻編碼黑科技,窄帶高清2.0視覺模型及場景實戰
V8 Ignition:JS 引擎與字節碼的不解之緣
VM啟動報錯Cannot open the disk,Failed to lock the file
Android實現搜索關鍵字飛入飛出效果
os X下mds_stores占用大量cpu的解決辦法
Android 如何把狀態欄信號格改為5格
在線購物類型APP開發如何更好的提升用戶體驗
zoj 1456 Minimum Transport Cost 最短路
雲棲大會直播:阿裏巴巴成立全球研究院“達摩院” 計劃三年內投資超1000億元
Arbor Pravail APS係統防護DDoS攻擊