免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
楼主: okzb
打印 上一主题 下一主题

linux高可用(HA)集群笔记heartbeat+drbd+nfs (原创) [复制链接]

论坛徽章:
0
11 [报告]
发表于 2008-01-19 10:59 |只看该作者
楼上的疑问也是我所担心的。

论坛徽章:
0
12 [报告]
发表于 2008-01-19 11:16 |只看该作者
在网上找到一些资料 http://www.linux-ha.org/HaNFS

Make sure you are using a shared disk device, either shared by hardware between your two servers or by DRBD.

Mount your shared device in one of the machines. For example, if the device is /dev/sdb1 and the directory you want to mount to is /data:

mount -t ext3 /dev/sdb1 /data

If the directory you will export is /data/userdata, create it if it is not there yet:

mkdir /data/userdata

Move /var/lib/nfs to your shared disk, make a link (/var/lib/nfs) to it:

mv /var/lib/nfs /data
ln -s /data/nfs /var/lib/nfs

On the other machine, remove the /var/lib/nfs directory and create a link instead:

rm -fr /var/lib/nfs
ln -s /data/nfs /var/lib/nfs

这一步估计可以保证数据写入正确性的问题,

http://www.linux-ha.org/DRBD/NFS
这里还一些资料
Note that auto_failback is off; we should not fail back unless a human has confirmed that the DRBD state is consistent.
We use the Delay script to create a brief pause during failover operations. It was proposed by Jens Dreger in a post at

看来failback需要人手工来做了

论坛徽章:
0
13 [报告]
发表于 2008-01-19 13:48 |只看该作者
我启动DRBD时出现这种错误,楼主知道是什么原因不?
[root@web01 ~]# /etc/init.d/drbd start
Starting DRBD resources:    [ d0 n0 ].
..........
***************************************************************
DRBD's startup script waits for the peer node(s) to appear.
- In case this node was already a degraded cluster before the
   reboot the timeout is 0 seconds. [degr-wfc-timeout]
- If the peer was available before the reboot the timeout will
   expire after 0 seconds. [wfc-timeout]
   (These values are for resource 'r0'; 0 sec -> wait forever)
To abort waiting enter 'yes' [  11]:yes

论坛徽章:
0
14 [报告]
发表于 2008-01-19 13:53 |只看该作者
我第一次使用#drbdadm create-md r0没有问题,第二次把drbd停止,再运行此命令就出现以下错误
[root@web01 ~]# drbdadm create-md r0

Valid meta-data already in place, recreate new?
[need to type 'yes' to confirm] yes

Creating meta data...
initialising activity log
NOT initialized bitmap (256 KB)
New drbd meta data block sucessfully created.

论坛徽章:
0
15 [报告]
发表于 2008-01-20 17:00 |只看该作者
原帖由 xpingtn 于 2008-1-19 13:53 发表
我第一次使用#drbdadm create-md r0没有问题,第二次把drbd停止,再运行此命令就出现以下错误
[root@web01 ~]# drbdadm create-md r0

Valid meta-data already in place, recreate new?
[need to type 'yes' ...


drbdadm create-md r0
这个只要做一次就可以了,是初始化资源用的,如果你第二次做的话相当于格式化了

论坛徽章:
0
16 [报告]
发表于 2008-01-20 19:06 |只看该作者
明白了,谢谢!!!!

论坛徽章:
0
17 [报告]
发表于 2008-02-19 15:43 |只看该作者
顶下先,虽然不甚明白

论坛徽章:
0
18 [报告]
发表于 2008-02-19 18:12 |只看该作者
看帖 回帖 中华美德

论坛徽章:
0
19 [报告]
发表于 2008-03-17 15:55 |只看该作者
正在研究这个东西.

论坛徽章:
0
20 [报告]
发表于 2008-03-17 18:03 |只看该作者
我在执行drbdadm create-md r0的时候出错,提示如下:

Found ext3 filesystem which uses 2048256 kB
current configuration leaves usable 2048156 kB

Device size would be truncated, which
would corrupt data and result in
'access beyond end of device' errors.
You need to either
   * use external meta data (recommended)
   * shrink that filesystem first
   * zero out the device (destroy the filesystem)
Operation refused.

Command 'drbdmeta /dev/drbd1 v08 /dev/sda12 internal create-md' terminated with exit code 40
drbdadm aborting

就是如果设置元数据在分区内部即设置为 internal,提示的三种解决方法我倒是看懂了。第一种将 元数据设置在别的分区,我不想。第二种缩小文件系统,不会 ,第三种 破坏文件系统,也不太会,不过最后用dd命令搞定了。也不知道对不对,反正最后能用。
测试了主备转换什么的都成功了。
这个分区是我装系统的时候划分的,于是就自动格式化成ext3了。不知道有人解决了这个问题吗?赐教一下!

[ 本帖最后由 luoriddr 于 2008-3-17 18:06 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP