首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

使用ceph的对象存储(1)

使用ceph的对象存储(1)

Ceph 对象存储

Ceph 对象存储使用 Ceph 对象网关守护进程( radosgw ),它是个与 Ceph 存储集群交互的 FastCGI 模块。因为它提供了与 OpenStack Swift 和 Amazon S3 兼容的接口, RADOS 要有它自己的用户管理。 Ceph 对象网关可与 Ceph FS 客户端或 Ceph 块设备客户端共用一个存储集群。 S3 和 Swift 接口共用一个通用命名空间,所以你可以用一个接口写如数据、然后用另一个接口取出数据。

Ceph 对象网关是一个构建在 librados 之上的对象存储接口,它为应用程序访问Ceph 存储集群提供了一个 RESTful 风格的网关 。 Ceph 对象存储支持 2 种接口:

兼容S3: 提供了对象存储接口,兼容 亚马逊S3 RESTful 接口的一个大子集。
兼容Swift: 提供了对象存储接口,兼容 Openstack Swift 接口的一个大子集。

更多信息
http://docs.ceph.org.cn/radosgw/
安装Ceph对象网关

Ceph 对象存储使用 Ceph 对象网关守护进程( radosgw ),所以在使用对象存储之前,我们需要先安装配置好对象网关RGW。

Ceph RGW的FastCGI支持多种Web服务器作为前端,例如Nginx、Apache2等。 从Ceph Hammer版本开始,使用ceph-deploy部署时将会默认使用内置的civetweb作为前端,区别在于配置的方式不同,我们这里采用默认civetweb方式安装配置RGW。

Ceph 从 v0.80 开始,使用内嵌 Civetweb 作为 Web Server,无需额外安装 web 服务器或配置 FastCGI,其默认端口为 7480。在 admi管理节点目录通过 ceph-deploy 安装 Ceph RGW。这里我们还是使用admin节点做测试。

使用nginx方式可参考链接 https://blog.frognew.com/2017/02/ceph-rgw.html

使用apache方式可参考官网链接:
http://docs.ceph.org.cn/radosgw/config/

在规划的作为网关的服务器中,使用命令运行安装网关服务

sudo yum install -y ceph-radosgw


创建RGW用户和keyring

在规划的作为网关的服务器上创建keyring:

sudo ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.keyring
sudo chmod +r /etc/ceph/ceph.client.radosgw.keyring



生成ceph-radosgw服务对应的用户和key:

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


为用户添加访问权限:

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


导入keyring到集群配置文件中:

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



把集群配置文件推送到其他机子

需要两边的机子都安装有scp服务
使用命令

sudo yum install openssh-clients



推送key使用命令

sudo scp /etc/ceph/ceph.client.radosgw.keyring  ceph1:/etc/ceph
sudo ssh ceph1
chmod 777   /etc/ceph/ceph.client.radosgw.keyring
exit
sudo scp /etc/ceph/ceph.client.radosgw.keyring  ceph2:/etc/ceph
sudo ssh ceph2
chmod 777   /etc/ceph/ceph.client.radosgw.keyring
exit
sudo scp /etc/ceph/ceph.client.radosgw.keyring  ceph3:/etc/ceph
sudo ssh ceph3
chmod 777   /etc/ceph/ceph.client.radosgw.keyring
exit
sudo scp /etc/ceph/ceph.client.radosgw.keyring  ceph4:/etc/ceph
sudo ssh ceph4
chmod 777   /etc/ceph/ceph.client.radosgw.keyring
exit



创建资源池

由于RGW要求专门的pool存储数据,这里手动创建这些Pool,在任意ceph节点上执行:

ceph osd pool create .rgw 128 128
ceph osd pool create .rgw.root 128 128
ceph osd pool create .rgw.control 128 128
ceph osd pool create .rgw.gc 128 128
ceph osd pool create .rgw.buckets 128 128
ceph osd pool create .rgw.buckets.index 128 128
ceph osd pool create .rgw.buckets.extra 128 128
ceph osd pool create .log 128 128
ceph osd pool create .intent-log 128 128
ceph osd pool create .usage 128 128
ceph osd pool create .users 128 128
ceph osd pool create .users.email 128 128
ceph osd pool create .users.swift 128 128
ceph osd pool create .users.uid 128 128



列出pool信息确认全部成功创建:

rados lspools



输出如下:

.rgw
.rgw.root
.rgw.control
.rgw.gc
.rgw.buckets
.rgw.buckets.index
.rgw.buckets.extra
.log
.intent-log
.usage
.users
.users.email
.users.swift
.users.uid
返回列表