Deploy network storage using iscsi service

1. Introduction to iSCSI technology

1) The current hard disk interface types are IDE, SATA, iSCSI 3 types:

IDE is a mature, stable and cheap parallel transmission interface;

SATA is a serial transmission interface with faster transmission speed and more complete data verification;

iSCSI (internet small computer system interface) is a general standard used for system-level interfaces between computers and hard disks, optical drives and other devices. It has the advantages of low system resource occupancy, high rotational speed, and transmission speed.

2) iSCSI storage technology is very convenient, and there are great changes in the form of accessing resource storage. It is not limited by the physical environment, and storage resources can be distributed to multiple servers. In the past, hardware devices directly transmitted data through the bus of the motherboard, but now the Internet needs to be used as a carrier and channel for data transmission, so transmission speed and stability are the bottlenecks of iSCSI technology.

Steps to deploy network storage

1) Create a RAID disk array

Step 1: Add 4 hard disks to the virtual machine. After starting the system, use the mdadm command to create a RAID disk array: mdadm -Cv /dev/md0 -n 3 -l 5 -x 1 /dev/sdb /dev/sdc /dev/sdd /dev/sde, that is to create an array md0 disk, the -Cv parameter indicates the creation of an array and the display process, the -n 3 parameter indicates the number of hard disks required to create an array RAID 5 array, the -l 5 parameter indicates the level of creating a disk array, - The x 1 parameter indicates the number of backup disks in the disk array.

Step 2: After the disk array is created, use the mdadm -D /dev/md0 command to view the information of the disk array. You can see that the system automatically generates a UUID in the information, which is the unique identifier of the device.

2) Configure the iSCSI service

Step 1: Install the service program targetd and the configuration command tool targetcli: yum -y install targetd in the iSCSI service, restart the targetd service and set the startup items;

Step 2: Configure the shared resources of the iSCSI server. targetcli is a special command used to manage the storage resources of the iSCSI server. Use targetcli to enter the configuration interface. /backstores/block is the location where the iSCSI server is configured to share. It is necessary to configure the RAID 5 disk array Add md0 to the storage "resource pool", and rename the file to disk0 (storage "resource pool"), that is, enter cd /backstores/block in the block directory, create a storage device disk0 and add it to the md0 disk array: create disk0 /dev /md0, go back to the root directory cd /

Step 3: Create the iSCSI target name, that is, enter the iscsi directory to create the target name, the name is automatically generated by the system: cd iscsi/ --> create, a target name is generated at this time, which is the unique identifier of the shared storage; then create A "new directory" with the same name as this target is used to store shared resources, for example: cd iqn.2003-01.org.linux-iscsi.mail.x8664:sn.08aa09eae9c6/, then enter tpg1/luns to The storage device disk0 in the second step is placed in the shared storage resource: cd /tpg1/luns --> create /backstores/block/disk0, so that the user can use this device to provide shared storage resources by default when logging in to the iSCSI server.

Step 4: Set the access control list, that is, after the second step is completed, cd .. go back to the previous directory, cd acl/ to enter the acl list, and create the name that the user needs to verify when accessing the storage: create [target name]: client, followed by Adding :client ensures name uniqueness.

Step 5: Set the IP address and listening port of the iSCSI server. The default port is 3260, that is, after the fourth step is completed, go back to the previous directory cd .., enter the portal directory and set: cd /portal --> create 192.168 .1.102 (If it cannot be created, the listening port is already occupied and needs to be deleted (delete xxxx 3260) and added)

Step 6: Go back to the root directory with the ls command to check whether the configuration is complete. Then, the exit (including the save operation) command exits. The ctrl + c operation will not save the configuration. Finally, restart the tartgetd service and set the startup items.

Step 7: Configure firewall policy and reload: firewall-cmd --permanet --add-port=3260/tcp firewall-cmd --reload .

Third, configure the iSCSI client

1) Linux client (iSCSI client access to shared storage resources steps: first discover, then log in, and finally mount and use)

Step 1: Install the iSCSI client service program initiator: yum -y iscsi-initiator-utils

Step 2: Configure the iSCSI client name: The iSCSI protocol is verified by the client name, and the name must also be the unique identifier of the iSCSI client, and must be consistent with the iSCSI server configuration access control list information:

vi /etc/iscsi/initiatorname.iscsi, then set the name: InitiatorName=[target name]:client, and finally restart the iscsid service and set the startup items.

Step 3: Discover shared storage devices: iscsiadm -m discovery -t st -p 192.168.1.102, where iscsiadm is a command tool for managing, querying, inserting, updating or deleting iSCSI database configuration files, -m discovery is for scanning Find available shared storage resources, the -p parameter is the IP address of the iSCSI server.

Step 4: Log in to the shared storage server: iscsiadm -m node -T [target name] -p xxxx --login, add the IP address of the iSCSI server after the -p parameter, and the -m node parameter uses the host where the client is located as a node server.

Step 5: Format the partition: file /dev/sdb can see the new disk, mkfs.xfx /dev/sdb format the disk, create the device file mkdir /iscsi, and mount the disk to the mount point mout /dev/ sdb /iscsi, df -h to view the results of the mount

Step 6: When the client uses multiple remote storage resources, it needs to mount through the UUID unique identifier of the device in the /etc/fstab configuration file to ensure that the system can correctly find the directory corresponding to the device, and use the blkid command to view the device Name, file system and UUID, i.e. blkid | grep /dev/sdb, you can see the parameters of the sdb device, and then configure the system to automatically mount at boot in the /etc/fstab configuration file:

vi /etc/fstab  

UUID=[UUID名称]  /iscsi xfs defaults,_netdev 0 0

Finally, if the shared storage resource is no longer needed, the uninstall command is iscsiadm.

2) window client

Step 1: Open the Control Panel--Administrative Tools, run the iscsi service program, and set the name of the iSCSI initiator in the "Configuration" card to the name of the acl configuration in the iSCSI server, that is, [target name]:client, and then in the "Configuration" card Enter the IP address of the iSCSI server in the "Directory" card, and click OK after the connection is normal.

Step 2: Right-click My Computer "Manage", open the storage management program, and format the new disk to use it.

Guess you like

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