如果存储服务器到交换机只有一条线路的时候,那么一条线路出线故障,整个就没法使用了,所以多线路可以解决这个问题,避免单点故障

esxi怎么配置多路径 esxi存储多路径_Desktop


通过VMware模拟多路径,使用下面的拓扑:

esxi怎么配置多路径 esxi存储多路径_运维_02


实验环境: 63,64配置双网卡 。

服务端:63.cn IP:192.168.1.63 ens32 ,br ; IP:192.168.2.63 ens35 , vmnet4

客户端:64.cn IP:192.168.1.64 ens32 ,br ; IP:192.168.2.64 ens35 , vmnet4

将63配置成ip san,将63上的sdb1分区,通过ip san 共享出去。
服务器端: target 63
客户端: initiator 64

配置网络环境:

xuegod63 添加一块网卡:

esxi怎么配置多路径 esxi存储多路径_客户端_03


生成ens35配置文件,配置IP ,192.168.2.63

63 ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens35

esxi怎么配置多路径 esxi存储多路径_服务器_04

63 Desktop]# ifdown ens35;ifup ens35

安装tgtd服务器:
63 Desktop]# yum install -y scsi-target-utils
准备一个磁盘: sda4
63 ~]# fdisk /dev/sda #划分出sda4 分区
 WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
 switch off the mode (command ‘c’) and change display units to
 sectors (command ‘u’).Command (m for help): p
Disk /dev/sda: 21.5 GB, 21474836480 bytes
 255 heads, 63 sectors/track, 2610 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk identifier: 0x000b8b35
 Device Boot Start End Blocks Id System
 /dev/sda1 * 1 26 204800 83 Linux
 Partition 1 does not end on cylinder boundary.
 /dev/sda2 26 1301 10240000 83 Linux
 /dev/sda3 1301 1428 1024000 82 Linux swap / SolarisCommand (m for help): n
 Command action
 e extended
 p primary partition (1-4)
 p
 Selected partition 4
 First cylinder (1428-2610, default 1428):
 Using default value 1428
 Last cylinder, +cylinders or +size{K,M,G} (1428-2610, default 2610): +1GCommand (m for help): w
 The partition table has been altered!Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
 The kernel still uses the old table. The new table will be used at
 the next reboot or after you run partprobe(8) or kpartx(8)
 Syncing disks.
 63 ~]#reboot配置target ,把sda4分区共享出去
 修改配置文件vim /etc/tgt/targets.conf #写入以下内容
 在参考这段内容并在段内容后,追加以下红色标记内容:
 #注释:
 default-driver iscsi #此配置文件默认全部注释,使用iscsi驱动63 Desktop]#systemctl restart tgtd
 63 Desktop]# netstat -antup | grep 3260
 tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN 3130/tgtd
 tcp 0 0 :::3260 ::😗 LISTEN 3130/tgtd4. 查看状态tgt-admin --show
63 Desktop]# tgt-admin --show
 Target 1: iqn.2015-01.cn.xuegod.www:target_san1
 System information:
 Driver: iscsi
 State: ready
 I_T nexus information:
 LUN information:
 LUN: 0
 Type: controller
 SCSI ID: IET 00010000
 SCSI SN: beaf10
 Size: 0 MB, Block size: 1
 Online: Yes
 Removable media: No
 Readonly: No
 Backing store type: null
 Backing store path: None
 Backing store flags:
 LUN: 1
 Type: disk
 SCSI ID: IET 00010001
 SCSI SN: beaf11
 Size: 5372 MB, Block size: 512
 Online: Yes
 Removable media: No
 Readonly: No
 Backing store type: rdwr
 Backing store path: /dev/sda4
 Backing store flags:
 Account information:
 ACL information: #允许哪些客户端可以访问
 192.168.1.64
 192.168.2.64开机启动:
63 Desktop]# chkconfig tgtd on
配置客户端: 64
安装包:
64 ~]# rpm -ivh /mnt/Packages/iscsi-initiator-utils-6.2.0.872-34.el6.x86_64.rpm
需要先发现target存储,再启动客户端服务,才有效
64 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.1.63:3260
 Starting iscsid: [ OK ] #发现时,会自动把iscsid服务启动
 192.168.1.63:3260,1 iqn.2015-01.cn.xuegod.www:target_san164 ~]#systemctl restart scsi # 根据/var/lib/iscsi/ 中发现的信息,识别设备
 Stopping iscsi: [ OK ]
 Starting iscsi: [ OK ]开机自动启动:
64 ~]# systemctl enable iscsi
 64 ~]# systemctl enable iscsid查看发现到新硬盘:
64 ~]# ls /dev/sdb
 /dev/sdb在xuegod63服务端查看链接状态
63 ~]# netstat -antup | grep 3260
 tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN 1999/tgtd
 tcp 0 0 192.168.1.63:3260 192.168.1.64:46553 ESTABLISHED 1999/tgtd
 tcp 0 0 :::3260 ::😗 LISTEN 1999/tgtd客户端从另一条线路发现设备:
64 ~]# iscsiadm -m discovery -t sendtargets -p 192.168.2.63
 192.168.2.63:3260,1 iqn.2015-01.cn.xuegod.www:target_san1
 64 ~]# rpm -ivh /mnt/Packages/tree-1.5.3-2.el6.x86_64.rpm
 64 ~]# tree /var/lib/iscsi/
 /var/lib/iscsi/
 ├── ifaces
 ├── isns
 ├── nodes
 │ └── iqn.2015-01.cn.xuegod.www:target_san1
 │ ├── 192.168.1.63,3260,1
 │ │ └── default
 │ └── 192.168.2.63,3260,1
 │ └── default
 ├── send_targets
 │ ├── 192.168.1.63,3260
 │ │ ├── iqn.2015-01.cn.xuegod.www:target_san1,192.168.1.63,3260,1,default -> /var/lib/iscsi/nodes/iqn.2015-01.cn.xuegod.www:target_san1/192.168.1.63,3260,1
 │ │ └── st_config
 │ └── 192.168.2.63,3260
 │ ├── iqn.2015-01.cn.xuegod.www:target_san1,192.168.2.63,3260,1,default -> /var/lib/iscsi/nodes/iqn.2015-01.cn.xuegod.www:target_san1/192.168.2.63,3260,1
 │ └── st_config识别出硬盘并查看:
64 ~]# /etc/init.d/iscsi restart
 Stopping iscsi: [ OK ]
 Starting iscsi: [ OK ]
 64 ~]# ls /dev/sd*
 /dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sdb /dev/sdc挂载硬盘测试数据:
64 ~]# fdisk /dev/sdb #使用sdb中所有空间,创建sdb1分区
 Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
 Building a new DOS disklabel with disk identifier 0x337c0db1.
 Changes will remain in memory only, until you decide to write them.
 After that, of course, the previous content won’t be recoverable.Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It’s strongly recommended to
 switch off the mode (command ‘c’) and change display units to
 sectors (command ‘u’).Command (m for help): n
 Command action
 e extended
 p primary partition (1-4)
 p
 Partition number (1-4): 1
 First cylinder (1-1019, default 1):
 Using default value 1
 Last cylinder, +cylinders or +size{K,M,G} (1-1019, default 1019):
 Using default value 1019