新聞中心
一、前言

祥符網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)建站!從網(wǎng)頁設(shè)計、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、響應(yīng)式網(wǎng)站建設(shè)等網(wǎng)站項目制作,到程序開發(fā),運營維護。創(chuàng)新互聯(lián)建站2013年至今到現(xiàn)在10年的時間,我們擁有了豐富的建站經(jīng)驗和運維經(jīng)驗,來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)建站。
1、什么是iSCSI?
iSCSI技術(shù)是一種由IBM公司研究開發(fā)的,是一個供硬件設(shè)備使用的可以在IP協(xié)議的上層運行的SCSI指令集,這種指令集合可以實現(xiàn)在IP網(wǎng)絡(luò)上運行SCSI協(xié)議,使其能夠在諸如高速千兆以太網(wǎng)上進(jìn)行路由選擇。iSCSI技術(shù)是一種新儲存技術(shù),該技術(shù)是將現(xiàn)有SCSI接口與以太網(wǎng)絡(luò)(Ethernet)技術(shù)結(jié)合,使服務(wù)器可與使用IP網(wǎng)絡(luò)的儲存裝置互相交換資料。
iSCSI:Internet 小型計算機系統(tǒng)接口 (iSCSI:Internet Small Computer System Interface)。
Internet 小型計算機系統(tǒng)接口(iSCSI)是一種基于 TCP/IP的協(xié)議,用來建立和管理 IP 存儲設(shè)備、主機和客戶機等之間的相互連接,并創(chuàng)建存儲區(qū)域網(wǎng)絡(luò)(SAN)。SAN 使得 SCSI 協(xié)議應(yīng)用于高速數(shù)據(jù)傳輸網(wǎng)絡(luò)成為可能,這種傳輸以數(shù)據(jù)塊級別(block-level)在多個數(shù)據(jù)存儲網(wǎng)絡(luò)間進(jìn)行。
SCSI 結(jié)構(gòu)基于客戶/服務(wù)器模式,其通常應(yīng)用環(huán)境是:設(shè)備互相靠近,并且這些設(shè)備由 SCSI 總線連接。iSCSI 的主要功能是在 TCP/IP 網(wǎng)絡(luò)上的主機系統(tǒng)(啟動器 initiator)和存儲設(shè)備(目標(biāo)器 target)之間進(jìn)行大量數(shù)據(jù)的封裝和可靠傳輸過程。此外,iSCSI 提供了在 IP 網(wǎng)絡(luò)封裝 SCSI 命令,且運行在 TCP 上。
2、環(huán)境介紹:
本次部署由3臺物理機實現(xiàn),具體信息分別為以下:
a、iSCSI_Server:192.168.30.133
b、iSCSI_Client1:192.168.30.131
c、iSCSI_Client2:192.168.30.132
需要用到的軟件為:
a、scsi-target-utils # 提供Server端服務(wù)
b、iscsi-initiator-utils #提供Client服務(wù)
二、安裝部署服務(wù)端,即iSCSI_Server
1、在服務(wù)端創(chuàng)建可共享的磁盤或卷;這里就新添加一塊新磁盤做為共享;
查看新添加的硬盤:
[root@iSCSI_Server ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
64 heads, 32 sectors/track, 30720 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da3dc
Device Boot Start End Blocks Id System
/dev/sda1 * 2 501 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 502 30720 30944256 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
2、對硬盤進(jìn)行分區(qū)并創(chuàng)建LVM卷:
[root@iSCSI_Server ~]# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x47756356.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').
Command (m for help): p # 查看分區(qū)信息
Disk /dev/sdb: 21.5 GB, 21474836480 bytes64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x47756356
Device Boot Start End Blocks Id System
Command (m for help): n #新建一個分區(qū)
Command action
e extended
p primary partition (1-4)
e # 新建一個邏輯分區(qū)
Partition number (1-4): 4 # 卷標(biāo)為 4
First cylinder (1-20480, default 1):
Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-20480, default 20480):
Using default value 20480Command (m for help): p # 查看信息
Disk /dev/sdb: 21.5 GB, 21474836480 bytes64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x47756356
Device Boot Start End Blocks Id System/dev/sdb4 1 20480 20971504 5 Extended
Command (m for help): n # 新建邏輯卷
Command action
l logical (5 or over)
p primary partition (1-4)
l # 選擇l,邏輯卷
First cylinder (1-20480, default 1):
Using default value 1Last cylinder, +cylinders or +size{K,M,G} (1-20480, default 20480):
Using default value 20480Command (m for help): p # 查看信息
Disk /dev/sdb: 21.5 GB, 21474836480 bytes64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x47756356
Device Boot Start End Blocks Id System
/dev/sdb4 1 20480 20971504 5 Extended
/dev/sdb5 1 20480 20971488 83 Linux
Command (m for help): w # 保存
The partition table has been altered!Calling ioctl() to re-read partition table.
Syncing disks
[root@iSCSI_Server ~]# partprobe /dev/sdb # 使剛才的配置立即生效
[root@iSCSI_Server ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes
64 heads, 32 sectors/track, 30720 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da3dc
Device Boot Start End Blocks Id System
/dev/sda1 * 2 501 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 502 30720 30944256 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
64 heads, 32 sectors/track, 20480 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x47756356
Device Boot Start End Blocks Id System
/dev/sdb4 1 20480 20971504 5 Extended
/dev/sdb5 1 20480 20971488 83 Linux
[root@iSCSI_Server ~]# cat /proc/partitions
major minor #blocks name
8 0 31457280 sda
8 1 512000 sda1
8 2 30944256 sda2
8 16 20971520 sdb
8 20 1 sdb4
8 21 20971488 sdb5
253 0 27795456 dm-0
253 1 3145728 dm-1
#注:看到以上標(biāo)黃的信息證明已經(jīng)創(chuàng)建邏輯卷成功!
接下來創(chuàng)建LVM卷
[root@iSCSI_Server ~]# pvcreate /dev/sdb5 # 創(chuàng)建PV
Physical volume "/dev/sdb5" successfully created
[root@iSCSI_Server ~]# vgcreate kvmvg /dev/sdb5 # 創(chuàng)建VG
Volume group "kvmvg" successfully created
[root@iSCSI_Server ~]# lvcreate -L 19G -n kvmlv kvmvg # 創(chuàng)建LV
Logical volume "kvmlv" created.
[root@iSCSI_Server ~]# lvs # 查看
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_root VolGroup -wi-ao---- 26.51g
lv_swap VolGroup -wi-ao---- 3.00g
kvmlv kvmvg -wi-a----- 19.00g
[root@iSCSI_Server ~]#
#注:看到以上標(biāo)黃的信息證明已經(jīng)創(chuàng)建成功!
3、安裝服務(wù)端軟件:scsi-target-utils
[root@iSCSI_Server ~]# yum -y install epel-release
[root@iSCSI_Server ~]# yum -y install scsi-target-utils.x86_64
4、配置iSCSI服務(wù):
[root@iSCSI_Server ~]# vim /etc/tgt/targets.conf
#### 在 40行后添加以下信息#######
backing-store /dev/kvmvg/kvmlv
initiator-address 192.168.30.0/24
注:
iqn.2017-03.com.zlyang:kvm.iscsi : 為共享名
iqn.2017-03.com.zlyang:kvm.iscsi ?。汗蚕砭砻奥窂?/p>
initiator-address 192.168.30.0/24 :允許哪些地址訪問
5、啟動服務(wù)
[root@iSCSI_Server ~]# service tgtd start
[root@iSCSI_Server ~]# chkconfig tgtd on
[root@iSCSI_Server ~]# netstat -tnlt|grep 3260
tcp 0 0 0.0.0.0:3260 0.0.0.0:* LISTEN
tcp 0 0 :::3260 :::* LISTEN
6、添加防火墻規(guī)則
[root@iSCSI_Server ~]# iptables -I INPUT 4 -p tcp --dport 3260 -j ACCEPT
[root@iSCSI_Server ~]# iptables-save
[root@iSCSI_Server ~]# service iptables save
[root@iSCSI_Server ~]# service iptables restart
三、安裝Client
因為兩臺Client配置幾乎一樣,在此以Client1為例給大家演示具體部署過程
1、首先查看本地磁盤
[root@iSCSI_Client_1 ~]# fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes64 heads, 32 sectors/track, 30720 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000da3dc
Device Boot Start End Blocks Id System
/dev/sda1 * 2 501 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 502 30720 30944256 8e Linux LVM
Partition 2 does not end on cylinder boundary.
Disk /dev/mapper/VolGroup-lv_root: 28.5 GB, 28462546944 bytes
255 heads, 63 sectors/track, 3460 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/VolGroup-lv_swap: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
# 可以看出只有一塊磁盤
2、安裝Client軟件
[root@iSCSI_Client_1 ~]# yum -y install epel-release
[root@iSCSI_Client_1 ~]# yum -y install iscsi-initiator-utils.x86_64
3、啟動服務(wù)
[root@iSCSI_Client_1 ~]# service iscsid start
[root@iSCSI_Client_1 ~]# chkconfig iscsid on
4、發(fā)現(xiàn)下iSCSI服務(wù)端
[root@iSCSI_Client_1 ~]# iscsiadm -m discovery -t st -p 192.168.30.133
192.168.30.133:3260,1 iqn.2017-03.com.zlyang:kvm.iscsi
5、掛載該磁盤
a、加載磁盤
# iscsiadm -m node -T iqn.2017-03.com.zlyang:kvm.iscsi -p 192.168.30.133 -l
Logging in to [iface: default, target: iqn.2017-03.com.zlyang:kvm.iscsi, portal: 192.168.30.133,3260] (multiple)
Login to [iface: default, target: iqn.2017-03.com.zlyang:kvm.iscsi, portal: 192.168.30.133,3260] successful.
# echo "iscsiadm -m node -T iqn.2017-03.com.zlyang:kvm.iscsi -p 192.168.30.133 -l" >> /etc/rc.d/rc.local"
[root@iSCSI_Client_1 ~]# fdisk -l
Disk /dev/sdc: 20.4 GB, 20401094656 bytes
64 heads, 32 sectors/track, 19456 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
注:看到此信息表示已經(jīng)加載成功
b、分區(qū)格式化
[root@iSCSI_Client_1 ~]# mkfs.ext4 /dev/sdc
mke2fs 1.41.12 (17-May-2010)/dev/sdc is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1245184 inodes, 4980736 blocks
249036 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
152 block groups3
2768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 35 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@iSCSI_Client_1 ~]#
c、掛載到本地
[root@iSCSI_Client_1 ~]# mount /dev/sdc /mnt
[root@iSCSI_Client_1 ~]# echo "mount /dev/sdc /mnt" >> /etc/rc.d/rc.local
[root@iSCSI_Client_1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
26G 2.6G 23G 11% /
tmpfs 939M 0 939M 0% /dev/shm
/dev/sda1 477M 52M 400M 12% /boot
/dev/sdc 19G 44M 18G 1% /mnt
[root@iSCSI_Client_1 ~]#
Client_1的所有配置已經(jīng)配置完成,Client_2配置與Client_1基本相同,只是Client_2不需要再分區(qū)格式化了,直接加載及掛載就可以!
好了,部署已經(jīng)全部完成,如果什么問題可以回復(fù)或發(fā)郵件到:DBA_Master@163.com
網(wǎng)站題目:CentOS6.5安裝部署iSCSI共享存儲
文章來源:http://m.5511xx.com/article/dhsdiij.html


咨詢
建站咨詢
