Topology:
650) this.width=650; "title=" 1.png "src=" Http://s4.51cto.com/wyfs02/M01/79/39/wKiom1aLy8aD2w3dAACHwKCM4Hg152.png " alt= "Wkiom1aly8ad2w3daachwkcm4hg152.png"/>
Experimental steps:
--------------------------------------------------------------
Configuration iSCSI Server:
Programme 1 : (Command line configuration, immediately valid, restart invalid)
1. Add two disk devices to target, SDB,SDC
2. Install the package, start the service
# yum Install-y scsi-target-utils
# service TGTD Start
3. Create target
# tgtadm--lld/dev/sdb--mode target--op new--tid 1--targetname iqn.2015-01.com.liaobin:i1.c2
4. Create LUNs
# Tgtadm--lld iSCSI--mode logicalunit--op New--tid 1--lun 1--backing-store/dev/sdb
# Tgtadm--lld iSCSI--mode logicalunit--op new--tid 1--lun 2--BACKING-STORE/DEV/SDC
# Tgtadm--lld iSCSI--mode logicalunit--op Delete--tid 1--lun 1 #删除lun的方法
5. Authorization
# Tgtadm--lld iSCSI--mode target--op bind--tid 1--initiator-address 192.168.191.0/24 # Limit only 192.168.191.0 the network segment can be accessed
6 , view information that has already been defined
# Tgtadm--LLD iSCSI--mode Target--op Show
Programme 2 : (defined in configuration file, restart valid)
1 , Edit /etc/tgt/targets.conf
<target iqn.2015-01.com.liaobin:i1.c2>
Backing-store/dev/sdb
Backing-store/dev/sdc
Initiator-address 192.168.191.0/24
</target>
2 , Restart TGTD Service;
# service TGTD Re Start
--------------------------------------------------------------
Configuration iSCSI Client Initiator (Node 1 , 2 are required to do the following):
1. Install package
# Yum install-y iscsi-initiator-utils
2 , Configuration Initiator's name. (Configuration document :/etc/iscsi/initiatorname.iscsi )
# echo "Initiatorname= ' iscsi-iname-p iqn.2015-01.com.liaobin '" >/etc/iscsi/initiatorname.iscsi ( Generate random numbers using the Iscsi-iname command)
3 , Start the service
# service iSCSI Start
# service Iscsid Start
4 , using iscsiadm realization of target discovery
Basic Format: iscsiadm-m discovery-d #-T sendtargets-p ip[:P ORT]
# iscsiadm-m discovery-d 3-t sendtargets-p 192.168.191.113:3260
#发现 Target - M Mode - D Debug Level - T type (Sendtargets can be abbreviated as St ) - P Service Side IP
650) this.width=650; "title=" 2.png "src=" Http://s4.51cto.com/wyfs02/M00/79/39/wKiom1aLy9OA95x7AABToIy1n1U375.png " alt= "Wkiom1aly9oa95x7aabtoiy1n1u375.png"/>
5 , log in, log out
Basic format: iscsiadm-m node [-D debug_level] [[-t targetname-p ip:port-i Ifacen] [-L |-u |-r |-S]] [[-O Operatio N]
# iscsiadm-m node-d 1-t iqn.2015-01.com.liaobin:i1.c2-p 192.168.191.113:3260-l #登入
650) this.width=650; "title=" 3.png "src=" Http://s4.51cto.com/wyfs02/M01/79/38/wKioL1aLzAPxWxCWAAAepBedFbg944.png " alt= "Wkiol1alzapxwxcwaaaepbedfbg944.png"/>
# iscsiadm-m node-d 1-t iqn.2015-01.com.liaobin:i1.c2-p 192.168.191.113:3260-u #登出
# iscsiadm-m node-d 1-t iqn.2015-01.com.liaobin:i1.c2-p 192.168.191.113:3260-o Delete #删除指定条目
--------------------------------------------------------------
Test:
(on a node 1 operation)
1 , View disk-free devices
# Fdisk-l # See if there are more out SDB , SDC , if any, the login is successful and can be partitioned and mounted using
2 , new partition
# FDISK/DEV/SDC # Create a new partition
650) this.width=650; "title=" Xx.png "src=" http://s3.51cto.com/wyfs02/M02/79/38/wKioL1aLzDyQeCrDAAAqD0psW8o803.png "alt=" Wkiol1alzdyqecrdaaaqd0psw8o803.png "/>
3 , format file system
# mke2fs-t EXT4/DEV/SDC1
4 , Mount
# mount/dev/sdc1/mnt # Create a file system and mount it to /mnt
5 , create a test file, switch to another Initiator node Mount /DEV/SDC1 To see if a file exists
# Touch Test.txt; echo "This was Test line" > Test.txt
(Node 2 on the operation)
1 , Check for disk-free devices and mount them using
# fdisk-l
2 , directly mount the node just now 1 partition that created the file system /DEV/SDC1
# mount/dev/sdc1/mnt
3 , switch to /mnt directory to see if the file is normal
# Cd/mnt;ls
650) this.width=650; "title=" 4.png "src=" Http://s1.51cto.com/wyfs02/M01/79/38/wKioL1aLzEawUTOzAAAHTKPSmJA446.png " alt= "Wkiol1alzeawutozaaahtkpsmja446.png"/>
# cat Test.txt
650) this.width=650; "title=" 5.png "src=" Http://s5.51cto.com/wyfs02/M01/79/39/wKiom1aLzCnRuK1gAAAGgeryDbo914.png " alt= "Wkiom1alzcnruk1gaaaggerydbo914.png"/>
Show Normal, description create iSCSI the shared storage is successful and the test is complete.
This article is from the "Operations" blog, please be sure to keep this source http://laoliao.blog.51cto.com/10027070/1731879
Building iSCSI Shared storage