Configuring Multipath Multipath Environment

Environment introduction:

Modify the configuration based on the ISCSI service to realize the Multipath environment

Server eth0:192.168.4.101 Client eth0:192.168.4.102 in ISCSI service configuration

In Multipath, you need to add another network card eth1 to the Server and Client

Server eth1:192.168.2.101 Client eth0:192.168.2.102

1. Modify the ISCSI ACL configuration on the server side and increase the permission of 192.168.2.102

[root@node1 ~]# tail -5 /etc/tgt/targets.conf
<target iqn.2018-04.com.example.node1:server.target1>
	backing-store /dev/sda1
	initiator-address 192.168.4.102
	initiator-address 192.168.2.102
</target>

2. The client discovers the server share through 192.169.2.101

[root@node2 ~]# iscsiadm --mode discoverydb --type sendtargets --portal 192.168.2.101 --discover

3. Restart the ISCSI service and find that there are two paths connected to the shared storage of the Server

[root@node2 ~]# /etc/init.d/iscsi restart
stop iscsi: [OK]
Starting iscsi: [OK]
[root@node2 ~]# lsblk
NAME                        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0 11: 0 1 1024M 0 rom  
vda                         252:0    0   50G  0 disk
├─vda1                      252:1    0  500M  0 part /boot
└─vda2                      252:2    0 49.5G  0 part
  Ol─VolGroup-lv_root (dm-0) 253: 0 0 47.6G 0 lvm /
  └─VolGroup-lv_swap (dm-1) 253:1    0    2G  0 lvm  [SWAP]
sdb                           8:16   0   20G  0 disk
└─sdb1                        8:17   0  976M  0 part
sdc                           8:32   0   20G  0 disk
└─sdc1                        8:33   0  976M  0 part

4. Install device-mapper-multipath

[root@node2 ~]# yum -y install device-mapper-multipath

5. Turn off the automatic naming function for shared storage and generate a configuration file

[root@node2 ~]# mpathconf --user_friendly_names n
[root@node2 ~]# ls /etc/multipath.conf
/etc/multipath.conf

6. Check the wwid of the connected shared device and confirm that the two target storage devices for multipathing are the same device

[root@node2 ~]# /lib/udev/scsi_id --whitelisted --device=/dev/sdb
1IET 00010001
[root@node2 ~]# /lib/udev/scsi_id --whitelisted --device=/dev/sdc
1IET 00010001

7. Modify the configuration file and start the service

[root@node2 ~]# sed -n '25,28p;102,107p' /etc/multipath.conf
defaults {
	user_friendly_names no
	getuid_callout          "/lib/udev/scsi_id --whitelisted --device=/dev/%n"
}
multipaths {
       multipath {
               wwid                    "1IET     00010001"
               alias                   mpa
       }
}
[root@node2 ~]# /etc/init.d/multipathd start;chkconfig multipathd on
[root@node2 ~]# ls /dev/mapper/ ##View the aliases of Multipath shared devices
control mpa mpap1 VolGroup-lv_root VolGroup-lv_swap

8. Restart the ISCSI service to check the disk status

[root@node2 ~]# /etc/init.d/iscsi restar
stop iscsi: [OK]
Starting iscsi: [OK]
[root@node2 ~]# lsblk
NAME                        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sr0 11: 0 1 1024M 0 rom   
vda                         252:0    0   50G  0 disk  
├─vda1                      252:1    0  500M  0 part  /boot
└─vda2                      252:2    0 49.5G  0 part  
  Ol─VolGroup-lv_root (dm-0) 253: 0 0 47.6G 0 lvm /
  └─VolGroup-lv_swap (dm-1) 253:1    0    2G  0 lvm   [SWAP]
sdc                           8:32   0   20G  0 disk  
└─mpa (dm-2)                253:2    0   20G  0 mpath
  └─mpap1 (dm-3)            253:3    0  976M  0 part  /var/lib/mysql
sdb                           8:16   0   20G  0 disk  
└─mpa (dm-2)                253:2    0   20G  0 mpath
  └─mpap1 (dm-3)            253:3    0  976M  0 part  /var/lib/mysql

9. Mount the Multipath shared storage to the mysql application data directory, or write the mounting work to /etc/fstab to achieve automatic mounting at startup

[root@node2 ~]# mount /dev/mapper/mpap1 /var/lib/mysql/

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324695509&siteId=291194637