---
title: 配置对象存储
description: "本小节仅需在主节点ceph1节点上执行。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengsdss/ecosystemEnable/Ceph/kunpengcephansible_04_0007.html
sourcePath: /source/zh/kunpengsdss/ecosystemEnable/Ceph/kunpengcephansible_04_0007.html
indexId: 03b9c75a826046182bbe97539d8a73d06070a2606ab14415ba4b310dd1e694bf75
---
# 配置对象存储

本小节仅需在主节点ceph1节点上执行。


#### 定义Ceph服务需求

1. 进入site.yml文件。
  1 2 cp /home/ceph-ansible/site.yml.sample /home/ceph-ansible/site.yml vim /home/ceph-ansible/site.yml

2. 在“hosts”选项下，增加rgws的定义。
  1 2 3 4 5 6 7 8 9 10 11 12 13 - hosts: - mons - osds # - mdss - rgws # - nfss # - rbdmirrors - clients - mgrs # - iscsigws # - iscsi-gws # for backward compatibility only! # - grafana-server # - rgwloadbalancers


#### 定义集群主机服务

```
vim /home/ceph-ansible/hosts
```

定义RGW服务所在的节点，本例为ceph1，ceph2主机。```
[mons]
ceph1

[mgrs]
ceph1

[osds]
ceph1
ceph2

#[mdss]
#ceph1
#ceph2

[rgws]
ceph1
ceph2

[clients]
client3


[grafana-server]
ceph1
```


#### 定义Ceph集群配置

```
vim /home/ceph-ansible/group_vars/all.yml
```

在all.yml中，设置前端网络类型，端口，每个RGW节点的RGW实例数。

- Ceph在线下载方式：
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ceph_origin: repository ceph_repository: community ceph_mirror: http://download.ceph.com ceph_stable_release: nautilus ceph_stable_repo: "{{ ceph_mirror }}/rpm-{{ ceph_stable_release }}" ceph_stable_redhat_distro: el7 monitor_interface: enp133s0 journal_size: 5120 public_network: 172.19.106.0/0 cluster_network: 172.19.106.0/0 osd_objectstore: bluestore ## Rados Gateway options radosgw_frontend_type: beast radosgw_frontend_port: 12345 radosgw_interface: "{{monitor_interface}}" radosgw_num_instances: 3

  部分参数填写说明如表1所示。

**表1 参数填写说明**

| 参数 | 说明 |
| --- | --- |
| monitor\_interface | Public Network的网口设备ID |
| radosgw\_frontend\_type | RGW前端类型，根据需要选填 |
| radosgw\_frontend\_port | RGW前端端口，根据需要选填 |
| radosgw\_num\_instances | 设置每个节点上RGW的实例个数，此时RGW的访问端口基于radosgw\_frontend\_port指定的端口号递增 |


- Ceph离线下载方式：
  1 2 3 ceph_origin: distro ceph_repository: local ceph_stable_release: nautilus


#### 设置RGW服务的权限

在rgws.yml文件中设置RGW默认数据池和索引池的pg num和size，以及RGW服务能否访问私有设备的权限。

- CentOS 7.6
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 rgw_create_pools: defaults.rgw.buckets.data: pg_num: 8 size: "" defaults.rgw.buckets.index: pg_num: 8 size: "" ########### # SYSTEMD # ########### # ceph_rgw_systemd_overrides will override the systemd settings # for the ceph-rgw services. # For example,to set "PrivateDevices=false" you can specify: ceph_rgw_systemd_overrides: Service: PrivateDevices: False

- openEuler 20.03
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 rgw_create_pools: defaults.rgw.buckets.data: pg_num: 64 size: 3 defaults.rgw.buckets.index: pg_num: 64 size: 3 ########### # SYSTEMD # ########### # ceph_rgw_systemd_overrides will override the systemd settings # for the ceph-rgw services. # For example,to set "PrivateDevices=false" you can specify: ceph_rgw_systemd_overrides: Service: PrivateDevices: False


#### 定义OSD

参照定义OSD的方法，定义相应的OSD。
