您的位置:首页 > 其它

群集-共享存储-IP SAN-059

2011-10-19 23:37 148 查看
共享存储方式

1.Das直接附加存储 (直接连接到主机)
2.Nas网络附加存储 (提供共享机制nfs samba)
--Windows 共享 cifs
简化操作系统 nfs cifs smb 文件级别共享
效率低 安全性不高
3.san 存储区域网络
Scsi总线分为:
窄带8 (7个可用控制器)
宽带 16 (15个可用的控制器)
--是块共享,代价高昂,需要光纤交换机,解决这样的问题采用iscsi基于ip的scsi机制
相当于在两端安装scsi协议封装要传输的数据
San的分类:
Fc san
Ip san scsi
本地文件系统(ext2 ext3 ext4)不能做群集共享。
--drbd通过网络把两个主机对接,保持两台主机的数据同步
--Active/active 需要两个流动ip
群集文件系统
Jfs1和2版本文件系统,有推送的能力,
Ocfs1和2版本文件系统
Ip san存储的实现





59-1
1.Server-arget
增加一块硬盘
[root@director2 ha.d]# yum list all |grep scsi
scsi-target-utils.i386 0.0-5.20080917snap.el5
--服务器端需要安装的软件
[root@director2 ha.d]# yum install scsi-target-utils.i386 –y -–有依赖的包
[root@director2 ha.d]# service tgtd start
Starting SCSI target daemon: [ OK ]
--端口是3260
[root@director2 ~]# chkconfig tgtd on
[root@director2 ~]# tgtadm --lld iscsi --op new --mode target --tid=1
--targetname=iqn.2011-10.com.test.drector2:target
-------增加一个target tid不能为零,0是禁用的,窄带1-7,宽带1-15,target名是以iqn命名的。
[root@director2 ~]# fdisk /dev/hda
[root@director2 ~]# partprobe /dev/hda
--和内核同步,但不能格式化,要在client端格式化
[root@director2 ~]# tgtadm --lld iscsi --op new --mode=logicalunit --tid=1 --lun=1 --backing-store /dev/hda1
--在target上新增逻辑单元
[root@director2 ~]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2011-10.com.test.drector2:target
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf1:0
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf1:1
SCSI SN: beaf11
Size: 1001 MB
Online: Yes
Removable media: No
Backing store: /dev/hda1
Account information:
ACL information:
[root@director2 ~]#

认证方法
1.基于ip地址的认证
2.账号的认证(chap)
--acl定义initiator的网段
[root@director2 ~]# tgtadm --lld iscsi --op bind --mode=target --tid=1 --initiator-address=192.168.2.0/24
如果开机要启动
可以写入开机启动的文件里/etc/rc.d/rc.local
[root@director2 ~]# tgtadm --lld iscsi --op show --mode target
Target 1: iqn.2011-10.com.test.drector2:target
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: deadbeaf1:0
SCSI SN: beaf10
Size: 0 MB
Online: Yes
Removable media: No
Backing store: No backing store
LUN: 1
Type: disk
SCSI ID: deadbeaf1:1
SCSI SN: beaf11
Size: 1001 MB
Online: Yes
Removable media: No
Backing store: /dev/hda1
Account information:
ACL information:
192.168.2.0/24
[root@director2 ~]#

Client-initiator
作用 发出发现targetserver的指令
[root@server2 ~]# yum list all |grep scsi
This system is not registered with RHN.
RHN support will be disabled.
iscsi-initiator-utils.i386 6.2.0.868-0.18.el5 rhel-server
lsscsi.i386 0.17-3.el5 rhel-server
scsi-target-utils.i386 0.0-5.20080917snap.el5
[root@server2 ~]# yum install iscsi-initiator-utils.i386 –y
给客户端起名
[root@server2 ~]# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2011-10.com.a.server2:init1

[root@server2 ~]# service iscsi start
iscsid is stopped
Turning off network shutdown. Starting iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: iscsiadm: No records found!
[ OK ]
[root@server2 ~]# chkconfig iscsi on
--发现target服务器
[root@server2 ~]# iscsiadm --mode discovery --type sendtargets --portal 192.168.
2.11
192.168.2.11:3260,1 iqn.2011-10.com.test.drector2:target
[root@server2 ~]#
[root@server2 ~]# iscsiadm --mode node --targetname=iqn.2011-10.com.test.drector2:target --portal 192.168.2.11 --login
Logging in to [iface: default, target: iqn.2011-10.com.test.drector2:target, portal: 192.168.2.11,3260]
Login to [iface: default, target: iqn.2011-10.com.test.drector2:target, portal: 192.168.2.11,3260]: successful
[root@server2 ~]#
[root@server2 ~]# fdisk -l

Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3837 30716280 83 Linux
/dev/sda3 3838 3968 1052257+ 82 Linux swap / Solaris

Disk /dev/sdb: 1000 MB, 1000548864 bytes
31 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes

Disk /dev/sdb doesn't contain a valid partition table
[root@server2 ~]#
[root@server2 ~]# fdisk /dev/sdb

[root@server2 ~]# mkfs -t ext3 /dev/sdb1
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
122112 inodes, 244086 blocks
12204 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=251658240
8 block groups
32768 blocks per group, 32768 fragments per group
15264 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@server2 ~]#

[root@server2 ~]# mkdir /mnt/sdb1
[root@server2 ~]# mount /dev/sdb1 /mnt/sdb1/
[root@server2 ~]#
[root@server2 sdb1]# mkdir ll
[root@server2 sdb1]# touch lwy.old
这个格式化的分区类型,只有本用户可以访问自己的文件,看不到其他用户的文件
其他客户端无法访问本地文件分区的类型所以
存储需要使用群集的分区类型
Client2

[root@localhost ~]#
[root@localhost ~]# yum install iscsi-initiator-utils -y
[root@localhost ~]# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2011-10.com.test.server1:init2

[root@localhost ~]# service iscsi start
iscsid is stopped
Turning off network shutdown. Starting iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: iscsiadm: No records found!
[ OK ]
[root@localhost ~]# chkconfig iscsi on
[root@localhost ~]# iscsiadm --mode discovery --type sendtargets --portal 192.168.2.11
192.168.2.11:3260,1 iqn.2011-10.com.test.drector2:target
[root@localhost ~]# iscsiadm --mode node --targetname iqn.2011-10.com.test.drector2:target --portal 192.168.2.11 --login
Logging in to [iface: default, target: iqn.2011-10.com.test.drector2:target, portal: 192.168.2.11,3260]
Login to [iface: default, target: iqn.2011-10.com.test.drector2:target, portal: 192.168.2.11,3260]: successful
[root@localhost ~]#
[root@localhost ~]# fdisk -l

Disk /dev/sda: 107.3 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 3837 30716280 83 Linux
/dev/sda3 3838 3968 1052257+ 82 Linux swap / Solaris

Disk /dev/sdb: 1000 MB, 1000548864 bytes
31 heads, 62 sectors/track, 1016 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 1 1016 976345 83 Linux
[root@localhost ~]# mkdir /mnt/sdb1
[root@localhost ~]# mount /dev/sdb1 /mnt/sdb1/
[root@localhost ~]# cd /mnt/sdb1/
[root@localhost sdb1]# ll
total 20
drwxr-xr-x 2 root root 4096 Oct 19 16:43 ll
drwx------ 2 root root 16384 Oct 19 16:42 lost+found
-rw-r--r-- 1 root root 0 Oct 19 16:43 lwy.old
[root@localhost sdb1]# mkdir ww
[root@localhost sdb1]# ll
total 24
drwxr-xr-x 2 root root 4096 Oct 19 16:43 ll
drwx------ 2 root root 16384 Oct 19 16:42 lost+found
-rw-r--r-- 1 root root 0 Oct 19 16:43 lwy.old
drwxr-xr-x 2 root root 4096 Oct 19 16:52 ww
[root@localhost sdb1]#
--只需要在一个client上格式化就可以,其他客户端只需要登陆到target server挂载本地就可以了,但是这种有缺陷,本地用户除了第一次挂载能看到初始的其他用户在磁盘上的信息,其他再更改的信息看不到,别人也看不到自己更改的信息。
[root@server2 sdb1]# ll
total 20
drwxr-xr-x 2 root root 4096 Oct 19 16:43 ll
drwx------ 2 root root 16384 Oct 19 16:42 lost+found
-rw-r--r-- 1 root root 0 Oct 19 16:43 lwy.old
[root@server2 sdb1]#
--server2上的用户在server1更改数据以后不会看到server1的更改
解决办法:需要用群集文件系统格式化磁盘。本文出自 “yanzi” 博客,请务必保留此出处http://daddysgirl.blog.51cto.com/1598612/692419
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: