Ceph是一个 Linux PB 级分布式文件系统
python
ceph 部署安装请参考:linux
1、在ceph中建立一个pool
api
默认状况下,Ceph块设备使用rbd pool。你能够使用任何可用的pool。咱们建议建立一个新的pool。确保你的Ceph集群正在运行,而后建立池。bash
ceph osd pool create volumes 128 ceph osd pool create p_w_picpaths 128
2、配置 OpenStack Ceph 客户端
服务器
一、openstack 运行 glance-api, nova-compute, and nova-volume orcinder-volume的服务器须要 ceph.conf配置文件:ssh
ssh {your-openstack-server} sudo tee /etc/ceph/ceph.conf </etc/ceph/ceph.conf
二、安装ceph客户端
分布式
sudo apt-get install python-ceph sudo apt-get install ceph-common
三、设置Ceph客户端身份验证
ide
(1)对于Ceph版本0.53或更低,执行如下:测试
ceph auth get-or-create client.volumes mon 'allow r' osd 'allow x, allow rwx pool=volumes, allow rx pool=p_w_picpaths' ceph auth get-or-create client.p_w_picpaths mon 'allow r' osd 'allow x, allow rwx pool=p_w_picpaths'
(2)在Ceph 0.54或更高版本,添加了更多的具体权限,执行如下:
url
ceph auth get-or-create client.volumes mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=volumes, allow rx pool=p_w_picpaths' ceph auth get-or-create client.p_w_picpaths mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=p_w_picpaths'
(3)为客户端client.volumes 和 client.p_w_picpaths添加key
ceph auth get-or-create client.p_w_picpaths | ssh {your-glance-api-server} sudo tee /etc/ceph/ceph.client.p_w_picpaths.keyring ssh {your-glance-api-server} sudo chown glance:glance /etc/ceph/ceph.client.p_w_picpaths.keyring ceph auth get-or-create client.volumes | ssh {your-volume-server} sudo tee /etc/ceph/ceph.client.volumes.keyring ssh {your-volume-server} sudo chown cinder:cinder /etc/ceph/ceph.client.volumes.keyring
3、配置openstack 使用ceph
一、配置glance
修改 /etc/glance/glance-api.conf 文件配置如下内容:
default_store=rbd rbd_store_user=p_w_picpaths rbd_store_pool=p_w_picpaths show_p_w_picpath_direct_url=True
二、配置Cinder/nova-volume
修改 /etc/cinder/cinder.conf 文件配置如下内容:
volume_driver=cinder.volume.driver.RBDDriver rbd_pool=volumes
三、重启openstack相关服务
sudo service glance-api restart sudo service nova-compute restart sudo service cinder-volume restart
4、测试
一、建立volume存储
cinder create --p_w_picpath-id {id of p_w_picpath} --display-name {name of volume} {size of volume}
二、上传镜像
glance --os_username={TENANT_NAME} --os_password={TENANT_PASS} --os_tenant={TENANT} --os_auth_url={OS_AUTH_URL} add name="{glance_name}" disk_format=aki container_format=aki < {IMAGE_FILE}
5、查看pool
这个环境中glance没有使用ceph
rados df pool name category KB objects clones degraded unfound rd rd KB wr wr KB volumes - 9618834 2586 0 0 0 20 3 71686 37911743 data - 0 0 0 0 0 0 0 0 0 metadata - 9 21 0 0 0 11 0 52 26 rbd - 0 0 0 0 0 0 0 0 0 total used 23486608 2607 total avail 176679288 total space 200165896