GlusterFS做爲OpenStack後端存儲

建立3個卷p_w_picpathsvolumesinstances分別對接openstackglancecindernova組件vim

p_w_picpaths卷用於存放OpenStack鏡像bash

volumes卷用於存放OpenStack硬盤ide

instances卷用於存放OpenStack雲主機spa

一、  建立卷3d

gluster volume create p_w_picpaths replica 3 \
controller1:/data/brick1/p_w_picpath  controller2:/data/brick1/p_w_picpath  compute01:/data/brick1/p_w_picpath \
controller1:/data/brick2/p_w_picpath  controller2:/data/brick2/p_w_picpath  compute01:/data/brick2/p_w_picpath \
controller1:/data/brick3/p_w_picpath  controller2:/data/brick3/p_w_picpath  compute01:/data/brick3/p_w_picpath
 
gluster volume create volumes replica 3 \
controller1:/data/brick1/volume  controller2:/data/brick1/volume  compute01:/data/brick1/volume \
controller1:/data/brick2/volume  controller2:/data/brick2/volume  compute01:/data/brick2/volume \
controller1:/data/brick3/volume  controller2:/data/brick3/volume  compute01:/data/brick3/volume
 
gluster volume create instances replica 3 \
controller1:/data/brick1/instance  controller2:/data/brick1/instance  compute01:/data/brick1/instance \
controller1:/data/brick2/instance  controller2:/data/brick2/instance  compute01:/data/brick2/instance \
controller1:/data/brick3/instance  controller2:/data/brick3/instance  compute01:/data/brick3/instance

二、  啓動卷rest

gluster volume start p_w_picpaths
gluster volume start volumes
gluster volume start instances

三、  添加p_w_picpathsinstancesfstab自動掛載server

controller1:/p_w_picpaths   /var/lib/glance/p_w_picpaths   glusterfs  defaults,_netdev,backupvolfile-server=controller2,backupvolfile-server=compute01   0 0
controller1:/instances   /var/lib/nova/instances   glusterfs  defaults,_netdev,backupvolfile-server=controller2,backupvolfile-server=compute01   0 0

wKioL1eHgAXxWn6QAABi_uVSj5I817.png

mount  -a 掛載blog

上述掛載方式使用backupvolfile起到了高可用性,避免單點故障ci

novaglance節點要掛載到instancesp_w_picpaths的相關目錄,根據實際服務部署狀況調整,cinder不太同樣,下邊會說到。部署

 四、  設置相關權限

chown -R nova.nova /var/lib/nova/instances
chown -R glance.glance/var/lib/glance/p_w_picpaths
chown -R nova:nova /data/brick1/instance
chown -R nova:nova /data/brick2/instance
chown -R nova:nova /data/brick3/instance
chown -R glance:glance /data/brick1/p_w_picpath
chown -R glance:glance /data/brick2/p_w_picpath
chown -R glance:glance /data/brick3/p_w_picpath
chown -R cinder:cinder /data/brick1/volume
chown -R cinder:cinder /data/brick2/volume
chown -R cinder:cinder /data/brick3/volume

nova要有instancecinder要有volumeglance要有p_w_picpath的讀寫權限,根據節點上的服務,給相應的權限。

五、  配置cinder

cp /etc/cinder/cinder.conf{,.bak}
openstack-config --set/etc/cinder/cinder.conf DEFAULT volume_drivercinder.volume.drivers.glusterfs.GlusterfsDriver
openstack-config --set/etc/cinder/cinder.conf DEFAULT glusterfs_shares_config /etc/cinder/shares.conf
openstack-config --set /etc/cinder/cinder.confDEFAULT glusterfs_mount_point_base /var/lib/cinder/volumes

touch /etc/cinder/shares.conf
vim /etc/cinder/shares.conf  #添加如下內容
controller1:/volumes
controller2:/volumes
compute01:/volumes

#設置相關權限

chown -R cinder.cinder/etc/cinder/shares.conf
chown -R cinder:cinder /var/lib/cinder/*

六、  重啓openstack相關服務

openstack-service restart nova
openstack-service restart cinder
openstack-service restart glance

七、  驗證cinder

wKiom1eHgDiiHBd3AABMAGB-bus967.png

相關文章
相關標籤/搜索