写点什么

基于 iscsi 存储的 kvm 动态迁移(V2V)

  • 2021 年 11 月 11 日
  • 本文字数:2870 字

    阅读完需:约 9 分钟

gpgcheck=0

三、安装虚拟化软件

yum groups install -y "Virtualization Platform "


yum groups install -y "Virtualization Hypervisor "


yum groups install -y "Virtualization Tools "


yum groups install -y "Virtualization Client "


SSH 互信


ALL: ssh-keygen -t rsa -P ''


ALL: ssh-copy-id -i ~/.ssh/id_rsa.pub root@node1


ALL: ssh-copy-id -i ~/.ssh/id_rsa.pub root@node2


ALL:mkdir /kvm-hosts/


在 vmware 的虚拟机中安装包


ALL: yum group install virtualization-client -y


ALL: yum group install gnome-desktop -y


ALL: yum install -y tigervnc-server tigervnc


ALL: systemctl stop firewalld


ALL: systemctl disable firewalld


群集软件包安装


ALL:yum install bash-completion ntpdate tigervnc-server iscsi-initiator-utils pacemaker corosync pcs psmisc policycoreutils-python fence-agents-all dlm lvm2-cluster gfs2-utils -y


ALL: systemctl start pcsd


ALL: systemctl enable pcsd


ALL:echo "a" | passwd --stdin hacluster


单(): pcs cluster auth node1 node2 -u hacluster -p a


单(): pcs cluster setup --name kvm-ha-cluster node1 node2


单(): pcs cluster start --all


单(): pcs cluster enable --all


查看 iscsi initiator 的 IQN


ALL:yum install iscsi-initiator-utils


ALL:vi /etc/iscsi/initiatorname.iscsi


获得 iqn.1994-05.com.redhat:node(x)


四、ISCSI 服务器的配置




yum 配置


[centos]


name=centos


baseurl=file:///opt/centos


enabled=1


gpgcheck=0


网络配置


10.1.2.156 iscsiStorage


10.1.2.157 node1


10.1.2.158 node2


systemctl stop firewalld


systemctl disable firewalld


分两个区出来:


[root@localhost ~]# fdisk -l


Device Boot Start End Blocks Id System


/dev/sdb1 2048 83888127 41943040 83 Linux


/dev/sdb2 83888128 85985279 1048576 83 Linux


配置 iscsi


yum install -y targetcli


/targetcli 的对应目录下面/


/1、block/


create wang1 dev=/dev/sdb1


create wang2 dev=/dev/sdb2


/2、iscsi/


create iqn.2019-05.wangyu.name:tomstor1


/3、lun/


create /backstores/block/wang1


create /backstores/block/wang2


/4、acl/


create iqn.1994-05.com.redhat:node1


create iqn.1994-05.com.redhat:node2


cd /


/> ls


o- / ............................................................................... [...]


o- backstores .................................................................... [...]


| o- block ........................................................ [Storage Objects: 2]


| | o- caq1 ................................. [/dev/sdb1 (60.0GiB) write-thru activated]


| | | o- alua ......................................................... [ALUA Groups: 1]


| | | o- default_tg_pt_gp ............................. [ALUA state: Active/optimized]


| | o- caq2 ................................. [/dev/sdb2 (20.0GiB) write-thru activated]


| | o- alua ......................................................... [ALUA Groups: 1]


| | o- default_tg_pt_gp ............................. [ALUA state: Active/optimized]


| o- fileio ....................................................... [Storage Objects: 0]


| o- pscsi ........................................................ [Storage Objects: 0]


| o- ramdisk ...................................................... [Storage Objects: 0]


o- iscsi .................................................................. [Targets: 1]


| o- iqn.2020-05.caq.name:tomstor1 ........................................... [TPGs: 1]


| o- tpg1 ..................................................... [no-gen-acls, no-auth]


| o- acls ................................................................ [ACLs: 2]


| | o- iqn.1994-05.com.redhat:rs1 ................................. [Mapped LUNs: 2]


| | | o- mapped_lun0 ........................................ [lun0 block/caq1 (rw)]


| | | o- mapped_lun1 ........................................ [lun1 block/caq2 (rw)]


| | o- iqn.1994-05.com.redhat:rs2 ................................. [Mapped LUNs: 2]


| | o- mapped_lun0 ........................................ [lun0 block/caq1 (rw)]


| | o- mapped_lun1 ........................................ [lun1 block/caq2 (rw)]


| o- luns ................................................................ [LUNs: 2]


| | o- lun0 ............................ [block/caq1 (/dev/sdb1) (default_tg_pt_gp)]


| | o- lun1 ............................ [block/caq2 (/dev/sdb2) (default_tg_pt_gp)]


| o- portals .......................................................... [Portals: 1]


| o- 0.0.0.0:3260 ........................................................... [OK]


o- loopback ............................................................... [Targets: 0]


/>


saveconfig


exit


systemctl start target


systemctl enable target


五、计算节点配置




ALL: iscsiadm --mode discovery --type sendtargets --portal 10.1.2.156


ALL: iscsiadm -m node -L all


ALL: fdisk -l


单(): ll /dev/disk/by-id/ |grep sd


#找最小(sdb)的 wwn 那个,做 stonith 隔离设备(防止脑裂现象)


pcs stonith create scsi-shooter fence_scsi pcmk_host_list="node1 node2" devices="/dev/disk/by-id/wwn-0x6001405a0dbafe526bc4a8484a66475b" meta provides=unfencing


单(): pcs resource create dlm ocf:pacemaker:controld op monitor interval=30s on-fail=fence clone interleave=true ordered=true


ALL:pcs status #可以在双节点看一下是否成功了


ALL:lvmconf --enable-cluster


ALL:reboot


重启后可以 pcs status 看到都启动的状态

向群集中添加资源,clvm,它是群集化的逻辑资源卷管理

单(): pcs resource create clvmd ocf:heartbeat:clvm op monitor interval=30s on-fail=fence clone interleave=true ordered=true


单():pcs constraint


【一线大厂Java面试题解析+后端开发学习笔记+最新架构讲解视频+实战项目源码讲义】
浏览器打开:qq.cn.hn/FTf 免费领取
复制代码


order start dlm-clone then clvmd-clone


单():pcs constraint colocation add clvmd-clone with dlm-clone


fdisk /dev/sdc //分一个区,并指定为 8e 类型


ALL:partprobe ; multipath -r


单():pvcreate /dev/sdc1


单():vgcreate vmvg0 /dev/sdc1


//lvcreate -n lvvm0 -l 100%FREE vmvg0


单():lvcreate -n lvvm0 -L 20G vmvg0


单():mkfs.gfs2 -p lock_dlm -j 2 -t kvm-ha-cluster:kvm /dev/vmvg0/lvvm0

评论

发布
暂无评论
基于iscsi存储的kvm动态迁移(V2V)