centos7:
gluster集群部署完毕后,创建一个volume用于存放vm镜像
以/data/test为共享目录,创建一个名为gfs的存储卷,数据复制2份:
sudo gluster volume create gfs replica 2 g{1,2,3,4}.test.com:/data/test # 创建卷
sudo gluster volume start gfs # 启动卷
sudo gluster volume info # 查看卷信息
sudo gluster volume set gfs auth.allow 192.168.10.* # 授权访问
挂载到客户端:
yum -y install glusterfs glusterfs-fuse
mount -t glusterfs g1.test.com:/gfs /mnt/gfs
# 若需要开机自动挂载,请更新/etc/fstab,追加:
g1.test.com:/gfs /mnt/gfs glusterfs defaults,_netdev 0 1
创建kvm虚拟机的磁盘
qemu-img create -f qcow2 gluster://g1.test.com/gfs/ubuntu.img 20G
修改kvm的配置
virsh edit ubuntu
<disk type='network' device='disk'>
<driver name='qemu' type='qcow2'/>
<source protocol='gluster' name='gfs/ubuntu.img'>
<host name='g1.test.com' port='24007' transport='tcp'/>
</source>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
动态迁移
virsh migrate --live --verbose ubuntu qemu+ssh://192.168.10.248/system tcp://192.168.10.248 --unsafe
gluster集群部署完毕后,创建一个volume用于存放vm镜像
以/data/test为共享目录,创建一个名为gfs的存储卷,数据复制2份:
sudo gluster volume create gfs replica 2 g{1,2,3,4}.test.com:/data/test # 创建卷
sudo gluster volume start gfs # 启动卷
sudo gluster volume info # 查看卷信息
sudo gluster volume set gfs auth.allow 192.168.10.* # 授权访问
挂载到客户端:
yum -y install glusterfs glusterfs-fuse
mount -t glusterfs g1.test.com:/gfs /mnt/gfs
# 若需要开机自动挂载,请更新/etc/fstab,追加:
g1.test.com:/gfs /mnt/gfs glusterfs defaults,_netdev 0 1
创建kvm虚拟机的磁盘
qemu-img create -f qcow2 gluster://g1.test.com/gfs/ubuntu.img 20G
修改kvm的配置
virsh edit ubuntu
<disk type='network' device='disk'>
<driver name='qemu' type='qcow2'/>
<source protocol='gluster' name='gfs/ubuntu.img'>
<host name='g1.test.com' port='24007' transport='tcp'/>
</source>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
动态迁移
virsh migrate --live --verbose ubuntu qemu+ssh://192.168.10.248/system tcp://192.168.10.248 --unsafe