[](
)一、完成主机名映射
ALL:cat /etc/hosts
10.1.2.156 iscsiStorage
10.1.2.157 node1
10.1.2.158 node2
192.168.100.157 node1-yw
192.168.100.158 node2-yw
172.16.100.157 node1-xt
172.16.100.158 node2-xt
[](
)二、配置yum源
yum配置
[centos]
name=centos
baseurl=file:///opt/centos
enabled=1
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]
|