Infernalis版本radosgw如何搭建配置

发布时间:2021-11-18 16:53:38 作者:小新
来源:亿速云 阅读:155

这篇文章将为大家详细讲解有关Infernalis版本radosgw如何搭建配置,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

1.安装apache。

#apt-get install apache2 libapache2-mod-fastcgi

2.配置apache。

  1. 在apache配置文件中添加服务器名称,即:在/etc/apache2/apache2.conf文件添加如下内容:

ServerName {fqdn}

其中fqdn是hostname -f的输出结果。

  1. 使能apache相关模块。

a2enmod proxy_fcgi

a2enmod fastcgi

a2enmod rewrite

  1. 启动apache。

#service apache2 start

3.安装radosgw模块。

#apt-get install radosgw

4.创建radosgw用户和keyring。

  1. 为rgw创建keyring。

#ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.keyring

#chmod +r /etc/ceph/ceph.client.radosgw.keyring

  1. 为rgw用户生成key。

#ceph-authtool /etc/ceph/ceph.client.radosgw.keyring -n client.radosgw.gateway --gen-key

  1. 为rgw用户创建权限。

#ceph-authtool -n client.radosgw.gateway --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.radosgw.keyring

  1. 将rgw用户添加到ceph集群。

#ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.radosgw.gateway -i /etc/ceph/ceph.client.radosgw.keyring

  1. 分发rgw的keyring。

通过ssh命令将/etc/ceph/ceph.client.radosgw.keyring复制到其他rgw节点上。

5.创建pool。

当创建的rgw用户有写权限,则rgw会自动的创建所需的pools,因此该步骤可以省略。

6.配置rgw。

在/etc/ceph/ceph.conf中添加如下内容:

[client.radosgw.gateway]

host = ceph-node1

keyring = /etc/ceph/ceph.client.radosgw.keyring

rgw socket path = /tmp/radosgw.sock

log file = /var/log/radosgw/client.radosgw.gateway.log

rgw print continue = false

创建rgw工作目录:

#mkdir -p /var/lib/ceph/radosgw/ceph-radosgw.gateway

创建rgwlog目录

#mkdir -p /var/log/radosgw

7.启动rgw。

#/etc/init.d/radosgw start

8.配置radosgw网关。

在/etc/apache2/site-available/目录下创建rgw.conf文件且该文件内容如下:

FastCgiExternalServer /var/www/s3gw.fcgi -socket /tmp/radosgw.sock

<VirtualHost *:80>

       ServerName ceph-node1

       ServerAlias ceph-node1

       DocumentRoot /var/www

       RewriteEngine On

       RewriteRule  ^/(.*) /s3gw.fcgi?%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

       <IfModule mod_headers.c>

           Header set Access-Control-Allow-Origin "*"

           Header set Access-Control-Allow-Methods "HEAD,GET,PUT,POST,DELETE,OPTIONS"

           Header set Access-Control-Allow-Headers "authorization,content-type,x-amz-date,x-amz-user-agent,content-md5,neunn-token,neunn-user-id,x-amz-copy-source,x-amz-acl,neunn-radosgw-user-id,neunn-user-adminops"

           Header set Access-Control-Expose-Headers "ETag"

       </IfModule>


       <IfModule mod_fastcgi.c>

       <Directory /var/www>

                       Options +ExecCGI

                       AllowOverride All

                       SetHandler fastcgi-script

                       Order allow,deny

                       Allow from all

                       AuthBasicAuthoritative Off

       </Directory>

       </IfModule>

       AllowEncodedSlashes On

       ErrorLog /var/log/apache2/error.log

       CustomLog /var/log/apache2/access.log combined

       ServerSignature Off

</VirtualHost>

另外在/var/www/目录下创建一个可执行文件s3gw.fcgi且该文件内容如下:

#!/bin/sh

exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n client.radosgw.gateway

9.重新启动apache。

  1. 使能rgw模块。

#a2ensite rgw.conf

#a2dissite 000-default

  1. 重启apache。

#service apache2 restart

10.创建S3用户。

#radosgw-admin user create --uid="testuser" --display-name="First User"

输出内容如下:

{"user_id": "testuser",
"display_name": "First User",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"auid": 0,
"subusers": [],
"keys": [
{ "user": "testuser",
"access_key": "I0PJDPCIYZ665MW88W9R",
"secret_key": "dxaXZ8U90SXydYzyS5ivamEP20hkLSUViiaR+ZDA"}],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": { "enabled": false,
"max_size_kb": -1,
"max_objects": -1},
"user_quota": { "enabled": false,
"max_size_kb": -1,
"max_objects": -1},
"temp_url_keys": []}

其中比较重要的是access_key和secret_key。

11.设置S3用户的访问权限。

#radosgw-admin caps add --uid=testuser --caps="users=*"

#radosgw-admin caps add --uid=testuser --caps="buckets=*"

#radosgw-admin caps add --uid=testuser --caps="metadata=*"

#radosgw-admin caps add --uid=testuser --caps="usage=*"

#radosgw-admin caps add --uid=testuser --caps="zone=*"

12.使用浏览器访问radosgw。

使用通用浏览器访问radosgw的80端口后,在浏览器上会出现如下信息:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">

<Owner>

<ID>anonymous</ID>

<DisplayName/>

</Owner>

<Buckets/>

</ListAllMyBucketsResult>

出现该信息表示radosgw已经搭建成功。

关于“Infernalis版本radosgw如何搭建配置”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。

推荐阅读:
  1. radosgw-admin常用操作
  2. ceph radosgw与keystone整合

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

radosgw

上一篇:怎么解决mysql的Warning问题

下一篇:如何理解K8s中的CNI和CNI 插件

相关阅读

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

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