温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

如何实现单机部署多CEPH-RGW

发布时间:2021-12-17 10:12:06 来源:亿速云 阅读:263 作者:小新 栏目:云计算

小编给大家分享一下如何实现单机部署多CEPH-RGW,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

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负载均衡设计

如何实现单机部署多CEPH-RGW

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错误。我会进一步跟进这个错误。

以上是“如何实现单机部署多CEPH-RGW”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI