KVM+GFS分布式存储系统构建KVM高可用

一、安装部署KVM虚拟化平台

1、安装KVM虚拟化平台

yum -y install qemu-kvm qemu-kvm-tools virt-install qemu-img bridge-utils libvirt virt-manager

2、验证

cat /proc/cpuinfo | grep vmx

lsmod | grep kvm

3、开启libvirtd服务

systemctl start libvirtd && systemctl enable libvirtd

二、部署GlusterFS

1、在所有节点上执行如下操作:

systemctl stop firewalld && systemctl disable firewalld

setenforce 0 && sed -i s/enforcing/disabled/g /etc/selinux/config

cat >> /etc/hosts<<EOF

192.168.180.210 node1

192.168.180.200 node2

192.168.180.190 node3

192.168.180.180 node4

192.168.180.170 kvm

EOF

2、所有主机修改主机名称

以node1为例

hostnamectl set-hostname node1

3、在4个节点服务器上安装GlusterFS并启动服务

yum -y install centos-release-gluster

yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma openssl-devel

systemctl start glusterd.service && systemctl enable glusterd.service

4、在node1上添加所有节点

gluster peer probe node2 && gluster peer probe node3 && gluster peer probe node4

5、查看群集状态

gluster peer status

6、创建GlusterFS分布式复制卷并启动卷

所有节点创建/data目录

mkdir /data

创建分布式复制卷

gluster volume create models replica 2 node1:/data node2:/data node3:/data node4:/data force

查看models卷

gluster volume info models

启动models卷

gluster volume start models

7、在KVM主机上挂载glusterfs卷

yum -y install glusterfs glusterfs-fuse

mkdir /kvmdata

mount -t glusterfs node1:models /kvmdata/

8、kvm使用卷创建虚拟机

添加镜像存储池ISO 以及虚拟机存放目录存储池data,把两个存储池存放到glusterfs 挂载的/kvmdata 目录下

指定虚拟机安装位置,将文件存放到/kvmdata中

virt-install -n test05 -r 1024 --vcpus=1 --disk path=/kvmdata/test05.qcow2,size=10 -w bridge:br0 --virt-type=kvm --accelerate --autostart -c /data_kvm/iso/CentOS-7-x86_64-DVD-2009.iso --vnc --vncport=5901 --vnclisten=0.0.0.0

9、验证存储

virsh list --all

在四台节点上查看目录里是否存在虚拟机文件

相关推荐
chlk12321 小时前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑21 小时前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件1 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号1 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash1 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI2 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行3 天前
Linux和window共享文件夹
linux
Sinclair3 天前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
木心月转码ing3 天前
WSL+Cpp开发环境配置
linux
初次攀爬者4 天前
ZooKeeper 实现分布式锁的两种方式
分布式·后端·zookeeper