单机部署多CEPH-RGW的方法

引言

在高配置服务器,单个RGW的并发量无法充分使用机器的网络带宽资源,本文用于说明如何在单机上部署多RGW的方法。

  1. 如何使nginx和radosgw联合使用
  2. 如何使用配置多nginx,多radosgw

1.nginx Radosgw联合使用

Ceph官网说明了如何使用Apache作为前端Web服务器,后官方又退出Civetweb作为自带的web服务器。不过考虑实际并发性能,我们采用Nginx作为前端web服务器,和radosgw联合使用。

1.1 nginx配置

server {
    listen   80 default;
    #server_name  .com .com.cn .net .cn .org .tv .cc .hk .tw;
    server_name ceph-21;
    location / {
        fastcgi_pass_header Authorization;
        fastcgi_pass_request_headers on;
        fastcgi_param QUERY_STRING  $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param CONTENT_LENGTH $content_length;

        if ($request_method = PUT) {
            rewrite ^ /PUT$request_uri;
        }

        include fastcgi_params;
        fastcgi_pass unix:/var/run/ceph/ceph.radosgw.gateway1.sock;
        }

    location /PUT/ {
        internal;
        fastcgi_pass_header Authorization;
        fastcgi_pass_request_headers on;

        include fastcgi_params;
        fastcgi_param QUERY_STRING  $query_string;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param  CONTENT_TYPE $content_type;
        fastcgi_pass unix:/var/run/ceph/ceph.radosgw.gateway1.sock;
        }

  }

这边需要详细注意的是 fastcgi_pass 参数,注意配置gateway.sock。在参数需要和ceph.conf一一对应。在下文中的rgw配置中,rgw_socket_path 需要与 nginx fastcgi_pass一致,从而可以使得两个进程基于fastcgi进行通信。

1.2 Ceph rgw配置方法

[client.radosgw.gateway1]
host = ceph-21
rgw frontends = fastcgi
log file = /var/log/radosgw/client.radosgw.gateway1.log
keyring = /etc/ceph/ceph.client.radosgw.keyring
rgw_socket_path = /var/run/ceph/ceph.radosgw.gateway1.sock

秦牧羊的博客,详细说明了配置方法

2 单机多radosgw配置

2.1 nginx负载均衡设计

输入图片说明

Nginx0采用upstream进行负载均衡

upstream nginx-upstream-rgw{
    #ip_hash;
    server 10.71.21.31:81;
    server 10.71.21.31:82;
    server 10.71.21.31:83;
    server 10.71.21.31:84;
    server 10.71.21.31:85;
  }

  server {
    listen   80 default;
    server_name demo.ceph.work;
    location / {
                proxy_pass http://nginx-upstream-rgw;
        }
  }

负载均衡参考文档

每个Nginx对应一个rgw,对应的配置方法参考章节1。

3 启动各进程

3.1 启动nginx

/usr/local/nginx/sbin/nginx  -c /usr/local/nginx/conf/nginx.conf
/usr/local/nginx/sbin/nginx  -c /usr/local/nginx/conf/nginx1.conf
/usr/local/nginx/sbin/nginx  -c /usr/local/nginx/conf/nginx2.conf
/usr/local/nginx/sbin/nginx  -c /usr/local/nginx/conf/nginx3.conf
/usr/local/nginx/sbin/nginx  -c /usr/local/nginx/conf/nginx4.conf
/usr/local/nginx/sbin/nginx  -c /usr/local/nginx/conf/nginx5.conf

3.2 启动radosgw

radosgw -c /etc/ceph/ceph.conf -n client.radosgw.gateway1 
radosgw -c /etc/ceph/ceph.conf -n client.radosgw.gateway2
radosgw -c /etc/ceph/ceph.conf -n client.radosgw.gateway3 
radosgw -c /etc/ceph/ceph.conf -n client.radosgw.gateway4 
radosgw -c /etc/ceph/ceph.conf -n client.radosgw.gateway5

4. 结果测试

我对上述结构进行了测试,libs3的read, write, list等操作可以正常访问,后续进一步测试并发能力。 在相同配置下,原来单RGW测试500K并发是200; 现在采用10个实例,现在并发 > 2000. 还是要增强单rgw的并发能力。搞这个多实例也不是个事~~~


在该种模式下,RGW会表现出不稳定的情况,主要体现在当压力过载时,即便停止压力测试,一段时间后再访问,NGINX会爆大量的502错误。我会进一步跟进这个错误。

转载于:https://my.oschina.net/myspaceNUAA/blog/613772

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值