创建3个卷p_w_picpaths、volumes、instances分别对接openstack的glance、cinder、nova组件
p_w_picpaths卷用于存放OpenStack镜像
volumes卷用于存放OpenStack硬盘
instances卷用于存放OpenStack云主机
1、 创建卷
代码语言:javascript复制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/instance1.2.3.4.5.6.7.8.9.10.11.12.13.14.
2、 启动卷
代码语言:javascript复制gluster volume start p_w_picpaths
gluster volume start volumes
gluster volume start instances1.2.3.
3、 添加p_w_picpaths、instances到fstab自动挂载
代码语言:javascript复制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 01.2.
mount -a 挂载
上述挂载方式使用backupvolfile起到了高可用性,避免单点故障
nova、glance节点要挂载到instances、p_w_picpaths的相关目录,根据实际服务部署情况调整,cinder不太一样,下边会说到。
4、 设置相关权限
代码语言:javascript复制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/volume1.2.3.4.5.6.7.8.9.10.11.
nova要有instance、cinder要有volume、glance要有p_w_picpath的读写权限,根据节点上的服务,给相应的权限。
5、 配置cinder
代码语言:javascript复制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/volumes1.2.3.4.
代码语言:javascript复制touch /etc/cinder/shares.conf
vim /etc/cinder/shares.conf #添加以下内容
controller1:/volumes
controller2:/volumes
compute01:/volumes1.2.3.4.5.
#设置相关权限
代码语言:javascript复制chown -R cinder.cinder/etc/cinder/shares.conf
chown -R cinder:cinder /var/lib/cinder/*1.2.
6、 重启openstack相关服务
代码语言:javascript复制openstack-service restart nova
openstack-service restart cinder
openstack-service restart glance1.2.3.