创建3个卷images、volumes、instances分别对接openstack的glance、cinder、nova组件
images卷用于存放OpenStack镜像
volumes卷用于存放OpenStack硬盘
instances卷用于存放OpenStack云主机
1、 创建卷
gluster volume create images replica 3 controller1:/data/brick1/image controller2:/data/brick1/image compute01:/data/brick1/image controller1:/data/brick2/image controller2:/data/brick2/image compute01:/data/brick2/image controller1:/data/brick3/image controller2:/data/brick3/image compute01:/data/brick3/image 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
2、 启动卷
gluster volume start images gluster volume start volumes gluster volume start instances
3、 添加images、instances到fstab自动挂载
controller1:/images /var/lib/glance/images 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
mount -a 挂载
上述挂载方式使用backupvolfile起到了高可用性,避免单点故障
nova、glance节点要挂载到instances、images的相关目录,根据实际服务部署情况调整,cinder不太一样,下边会说到。
4、 设置相关权限
chown -R nova.nova /var/lib/nova/instances chown -R glance.glance/var/lib/glance/images 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/image chown -R glance:glance /data/brick2/image chown -R glance:glance /data/brick3/image chown -R cinder:cinder /data/brick1/volume chown -R cinder:cinder /data/brick2/volume chown -R cinder:cinder /data/brick3/volume
nova要有instance、cinder要有volume、glance要有image的读写权限,根据节点上的服务,给相应的权限。
5、 配置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/*
6、 重启openstack相关服务
openstack-service restart nova openstack-service restart cinder openstack-service restart glance
7、 验证cinder
时间: 2024-10-22 02:34:16