OpenStack集成Ceph对象存储

配置Ceph环境

  1. 在ceph1上执行,修改文件“/etc/ceph/ceph.conf”的配置。

    1
    vim /etc/ceph/ceph.conf
    

    新增以下内容:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    [client.rgw.ceph1]
    host=ceph1
    log file=/var/log/radosgw/client.radosgw.gateway.log
    rgw_frontends = civetweb port=10001
    rgw keystone api version = 3
    rgw keystone url = http://controller:5000
    rgw keystone accepted roles = admin
    rgw keystone token cache size = 500
    rgw keystone revocation interval = 300
    rgw keystone implicit tenants = true
    rgw s3 auth use keystone = true
    rgw keystone admin user = admin
    rgw keystone admin password = <PASSWORD>
    rgw keystone admin tenant = admin
    rgw keystone admin domain = default
    
    [client.rgw.ceph2]
    host=ceph2
    log file=/var/log/radosgw/client.radosgw.gateway.log
    rgw_frontends = civetweb port=10002
    rgw keystone api version = 3
    rgw keystone url = http://controller:5000
    rgw keystone accepted roles = admin
    rgw keystone token cache size = 500
    rgw keystone revocation interval = 300
    rgw keystone implicit tenants = true
    rgw s3 auth use keystone = true
    rgw keystone admin user = admin
    rgw keystone admin password = <PASSWORD>
    rgw keystone admin tenant = admin
    rgw keystone admin domain = default
    
    [client.rgw.ceph3]
    host=ceph3
    log file=/var/log/radosgw/client.radosgw.gateway.log
    rgw_frontends = civetweb port=10003
    rgw keystone api version = 3
    rgw keystone url = http://controller:5000
    rgw keystone accepted roles = admin
    rgw keystone token cache size = 500
    rgw keystone revocation interval = 300
    rgw keystone implicit tenants = true
    rgw s3 auth use keystone = true
    rgw keystone admin user = admin
    rgw keystone admin password = <PASSWORD>
    rgw keystone admin tenant = admin
    rgw keystone admin domain = default
    

    PASSWORD是rgw keystone admin的密码,需根据情况修改。

  2. 在所有集群节点上同步配置文件,在ceph1上执行。

    1
    ceph-deploy --overwrite-conf admin ceph1 ceph2 ceph3
    

  3. ceph1节点执行下列命令,分别为三个ceph节点创建一个rgw实例。

    1
    2
    3
    ceph-deploy rgw create ceph1:ceph1
    ceph-deploy rgw create ceph2:ceph2
    ceph-deploy rgw create ceph3:ceph3
    

  4. 上述命令执行成功后,在各个ceph节点检查rgw服务是否成功启动。

    1
    netstat -ntlp | grep radosgw
    

  5. 在ceph1节点上执行,创建对象存储池,设置好pg和pgp的数值。

    1
    2
    ceph osd pool create default.rgw.buckets.data 64 64
    ceph osd pool create default.rgw.buckets.index 16 16
    

  6. 查看存储池是否创建成功。

    1
    ceph osd pool ls
    

  7. 在ceph1上执行,为Ceph对象存储网关创建一个admin用户。

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

  8. 在ceph1上执行,为Ceph对象存储网关创建一个swift子用户。

    1
    radosgw-admin subuser create --uid=testuser --subuser=testuser:swift --access=full
    

配置Swift集成Ceph

  1. 在OpenStack controller节点上执行,查看OpenStack环境中swift存储的endpoint。

    1
    2
    source /etc/keystone/admin-openrc
    openstack endpoint list | grep swift
    
    • 若环境中不存在swift的endpoint,则直接进行下一步,创建新的endpoint。
    • 若环境中存在swift的endpoint,需要使用以下命令删除已有的swift endpoint。
    1
    openstack endpoint delete SWIFT_ENDPOINT_ID
    

    SWIFT_ENDPOINT_ID为swift endpoint list中的第一项ID。

  2. 在控制节点上创建新的openstack endpoint,URL指向ceph1的RGW端口。

    1
    2
    3
    openstack endpoint create --region RegionOne object-store public "http://ceph1:10001/swift/v1"
    openstack endpoint create --region RegionOne object-store internal "http://ceph1:10001/swift/v1"
    openstack endpoint create --region RegionOne object-store admin "http://ceph1:10001/swift/v1"
    

  3. 在控制节点上运行swift list,若无报错,则Swift集成Ceph已经完成。

    1
    swift list