GFS2配置


GFS2配置

Red Hat Cluster Suite for Red Hat Enterprise Linux 5



1. 拓扑

节点        主机名       备注
node101    node101.linux.com    存储
node102    node102.linux.com    存储 (未使用)
node104    node104.linux.com    应用端服务器
node105    node105.linux.com    应用端服务器
node106    node106.linux.com    应用端服务器


2. 环境要求
1) 应用服务器需要设置主机名 (集群时需要)
   node104.linux.com
   node105.linux.com
   node106.linux.com
2) 与应用服务器的主机名对应的解析 (/etc/hosts 或 DNS)
3) 所有服务器关闭防火墙与SELinux
4) 所有服务器YUM源中配置 Server, VT, Cluster, ClusterStorage
5) 应用服务器节点/etc/fstab中的挂载设备确保为UUID或LABEL方式
6) 本文所描述的布署环境为rhel5.8 x86_64

3. 存储服务器端
3.1 软件列表
scsi-target-utils-1.0.14-2.el5  — tgt软件包(tgtd服务, tgt-admin, targets.conf等)

3.2 共享存储配置 (/etc/tgt/targets.conf)
1) 准备存储设备
dd if=/dev/zero of=/tmp/disk/disk1 bs=1G count=2

2) 配置共享存储设备
<target iqn.2014-11.com.chxbd:Storage1.target1>
    backing-store /tmp/disk/disk1
    vendor_id Storage1
    product_id disk1
    initiator-address 192.168.80.104
    initiator-address 192.168.80.105
    initiator-address 192.168.80.106
</target>

3.3 启动tgtd服务
service tgtd start
chkconfig tgtd on   # 开机自启动

3.4 查看共享信息
tgt-admin —show

4. 应用服务器端 (其中一个节点)
4.1 软件列表
1) system-config-cluster-1.0.57-12 (生成 /etc/cluster/cluster.conf 集群节点配置文件的GUI)
2) cman-2.0.115-96.el5 (心跳, 用于在全局文件系统中实现分布式锁管理)
3) iscsi-initiator-utils-6.2.0.872-13.el5 -- iscsi软件包(iscsi服务, iscsiadm等)
4) kmod-gfs-0.1.34-17.el5 -- gfs2模块(lock_dlm等, XEN内核安装kmod-gfs-xen)
5) lvm2-cluster-2.02.88-7.el5 (配置CLVM, 开机自动激活VG)
6) gfs2-utils-0.1.62-34.el5 — gfs2工具包(gfs2文件系统自动挂载服务, mount.gfs2, mkfs.gfs2, gfs2_grow等)

4.2 生成应用端的集群节点配置
1) 安装system-config-cluster
启动system-config-cluster
创建名称为fs_cluster1的集群
在Cluster节点下添加3个应用服务端的节点名称node104.linux.com, node105.linux.com和node106.linux.com(主机名)
保存
2) 同步/etc/cluster/cluster.conf到其他应用节点

4.3 安装并启动cman (在其他节点也同时启动)
yum install cman -y
service cman start
chkconfig cman on

4.4 登录iscsi设备
1) 启动iscsi服务
service iscsi start
chkconfig iscsi on   # 开机自启动以自动发现并登录iscsi设备

2) 发现iscsi设备
iscsiadm -m discovery -t sendtargets -p 192.168.80.101:3260

3) 登录iscsi设备
iscsiadm -m node -T iqn.2014-11.com.chxbd:Storage1.target1 -l

4.5 为iscsi设备配置udev规则
1) 查看设备信息
udevinfo -a -p /sys/block/sda

2) 配置udev规则 (/etc/udev/rules.d/80-iscsi.rules)
SUBSYSTEM=="block",SYSFS{model}=="disk1",SYSFS{vendor}=="Storage1",SYMLINK+="iscsi/Storage1-disk1"
拷贝到其他应用服务端节点

3) 使udev规则生效
start_udev 或 udevtrigger
检查是否存在/dev/iscsi/Storage1-disk1链接文件

4.6 创建基于LVM的gfs2文件系统
pvcreate /dev/iscsi/Storage1-disk1
vgcreate vgiscsi /dev/iscsi/Storage1-disk1
lvcreate -L 500M -n lv_iscsi_disk1 vgiscsi

4.7 加载gfs2模块
安装kmod-gfs, XEN内核安装kmod-gfs-xen
modprobe gfs2   # lsmod检查

4.8 创建gfs2文件系统
mkfs.gfs2 -t fs_cluster1:fs1 -p lock_dlm -j 3 /dev/vgiscsi/lv_iscsi_disk1
说明:
-t: 指定lock table名称
  fs_cluster1: 步骤1中创建的集群名称
  fs1: 文件系统名称, 不能和本地及其它gfs2的文件系统名称重复
-p: 锁协议, 多节点固定为lock_dlm
-j: 日志数, 与集群节点数相同

4.9 挂载gfs2文件系统
1) 直接挂载
mount -t gfs2 -o lockproto=lock_dlm,noatime /dev/VGISCSI/lv_iscsi_disk1 /mnt

2) 自动挂载
编辑/etc/fstab:
/dev/mapper/vgiscsi-lv_iscsi_disk1 /mnt/gfs gfs2 rw,noatime,lockproto=lock_dlm 0 0
然后安装并启动gfs2 (yum install gfs2), 自动从/etc/fstab中挂载gfs2的文件系统
请确保gfs2服务开机自启动(chkconfig gfs2 on), 否则gfs2文件系统开机时不能正常挂载

4.10 开机自动激活VG
1) 安装lvm2-cluster
2) lvmconf --enable-cluster -- Set locking_type to the default clustered type on this system
3) service clvmd start -- 启动集群LVM后台进程, 用于集群中分布式LVM元数据的更新, 每个节点都要启动该进程
4) chkconfig clvmd on — 开机自启动以实现开机自动激活VG

5. 其他应用服务器端 (其余节点)
5.1 软件列表
1) iscsi-initiator-utils-6.2.0.872-13.el5 -- iscsi软件包(iscsi服务, iscsiadm等)
2) cman-2.0.115-96.el5 (心跳, 用于在全局文件系统中实现分布式锁管理)
3) gfs2-utils-0.1.62-34.el5 -- gfs2工具包(gfs2文件系统自动挂载服务, mount.gfs2, mkfs.gfs2, gfs2_grow等)
4) lvm2-cluster-2.02.88-7.el5 (配置CLVM, 开机自动激活VG)

5.2 处理iscsi设备
1) 发现并登录iscsi设备
2) 安装gfs2-utils
3) 配置/etc/fstab
4) 启动gfs2服务自动挂载/etc/fstab中的gfs2文件系统
5) 配置CLVM, 开机启动时自动激活VG

6. 应用服务端注意事项
1) 先同步各节点中的集群配置文件
2) 启动cman时各节点同时启动
3) 各节点中以下服务开机自启动
   chkconfig iscsi on
   chkconfig cman on
   chkconfig clvmd on
   chkconfig gfs2 on
   chkconfig rgmanager on   # rgmanager可选

7. 其他说明

To start the cluster software on a member, type the following commands in this order:

    service cman start
    service gfs start, if you are using Red Hat GFS
    service rgmanager start

To stop the cluster software on a member, type the following commands in this order:

    service rgmanager stop
    service gfs stop, if you are using Red Hat GFS
    service cman stop  

以下是redhat官方的解释

-----------------------------------------------------------------------

It may become necessary to temporarily disable the cluster software on a cluster member. For example, if a cluster member experiences a hardware failure, you may want to reboot that member, but prevent it from rejoining the cluster to perform maintenance on the system.
Use the /sbin/chkconfig command to stop the member from joining the cluster at boot-up as follows:

# chkconfig --level 2345 rgmanager off
# chkconfig --level 2345 gfs off
# chkconfig --level 2345 clvmd off
# chkconfig --level 2345 cman off

Once the problems with the disabled cluster member have been resolved, use the following commands to allow the member to rejoin the cluster:

# chkconfig --level 2345 rgmanager on
# chkconfig --level 2345 gfs on
# chkconfig --level 2345 clvmd on
# chkconfig --level 2345 cman on

You can then reboot the member for the changes to take effect or run the following commands in the order shown to restart cluster software:

    service cman start
    service clvmd start, if CLVM has been used to create clustered volumes
    service gfs start, if you are using Red Hat GFS
    service rgmanager start 

 


8. 参考
1) https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Cluster_Suite_Overview/index.html
2) http://blog.chinaunix.net/uid-7530389-id-2050061.html



转载于:https://www.cnblogs.com/goooogs/p/4085780.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值