「nginx」ngx_http_upstream_consistent_hashジュールをインストール、配置方法

1.インストール
# wget https://github.com/replay/ngx_http_consistent_hash/archive/master.zip
# unzip master.zip
# ./configure –add-module=./3thparty/ngx_http_consistent_hash-master
# make
# make install

2.設定
consistent_hash $request_uri;
server 172.31.27.2:10401;
server 172.31.27.3:10401;
server 172.31.27.4:10401;
}


server {
listen 80;
server_name localhost;

location / {
default_type text/html;
set $memcached_key $request_uri;
memcached_pass somestream;
error_page 500 404 405 = @fallback;
}
location @fallback {
root /var/www/howen;
fastcgi_intercept_errors on;
error_page 404 = @404;
set $script $uri;
set $path_info “";
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/howenr/checktt.php;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param REQUEST_URI $uri;
fastcgi_pass 127.0.0.1:9000;
}
}

Nginx

Posted by arkgame