ISCSI network storage service, iscsi Network Storage
ISCSI Network Storage Service
1. Structure of this Chapter
2. Overview
3. DAS
Direct-Attached Storage
4. SAN Network
Storage Area Network, a Storage Area Network, uses high-speed fiber channel, high requirements for speed and redundancy, uses ISCSI Storage protocol, block-Level Transmission
5. NAS Network
Network Attachment Storage, Network attached Storage, using common Ethernet, no special requirements for speed and redundancy, using NFS, CIFS shared protocol, file-Level Transmission
6. C/S architecture
How ISCSI works
Service (device) end ------ target
Client (Application) end ----- initiator
7. Server Creation
# Yum-y install iscsi-target-utils
# Service tgtd start
Command tgtadm usage:
# Tgtadm [OPTION]
-- Lld =-L specify the device
-- Mode =-m specified mode
-- Op =-o specified operation
-- Tid =-t specifies the ID of the target
-- Initiator-address =-I specifies the client address
-B = -- backing-store: specify the location of the block device.
-L = -- lun indicates the logical unit number.
① # Tgtadm -- lld <driver> -- mode target -- op new -- tid <id> -- targetname <name>
Add a new target and <id> and <Name>. <Id> cannot be zero.
② # Tgtadm-lld <driver> -- mode target -- op delete [-- force] -- tid <id>
Delete the target of <id>. Use the force option to delete a specific target, even if it is active.
③ # Tgtadm -- lld <driver> -- mode target -- op show
Show all targets
④ # Tgtadm -- lld <driver> -- mode target -- op show -- tid <id>
Displays the parameters of a specific target.
⑤ # Tgtadm -- lld <driver> -- mode target -- op update -- tid <id> -- name <param> -- value <value>
Change the target and <id> of the target parameter.
⑥ # Tgtadm -- lld <driver> -- mode target -- op bind -- tid <id> -- initiator-address <address>
-- Lld <driver> -- mode target -- op bind -- tid <id> -- initiator-name <name>
Make the target accept a specific initiator, that is, authorize a specific host
7 # tgtadm -- lld <driver> -- mode target -- op unbind -- tid <id> -- initiator-address <address>
# Tgtadm -- lld <driver> -- mode target -- op unbind -- tid <id> -- initiator-name <name>
Disable specific allowed initiators.
# Tgtadm -- lld <driver> -- mode logicalunit -- op new -- tid <id> -- lun <lun> \
-- Backing-store <path> -- bstype <type> -- bsoflags <options>
Add a new logical unit and <lun> specific target for <id>. The logical unit is proposed by the initiator. <Path> must be a block device file (including LVM and RAID devices) or a common file. The bstype option is optional. The supported options for Bsoflags are sync and direct.
# Tgtadm -- lld <driver> -- mode logicalunit -- op delete -- tid <id> -- lun <lun>
Delete a specific logical unit and target.
Login # tgtadm -- lld <driver> -- mode account -- op new -- user <name> -- password <pass>
Add an account with a user name and password
# Tgtadm -- lld <driver> -- mode account -- op delete -- user <name>
Delete a specific account with a name
# Tgtadm -- lld <driver> -- mode account -- op bind -- tid <id> -- user <name> [-- outgoing]
Add a specified account with a name for the specific target of the specified <id>. The user may be IncomingUser> or <OutgoingUser>. If you use the-outgoing option, the account will be added as an outgoing account.
# Tgtadm -- lld <driver> -- mode account -- op unbind -- tid <id> -- user <name>
Delete a specific account with <Name> from a specific target
# Tgtadm -- control-port <port> use control port <port>
8. Client Creation
# Yum-y install iscsi-initiator-utils
# Service iscsi start
Command iscsiadm usage:
[-I iface-t type-p ip: port [-l] | [-p ip: port] [-l |-D]
All, manual, automatic] [-U all, manual, automatic] [-S] [-T targetname-p ip: port-I iface] [-l |-u |-R |-s] [[-o operation] [-n name] [-v value] [-p ip: port]
-D, -- discover
# The discovery target uses the discovery recid to match the discovery type and portal. If no matching record exists, it is created using iscsid. Conf settings. This must guide iscsiadm execution discovery through the discoverydb mode. This option is only applicable to SendTargets discovery mode.
-A, -- ip = ipaddr # ip addresses can use IPV4 or IPV6
-L, -- login
# For node and fw modes, log on to the specified record. Discovery mode: log on to all discovery targets.
-L, -- loginall = [all | manual | automatic]
# For node mode, log on to all sessions and input the startup values of the node or Connecticut or run all sesssion. If all sessions are passed in, this option is only valid for node mode except those onboot instances.
-M, -- mode op
# Specify a specific mode. op must be one of discoverydb, node, fw, host iface, or session.
-O, -- op = op
# The specified mode. op must be one of new, delete, update, show, or nonpersistent.
-T, -- targetname = targetname
# Target, which should be used in node mode with -- portal
-S, -- show
# When a record is found, the default value is not hidden, such as CHAP encryption.
-U, -- logout
# Log out of a specified record
2. Building ISCSI Network Storage
Test preparation: Host A, B, and C are in the same CIDR block. Their IP addresses are 192.168.131.142, 192.168.131.139, 192.168.131.140, host A is used as the server, and host B and host C are used as the client, the operating system is CentOS6.6 x86_64. To minimize installation, firewall and SELIUX are all disabled. host a has four new hard disks, one for LVM and three for RAID 5.
1. Server Construction
Integrated storage space
① The second hard disk is made into LVM
# Fdisk/dev/sdb
# Mdadm-Cv/dev/md0-a yes-n 3-l 5/dev/sdc/dev/sdd/dev/sde
# Service tgtd start
# Netstat-tunlp | grep tgtd
Create server resources
Allocate storage devices to resources
Allocate acl rules
Modify configurations
2. client operations
① Host B operations
# Yum-y install iscsi-initiator-utils
# Service iscsi start
# Iscsiadm-m discovery-t sendtargets-p 192.168.131.142
# Iscsiadm-m node-T iqn.2016-10.com. taobao. www: lvm-login
# Fdisk-l
# Mkdir/lvm
# Yum-y install lscsi
# Lsscsi
# Fdisk/dev/sdb
# Partx/dev/sdb
# Mkfs. ext4/dev/sdb1 # mount the file after formatting
# Mount/dev/sdb1/lvm/
# Vim/etc/fstab
/Dev/sdb1/lvm ext4 defaults, _ netdev 0 0
② Host C operation
# Yum-y install iscis-initiator-utils
# Service iscsi start
# Iscsiadm-m discovery-t sendtargets-p 192.168.131.142
# Iscsiadm-m node-T iqn.2016-10.com. taobao. www: raid-login
# Yum-y install lsscsi
# Fdisk-l
# Fdisk/dev/sdb
# Mke2fs-t ext4/dev/sdb1
# Mkdir/raid
# Mount/dev/sdb1/raid/
# Vim/etc/fstab
/Dev/sdb1/raid ext4 defaults, _ netdev 0 0