可以利用rgw对ceph中的objectd的metadata进行个性化的筛选与查询
-
创建默认的realm
radosgw-admin realm create --rgw-realm=default --default
realm的作用:相当于是一块领土。
一个realm代表了全局唯一的命名空间,这个命名空间由一个或者多个zonegroup,zonegroup可以包含一个或多个zone,zone包含了桶,桶里包依次存放了对象
-
将默认的zonegroup关联至realm
radosgw-admin zonegroup modify --rgw-zonegroup=default --rgw-realm="default" --master --default
此处是指定默认的realm中的主zonegroup,相当于是君主
一个realm下只能有一个主zonegroup,从的zonegroup可以是0或多个
-
将master zone 关联至 zonegroup
radosgw-admin zone modify --rgw-zone=default --rgw-zonegroup=default --rgw-realm=default --master --default --endpoints=http://172.16.20.65:7480
master zonegroup的master zone,或者说是王国中的国王。中央集权,权力较大,所有用户的创建、删除、修改都必须通过他进行,其他zone创建、删除或者修改桶级别的元数据的所有请求都需要转发给他。不通过他创建的用户,则无法创建桶。
-
更新配置
radosgw-admin period update --commit
-
创建系统用户
# 创建同步用户 radosgw-admin user create --uid=sync --display-name="sync" --access-key=sync --secret=sync --system
各个zone拉取主主zone的数据中心结构都需要通过这个系统用户,需要获取他的AK和SK。系统用户就像一位总管。
-
配置rgw
# 配置网关 [client.rgw.node1] host = node65 rgw_frontends = civetweb port=7480 rgw_content_length_compat = true [client.rgw.node2] host = node66 rgw_frontends = civetweb port=7480 rgw_content_length_compat = true rgw_zone = es-zone
-
启动网关
systemctl start ceph-radosgw@rgw.target
-
配置slave zone (es zone)
RGW支持配置ES参数有:
endpoint 指定要访问的Elasticsearch服务器端点 num_shards (整数) 数据同步初始化时将为Elasticsearch配置的分片数。请注意,初始化后无法更改。此处的任何更改都需要重建Elasticsearch索引并重 新初始化数据同步过程。 num_replicas (整数) 数据同步初始化时将为Elasticsearch配置的副本数。 explicit_custom_meta (正确|错误) 指定是否将对所有用户自定义元数据编制索引,或者用户是否需要配置(在存储桶级别)应为哪些自定义元数据条目编制索引。默认为假 index_buckets_list (以逗号分隔的字符串列表) 如果为空,则将对所有存储桶建立索引。否则,将仅索引此处指定的存储桶。可以提供存储桶前缀(例如foo *)或存储桶后缀(例如* bar)。 approved_owners_list (以逗号分隔的字符串列表) 如果为空,将为所有所有者的存储桶建立索引(受其他限制),否则,将仅对指定所有者拥有的存储桶建立索引。也可以提供后缀和前缀。 override_index_path (串) 如果不为空,则此字符串将用作elasticsearch索引路径。否则,索引路径将在同步初始化时确定并生成。
这些参数我也不知道有没有用,我试了explicit_custom_meta,没有效果
-
配置es-zone
radosgw-admin zone create --rgw-zone es-zone --rgw-zonegroup default --rgw-realm=default --endpoints=http://172.16.20.66:7480 --access-key=sync --secret=sync --tier-type=elasticsearch --tier-config=endpoint=http://172.16.20.66:9200
-
更新配置
radosgw-admin period update --commit
-
创建桶并查看
存在问题
-
无法查询到用户自定义的元数据,但是可以查询到用户自定义的tagging
-
同步数据需要时间
参考: