iSCSI server
General server storage device in addition to the built-in disk, internal disk Raid disk array has constituted common solution is to add NAS (network-attached storage server) or an external storage device, then it is high-end SAN (storage area network)
NAS given SAN
NAS (Network Attached Storage, Network Attached Storage server): the equivalent of a file server, typically supports TCP / IP, and will provide NFS, SAMBA, FTP and other common communication protocol to provide clients obtain file system
SAN (Storage Area Networks, Storage Area Network): can be provided by some special interfaces or channels of all machines within the LAN disk access, SAN disk provided to the host used, but provided by the NAS is a network protocol file system (NFS, SAMBA Wait)
iSCSI (internet Small Computer System Interface) : via TCP / IP technology, the iSCSI target by the storage device functions, provides server-side disk can be made, and then through the iSCSI initiator, the mount can be made using the iSCSI target client, can be applied disks via iSCSI protocol
iSCSI build
Server (target ip: 192.168.0.101)
1. Prepare two new disks, view the disk: fdisk the -l
2. Create a simulation using the dd command pseudo disk
dd if=/dev/zero of=/test/disk1.img bs=1M count=500
3. Create a software RAID array devices with mdadm tool (two hard disk / dev / sdb, / dev / sdc)
mdadm -Cv /dev/md0 -a yes -n2 -l5 /dev/sd[bc]
View RAID Information: mdadm -D / dev / md0
4. Edit mdadm.conf file written UUID: vim /etc/mdadm.conf
DEVICE /dev/sdb /dev/sdc
ARRY /dev/md0 UUID=1b21ca8b:10e18d4b:1ef88c20:440dfe3d
5. Download and install scsi-target-utils create iSCSI target Target, and start the service
yum -y install scsi-target-utils
6. Check the host name and create objects
创建:tgtadm -L iscsi -o new -m target -t 1 -T iqn.2020-03.com.renjie.test1:raid
View: tgtadm -L iscsi target -m -o Show
7. assign a LUN to client
tgtadm --lld iscsi -o new -m logicalunit -t 1 -l 1 -b /dev/md0
8. interviewed initiator of the target
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
Added: You can also modify the configuration files directly, so as not to restart without saving the configuration (remember to save restart the service)
vim /etc/tgt/targets.conf
View Status
tgt-admin --show或tgtadm -L iscsi -o show -m target
The client (initiator ip: 192.168.0.104)
Profile: the /etc/iscsi/iscsid.conf
The main programs: / sbin / iscsid
Management iSCSI initiator main setup program: / sbin / the iscsiadm
Let the machine simulation has become a major iSCSI service: /etc/init.d/iscsid
Login target startup script iSCSI: /etc/init.d/iscsi
1. Installation iscsi-initiator-utils
yum -y install iscsi-initiator-utils
2. Connect and log on Target
iscsiadm -m discovery -t sendtargets -p 192.168.0.101
iscsiadm -m node –T iqn.2020-03.com.renjie.test1:raid --login
3. Check whether a successful connection disk: fdisk the -l
Can operate successfully mount the partition using the disk and the like
NOTE: If you set a password before the server this edition /etc/iscsi/iscsid.conf file
vim /etc/iscsi/iscsid.conf
node.session.auth.username = admin will be used to detect the user name \\
node.session.auth.password = password will be used to detect when a password \\
discovery.sendtargets.auth.username = admin will be used when users log on \\
discovery.sendtargets.auth.password = password will use the password to log \\