向集群环境中增加一个OCFS2节点

可以应用的环境:

Linux OS - Version: 1.2.5-1 to 1.2.9-1
Linux x86
Linux x86-64
Linux Kernel - Version: 1.2.5-1 to 1.2.9-1

[@more@]

目的:

本文的目的是讲述一个向一个现有的cluster环境中增加一个ocfs节点并且不用停止现有的环境。

解决方案:

o2cb_ctl工具是用来在线增加ocfs2节点的工具,以下的步骤列出了如何增加的操作:

* 192.168.100.1 is an existing ocfs2 node which is already in the online ocfs2 cluster and its hostname is rac1
* 192.168.100.2 is an existing ocfs2 node which is already in the online ocfs2 cluster and its hostname is rac2
* 192.168.100.3 is an new ocfs2 node rac3 which will be added in the online ocfs2 cluster and its hostname is rac3

这个例子是在EL4/REHL4中,如果你使用的是EL5/REHL5,那么相关的配置文件地址就有了一些改变,在EL5/REHL5中:/config目录改为了/sys/kernel/config,/debug改到了/sys/kernel/debug,dlmfs还是在以前的位置/dlm

1、准备工作

在执行o2cb_ctl工具之前我们需要完成以下的工作:

1)查看当前ocfs2卷内的“Max Node Slots"

a)得到当前ocfs2的卷分区:

[root@rac1]#mounted.ocfs2 -d
/dev/sdb1 ocfs2 9bd19e16-79b7-4dc7-9b4b-01d6526d0392
/dev/sdc1 ocfs2 28d6ccc0-adf5-4602-88cf-1fb3881fefc6


b)查看当前ocfs2卷内的”Max Node Slots"

这个值是用来指定可以并发的挂载这个卷的阀值,可以使用tunefs.ocfs2来增加,

在以下的示例中此值的值是2,所以我们需要增大。

[root@rac1] # echo 'stats -h' | debugfs.ocfs2 /dev/sdb1debugfs.ocfs2 1.2.7
debugfs: stats -h
Revision: 0.90
Mount Count: 0 Max Mount Count: 20
State: 0 Errors: 0
Check Interval: 0 Last Check: Fri Jun 13 02:41:14 2008
Creator OS: 0
Feature Compat: 1 BackupSuper
Feature Incompat: 0 None
Tunefs Incomplete: 0 None
Feature RO compat: 0 None
Root Blknum: 9 System Dir Blknum: 10
First Cluster Group Blknum: 4
Block Size Bits: 10 Cluster Size Bits: 12
Max Node Slots: 2
Label: test1
UUID: 81BCE74AF25B4AAEB6D53D7AB89A936B


c)更改“Max Node Slots"值为4:

这个值不能在一个已经挂载的卷上动态的修改,如果你要这么做的话就会遇到错误的提示,并修改失败:

#tunefs.ocfs2 -N 4 /dev/sdb1
tunefs.ocfs2: Trylock failed while opening device "/dev/sdb1"

Please umount the ocfs2 volume on all nodes before tuning its 'Max Node Slots'.

[root@rac1] # umount /dev/sdb1
[root@rac2] # umount /dev/sdb1
[root@rac1] # tunefs.ocfs2 -N 4 /dev/sdb1


d)在已经存在的节点上查看ocfs2的状态:

root@rac1]#/etc/init.d/o2cb status
Module "configfs": Loaded
Filesystem "configfs": Mounted
Module "ocfs2_nodemanager": Loaded
Module "ocfs2_dlm": Loaded
Module "ocfs2_dlmfs": Loaded
Filesystem "ocfs2_dlmfs": Mounted
Checking O2CB cluster ocfs2: Online
Heartbeat dead threshold: 61
Network idle timeout: 30000
Network keepalive delay: 2000
Network reconnect delay: 2000
Checking O2CB heartbeat: Active

e)在rac1rac2节点上检查/etc/ocfs2/cluster.conf文件:

保证在cluster.conf文件内只包含在线的节点,不能包含将要新增的节点信息,因为o2cb_ctl也会增加新增的节点数据到cluster.conf文件内而不会去检查是否已经存在了:

[root@rac1]#cat /etc/ocfs2/cluster.conf
node:
ip_port = 7777
ip_address = 192.168.100.1
number = 0
name = rac1
cluster = ocfs2

node:
ip_port = 7777
ip_address = 192.168.100.2
number = 1
name = rac2
cluster = ocfs2

cluster:
node_count = 2
name = ocfs2



f)保证内存文件中未包含了将要新增节点的信息/config/cluster/ocfs2/node/:

[root@rac1]#ls -l /config/cluster/ocfs2/node/
drwxr-xr-x 2 root root 0 Feb 11 19:16 rac1
drwxr-xr-x 2 root root 0 Feb 11 19:16 rac2


如果以上步骤都检测没问题的话就可以通过执行o2cb_ctl去新增第三个节点:

2、新增节点

a)执行o2cb_ctl工具去在线新增节点3到cluster中:

[root@rac1]#o2cb_ctl -C -i -n rac3 -t node -a number=2 -a ip_address=192.168.100.3 -a ip_port=7777 -a cluster=ocfs2

Node rac3 created
b)在每个节点上查看磁盘上的内存文件,检查新增的节点是否已经存在:

[root@rac1]#ls -l /config/cluster/ocfs2/node/
drwxr-xr-x 2 root root 0 Feb 11 19:16 rac1
drwxr-xr-x 2 root root 0 Feb 11 19:16 rac2
drwxr-xr-x 2 root root 0 Feb 11 19:17 rac3

3、在新增节点上执行以下工作:

a)scp新文件 /etc/ocfs2/cluster.conf 到节点3

[root@rac1]#scp /etc/ocfs2/cluster.conf root@rac3:/root/cluster.conf

[root@rac3]#cp /etc/ocfs2/cluster.conf /etc/ocfs2/cluster.conf.back

[root@rac3]#cp /root/cluster.conf /etc/ocfs2/cluster.conf

b)在节点3上启动o2cb服务

[root@rac3]#/etc/init.d/o2cb start


c)在节点3上mount此ocfs2卷

[root@rac3]#mount -t ocfs2 /dev/sdb1 /data1


4 问题诊断

a)节点已经存在('o2cb_ctl reports 'Node "rac3" already exists'')

i)执行o2cb_ctl报节点已经存在:

[root@rac1 ~]# o2cb_ctl -C -i -n rac3 -t node -a number=2 -a ip_address=192.168.100.3 -a ip_port=7777 -a cluster=ocfs2

o2cb_ctl: Node "rac3" already exists

ii)也不能mount此ocfs2分区:

[root@rac3]#mount -t ocfs2 /dev/sdb1 /data1

mount.ocfs2: Transport endpoint is not connected while mounting /dev/sdb1 on /data1. Check 'dmesg' for more information on this error.


iii)在节点1上的/var/log/messages 发现以下错误:

(4182,0):o2net_accept_one:1735 attempt to connect from unknown node at 192.168.100.3:57423


iiii)通过在节点1上查看in-memory文件发现节点3并不存在:

[root@rac1]#ls -l /config/cluster/ocfs2/node/
drwxr-xr-x 2 root root 0 Feb 11 19:16 rac1
drwxr-xr-x 2 root root 0 Feb 11 19:16 rac2


iiiii)分别在节点1、2上检查/etc/ocfs2/cluster.conf 文件,发现节点3的信息已经存在:

[root@rac1]#cat /etc/ocfs2/cluster.conf
node:
ip_port = 7777
ip_address = 192.168.100.1
number = 0
name = rac1
cluster = ocfs2

node:
ip_port = 7777
ip_address = 192.168.100.2
number = 1
name = rac2
cluster = ocfs2

node:
ip_port = 7777
ip_address = 192.168.100.3
number = 2
name = rac3
cluster = ocfs2

cluster:
node_count = 3
name = ocfs2



iiiiii)问题解决:

1、在节点1上的 /etc/ocfs2/cluster.conf 文件内删除掉节点3的信息

2、拷贝/etc/ocfs2/cluster.conf 文件到节点2上

3、使用o2cb_ctl来增加节点3

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10130206/viewspace-1040228/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10130206/viewspace-1040228/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值