標籤:server ase 修改 clear dex 均衡 lis 伺服器 span
1、Server Load Balancer是一種常用的跨多個應用程式執行個體 技術最佳化資源使用率,最大化輸送量, 減少延遲,並確保容錯配置。
2、使用nginx作為非常有效HTTP負載平衡器 將流量分發給幾個應用程式伺服器和改善 效能、延展性和可靠性nginx的web應用程式。
工具/原料
- tomcat7 :http://pan.baidu.com/s/1pJxlzF9
- nginx1.8 :http://pan.baidu.com/s/1nts5TTB
- 測試專案nginx :http://pan.baidu.com/s/1hq6niz6
方法/步驟
- 1
將tomcat複製成兩份,如
- 2
修改兩個tomcat的連接埠,找到路徑“conf\”的server.xml,
修改後情況分別如下:
- 3
1、下載“測試專案nginx",解壓後如;
2、分別在兩個tomcat的“conf\Catalina\localhost“(沒有此目錄則建立),建立nginx.xml,內容分別為:
<!-- tomcat7_9001配置 -->
<Context docBase="D:\project\nginx9001" reloadable="false">
</Context>
<!-- tomcat7_9002配置 -->
<Context docBase="D:\project\nginx9002" reloadable="false">
</Context>
- 4
配置nginx,找到路徑”nginx-1.8.0\conf“的 nginx.conf 檔案,修改情況如:
upstream tomcat_nginx{
server 127.0.0.1:9001;
server 127.0.0.1:9002;
}
proxy_pass http://tomcat_nginx;
- 5
1、啟動tomcat7_9001與tomcat7_9002
2、啟動nginx
3、訪問:http://127.0.0.1:9500/nginx/,負載平衡部署成功如:
END
注意事項
- tomcat與nginx均為官方純淨應用
- 無法啟動時,有可能連接埠被佔用,請修改連接埠
windows下tomcat7+nginx1.8負載平衡