IP-SAN(扩展)实验_第1张图片


配置扩展存储节点storage3

[root@storage3 ~]#yum install scsi-target-utils

[root@storage3 ~]#mkdir /iscsi

[root@storage3 ~]#dd if=/dev/zero of=/iscsi/disk-storage3 bs=1M count=2000

[root@storage3 ~]#vim /etc/tgt/targets.conf

   backing-store /iscsi/disk-storage3

   vendor_id storage3

   product_id disk1

   initiator-address 192.168.122.10

   initiator-address 192.168.122.20

[root@storage3 ~]#/etc/init./tgtd start


集群节点server1 & server2发现并登录存储storage3

[root@server1 ~]#iscsiadm -m discovery -t sendtargets -p 192.168.122.50:3260

[root@server1 ~]#iscsiadm -m node -T iqn.2013-12.com.vir:storage3.target1 -l


使用udev给存储storage3创建链接

[root@server1 ~]#udevinfo -a -p /sys/block/sdd

[root@server1 ~]#vim /etc/udev/rules.d/80-iscsi.rules

SUBSYSTEM=="block",SYSFS{size}=="3919797",SYSFS{model}=="disk1",SYSFS{vendor}=="storage1",SYMLINK+="storage1-disk"

SUBSYSTEM=="block",SYSFS{size}=="3919797",SYSFS{model}=="disk1",SYSFS{vendor}=="storage2",SYMLINK+="storage2-disk"

SUBSYSTEM=="block",SYSFS{size}=="3919797",SYSFS{model}=="disk1",SYSFS{vendor}=="storage3",SYMLINK+="storage3-disk"

[root@server1 ~]#start_udev


在线扩容lviscsi到5G

[root@server1 ~]#pvcreate /dev/iscsi/storage3-disk

[root@server1 ~]#vgextend vgiscsi /dev/iscsi/storage3-disk

[root@server1 ~]#lvextend -L +3G /dev/vgiscsi/lviscsi

[root@server1 ~]#gfs2_grow -v /iscsi    -->在线扩容


扩展应用服务器server3

分别修改存储服务器storage1,storage2,storage3的配置文件targets.conf

[root@server1 ~]#vim /etc/tgt/targets.conf

   ......

   initiator-address 192.168.122.10

   initiator-address 192.168.122.20

initiator-address 192.168.122.60

   ......

[root@server1 ~]#tgt-admin --update ALL --force    -->强制更新服务配置


在应用服务器server3上发现并登录存储

[root@server3 ~]#yum install iscsi-initiator-utils

[root@server3 ~]#/etc/init.d/iscsi start

[root@server3 ~]#iscsiadm -m discovery -t sendtargets -p 192.168.122.30:3260

[root@server3 ~]#iscsiadm -m discovery -t sendtargets -p 192.168.122.40:3260

[root@server3 ~]#iscsiadm -m discovery -t sendtargets -p 192.168.122.50:3260

[root@server3 ~]#iscsiadm -m node -T iqn.2013-12.com.vir:storage1.target1 -l

[root@server3 ~]#iscsiadm -m node -T iqn.2013-12.com.vir:storage2.target2 -l

[root@server3 ~]#iscsiadm -m node -T iqn.2013-12.com.vir:storage3.target3 -l


拷贝udev规则,并重启udev

[root@server3 ~]#scp 192.168.122.10:/etc/udev/rules.d/80-iscsi.rules /etc/udev/rules.d/

[root@server3 ~]#start_udev


使server3加入集群,并挂载存储成功

[root@server3 ~]#pvscan

[root@server3 ~]#vgchange -ay vgiscsi

[root@server3 ~]#yum install cman


在server1上编辑cluster.conf,加入server3

[root@Sever1 ~]#vim /etc/cluster/cluster.conf

3" name="iscsi_cluster">    

--> 修改配置文件,配置版本号+1(2->3)              

   

       

           

               

           

           

               

           

           

               

           

       

   

   

   

       

       

   


[root@server1 ~]#ccs_tool update /etc/cluster/cluster.conf

Config file updated from version 2 to 3

Update complete.


[root@server1 ~]#scp /etc/cluster/cluster.conf 192.168.122.60:/etc/cluster/


[root@server3 ~]#/etc/init.d/cman start

Starting cluster:

Loading modules... done

Mounting configfs... done

Starting ccsd... done

Starting cman... failed

cman not started: two_node set but there are more than 2 nodes /usr/sbin/cman_tool: aisexec daemon didn't start

                                               [FAILED]


[root@server1 ~]#vim /etc/cluster/cluster.conf

4" name="iscsi_cluster">

   

       

           

               

           

           

               

           

           

               

           

       

   two_node="1"/>    -->删除two_node="1"

   

   

       

       

   


[root@server1 ~]#ccs_tool update /etc/cluster/cluster.conf

Config file updated from version 3 to 4

Update complete.


[root@server3 ~]#/etc/init.d/cman start

Starting cluster:

Loading modules... done

Mounting configfs... done

Starting ccsd... done

Starting cman... done

Starting daemons... done

Starting fencing... done

                                               [ OK ]


安装并加载gfs2模块,挂载gfs2文件系统

[root@server3 ~]#yum install gfs2-utils kmod-gfs

[root@server3 ~]#modprobe gfs2

[root@server3 ~]#mkdir /iscsi

[root@server3 ~]#mount -t gfs2 -o lockproto=lock_dlm /dev/vgiscsi/lviscsi /iscsi

/sbin/mount.gfs2: Too many nodes mounting filesystem, no free journals


由于之前创建GFS文件系统的时候,只指定了2个journal空间,现在添加server3后没有空闲的journal空间分配,需要为server3添加一个journal空间

[root@server1 ~]#gfs2_tool journals /iscsi

journal1 - 128MB

journal0 - 128MB

2 journal(s) found.


[root@server1 ~]#gfs2_jadd -j 1 /iscsi

Filesystem: /iscsi

Old Journals 2

New Journals 3


[root@Server3 ~]#mount -t gfs2 -o lockproto=lock_dlm /dev/vgiscsi/lviscsi /iscsi/