目錄
- nginx配置實體
- 多服務器負載
nginx配置實體
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream minio-server {
# weight:默認為1,weight越大,負載的權重就越大,
# backup:其它所有的非backup機器down或者忙的時候,請求backup機器,所以這臺機器壓力會最輕,
# max_fails:允許請求失敗的次數默認為1,當超過最大次數時,回傳 proxy_next_upstream 模塊定義的錯誤,
# fail_timeout:Nginx基于連接探測,如果發現后端例外,在單位周期為fail_timeout設定的時間中達到max_fails次數,這個周期次數內,如果后端同一個節點不可用,那么把節點標記為不可用,并等待下一個周期(同樣時常為fail_timeout)再一次去請求,判斷是否連接是否成功,
server 192.168.199.140:9000 weight=2 max_fails=3 fail_timeout=10s;
server 192.168.199.141:9000 max_fails=3 fail_timeout=30s;
}
server {
listen 80;
server_name localhost;
charset utf-8;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
# 傳輸檔案快取大小及單次請求大小
client_body_buffer_size 10M;
client_max_body_size 1G;
# 宕機檢測,如果設定時間內無回應,則直接切換到其它服務
proxy_connect_timeout 4;
proxy_send_timeout 4;
proxy_read_timeout 4;
proxy_pass http://minio-server;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
多服務器負載
此配置下 nginx + keepalived 在多臺服務器上搭建,可以實作高可用負載均衡,
keepalived安裝及組合nginx配置負載實作高可用
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/276945.html
標籤:其他
上一篇:高性能計算發展簡史
