作者:幸运我是一阵风些_516 | 来源:互联网 | 2014-05-27 20:14
Openstack对象存储swift多代理的安装部署参考上篇《Openstack存储swift多代理节点安装配置》此文为用Nginx实现负载均衡Openstack对象存储swift多代理的配置1、下载Nginxcd/usr/local/src/wget-Shttp://nginx.org/download/nginx-
Openstack对象存储swift多代理的安装部署参考上篇《Openstack存储swift多代理节点安装配置》
此文为用Nginx实现负载均衡Openstack对象存储swift多代理的配置
1、下载Nginx
cd /usr/local/src/
wget -S http://
nginx.org/download/
nginx-1.2.6.tar.gz
2、创建用户
useradd -c "Nginx User" -s /sbin/nologin -r -d /var/lib/nginx nginx
3、安装Nginx
tar xzvf nginx-1.2.6.tar.gz
cd nginx-1.2.6/
./configure \
--user=nginx \
--group=nginx \
--prefix=/usr/share \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/log/run/nginx.pid \
--lock-path=/var/log/lock/subsys/nginx \
--with-http_stub_status_module \
--without-poll_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_ssl_module
make
make install
4、修改配置文件/etc/nginx/nginx.conf
cat /etc/nginx/nginx.conf | grep -v ^$ | grep -v .*#
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 6024M; #限制用户上传大小
proxy_ignore_client_abort on; #解决499错误,意思是代理服务器不要主动关闭客户端连接
upstream swift {
server 192.168.100.7:8080; #此次ip为proxy的swift ip
server 192.168.100.8:8080;
}
server {
listen 8080;
server_name swift; #主机名称
location / {
proxy_pass http://swift/; #upstream 一致
}
error_page 500
502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
5、启动Nginx
/usr/sbin/nginx
netstat -ltunp | grep 8080
备注:记得只需要在endpoint里指向nginx服务器地址信息,其它proxy节点不需要指定。