###glance nova glusterfs 配置
#安装glusterfs 并挂载
###所有节点执行
echo "
192.168.0.171 node171
192.168.0.172 node172
192.168.0.172 node173" >>/etc/hosts
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
yum install -y centos-release-gluster
yum install glusterfs-server -y
systemctl restart glusterd.service
systemctl enable glusterd.service
mkdir -p /gfs1
##gluster peer probe hostname
####只在主节点
gluster peer probe node171
gluster peer probe node172
gluster peer probe node173
###查看集群状态:
gluster peer status
###所有节点执行
##创建GlusterFS磁盘: 复制模式
gluster volume create gv1 replica 3 transport tcp node171:/gfs1 node172:/gfs1 node173:/gfs1 force
#启动 gv1
gluster volume start gv1
###再查看 volume 状态:
gluster volume info
#####################所有节点执行
####客户端挂载volume
yum install -y centos-release-gluster
yum install -y glusterfs glusterfs-fuse
mkdir -p /data/gv1
mount -t glusterfs localhost:gv1 /data/gv1
echo 'localhost:/gv1 /data/gv1 glusterfs _netdev,rw,acl 0 0' >>/etc/fstab
#################nfs 配置 挂载
####所有节点执行
yum install -y nfs-utils rpcbind
systemctl enable rpcbind nfs
systemctl restart rpcbind nfs
######
mkdir -p /gfs1/{images,$(hostname)/instances}
echo "
/gfs1/images 192.168.0.0/22 (rw,sync,all_squash,anonuid=$(id -u glance),anongid=$(id -g glance))
/gfs1/$(hostname)/instances 192.168.0.0/22 (rw,sync,all_squash,anonuid=$(id -u nova),anongid=$(id -g nova))
" >/etc/exports
systemctl restart nfs
rsync -avzP /var/lib/glance/images /data/gv1/
rsync -avzP /var/lib/nova/instances /data/gv1/$(hostname)/
mount -t nfs localhost:/gfs1/images /var/lib/glance/images
mount -t nfs localhost:/gfs1/$(hostname)/instances /var/lib/nova/instances
echo "localhost:/gfs1/images /var/lib/glance/images nfs defaults 0 0" >>/etc/fstab
echo "localhost:/gfs1/$(hostname)/instances /var/lib/nova/instances nfs defaults 0 0" >>/etc/fstab
tail /etc/fstab