注意
本文档适用于 Ceph 开发版本。
radosgw -- rados REST gateway
概要
描述
radosgw是 Ceph 分布式存储系统的一部分 RADOS 对象存储的 HTTP REST 网关。它使用 libfcgi 实现为 FastCGI 模块,并且可以与任何支持 FastCGI 的 Web 服务器一起使用。
选项
- -c ceph.conf, --conf=ceph.conf
使用
ceph.conf
配置文件而不是默认的/etc/ceph/ceph.conf
在启动期间确定监控器地址。
- -m monaddress[:port]
连接到指定的监控器(而不是通过
ceph.conf
搜索)。
- -i ID, --id ID
设置 radosgw 的名称 ID 部分
- -n TYPE.ID, --name TYPE.ID
设置网关的 rados 用户名(例如 client.radosgw.gateway)
- --cluster NAME
设置集群名称(默认:ceph)
- -d
在前台运行,记录到stderr
- -f
在前台运行,记录到常规位置
- --rgw-region=region
radosgw 运行的区域
- --rgw-zone=zone
radosgw 运行的区域
配置
早期的 RADOS 网关必须配置Apache
和mod_fastcgi
.mod_proxy_fcgi
模块被使用而不是mod_fastcgi
.
mod_proxy_fcgi
与传统的 FastCGI 模块工作方式不同。该模块需要 FastCGI 协议的服务。因此,为了能够处理 FastCGI 协议,服务器中必须同时存在mod_proxy
,它为 FastCGI 协议提供支持。所以,为了能够处理 FastCGI 协议,服务器中必须同时存在mod_proxy
和mod_proxy_fcgi
。与mod_fastcgi
,
mod_proxy_fcgi
不同,它无法启动应用程序进程。一些平台有fcgistarter
用于此目的。然而,外部启动应用程序或进程管理可能在使用中的 FastCGI 应用程序框架中可用。
Apache
必须以启用mod_proxy_fcgi
与 localhost tcp 一起使用的方式配置。
以下步骤显示了 Ceph 配置文件中的配置,即/etc/ceph/ceph.conf
和网关配置文件,即/etc/httpd/conf.d/rgw.conf
(基于 RPM 的发行版)或/etc/apache2/conf-available/rgw.conf
(基于 Debian 的发行版)与 localhost tcp:
对于使用 localhost TCP 的 Apache 2.2 和早期 Apache 2.4 版本的发行版,将以下内容追加到
/etc/ceph/ceph.conf
:[client.radosgw.gateway] host = {hostname} keyring = /etc/ceph/ceph.client.radosgw.keyring log_file = /var/log/ceph/client.radosgw.gateway.log rgw_frontends = fastcgi socket_port=9000 socket_host=0.0.0.0 rgw_print_continue = false
在网关配置文件中添加以下内容:
对于 Debian/Ubuntu 添加到
/etc/apache2/conf-available/rgw.conf
:<VirtualHost *:80> ServerName localhost DocumentRoot /var/www/html ErrorLog /var/log/apache2/rgw_error.log CustomLog /var/log/apache2/rgw_access.log combined # LogLevel debug RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] SetEnv proxy-nokeepalive 1 ProxyPass / fcgi://localhost:9000/ </VirtualHost>
对于 CentOS/RHEL 添加到
/etc/httpd/conf.d/rgw.conf
:<VirtualHost *:80> ServerName localhost DocumentRoot /var/www/html ErrorLog /var/log/httpd/rgw_error.log CustomLog /var/log/httpd/rgw_access.log combined # LogLevel debug RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] SetEnv proxy-nokeepalive 1 ProxyPass / fcgi://localhost:9000/ </VirtualHost>
在网关配置文件中添加以下内容:
对于 CentOS/RHEL 添加到
/etc/httpd/conf.d/rgw.conf
:<VirtualHost *:80> ServerName localhost DocumentRoot /var/www/html ErrorLog /var/log/httpd/rgw_error.log CustomLog /var/log/httpd/rgw_access.log combined # LogLevel debug RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] SetEnv proxy-nokeepalive 1 ProxyPass / unix:///var/run/ceph/ceph.radosgw.gateway.fastcgi.sock|fcgi://localhost:9000/ </VirtualHost>
为 radosgw 生成用于与集群进行身份验证的密钥。
ceph-authtool -C -n client.radosgw.gateway --gen-key /etc/ceph/keyring.radosgw.gateway ceph-authtool -n client.radosgw.gateway --cap mon 'allow rw' --cap osd 'allow rwx' /etc/ceph/keyring.radosgw.gateway
将密钥添加到 auth 条目中。
ceph auth add client.radosgw.gateway --in-file=keyring.radosgw.gateway
启动 Apache 和 radosgw。
Debian/Ubuntu:
sudo /etc/init.d/apache2 start sudo /etc/init.d/radosgw start
CentOS/RHEL:
sudo apachectl start sudo /etc/init.d/ceph-radosgw start
使用日志记录
radosgw维护一个异步使用日志。它积累有关用户操作的信息,并定期刷新。可以通过radosgw-admin.
访问和管理日志。正在记录的信息包含总数据传输量、总操作次数和总成功操作次数。数据在桶所有者下按小时分辨率进行统计,除非操作是在服务上执行的(例如,当列出桶时),在这种情况下,它是在操作用户下进行统计的。
以下是一个示例配置:
[client.radosgw.gateway]
rgw_enable_usage_log = true
rgw_usage_log_tick_interval = 30
rgw_usage_log_flush_threshold = 1024
rgw_usage_max_shards = 32
rgw_usage_max_user_shards = 1
总分片数决定了多少个总对象持有使用日志信息。每个用户的分片数指定了多少个对象持有单个用户的使用信息。滴答间隔配置了日志刷新之间的秒数,刷新阈值指定在转而使用同步刷新之前可以保留多少个条目。
可用性
radosgw是Ceph的一部分,Ceph是一个大规模可扩展、开源的分布式存储系统。有关更多信息,请参阅https://docs.ceph.com的Ceph文档。
参见
ceph(8)radosgw-admin(8)
由 Ceph 基金会提供
Ceph 文档是一个由非盈利Ceph 基金会资助和托管的社会资源。。如果您想支持此项目和其他工作,请考虑现在加入.