手机版
你好,游客 登录 注册
背景:
阅读新闻

DRBD+Heartbeat+NFS实现Linux高可用群集(HA)

[日期:2012-05-27] 来源:Linux社区  作者:zhuchaobo [字体:大 中 小]

4、新建分区:
[root@master ~]# fdisk /dev/sda
 
The number of cylinders for this disk is set to 1958.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
   (e.g., DOS FDISK, OS/2 FDISK)
 
Command (m for help): n   #增加新分区
Command action
   e   extended
   p   primary partition (1-4)
p   #增加主分区
Selected partition 4
First cylinder (328-1958, default 328):   #默认柱面,直接回车
Using default value 328
Last cylinder or +size or +sizeM or +sizeK (328-1958, default 1958): +1G  #大小为1G
 
Command (m for help): w   #保存退出
The partition table has been altered!
 
Calling ioctl() to re-read partition table.
 
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
[root@master ~]#partprobe   /dev/sda
查看分区:
[root@master ~]#cat /proc/partitions

5、安装drdb:
[root@master ~]# yum localinstall drbd83-8.3.8-1.el5.CentOS.i386.rpm kmod-drbd83-8.3.8-1.el5.centos.i686.rpm –nogpgcheck -y
 
加载DRBD 模块
[root@master ~]# modprobe drbd
查看模块加载
 [root@master ~]# lsmod |grep drbd
drbd                  228528 0
编辑配置文件
[root@master ~]# vim /etc/drbd.conf
在底行模式下输入“r /usr/share/doc/drbd83-8.3.8/drbd.conf”。
在从属服务器执行相同的操作;
 
[root@master ~]# cd /etc/drbd.d/                  
[root@master drbd.d]# cp global_common.conf global_common.conf.bak
[root@master drbd.d]# vim global_common.conf
内容为:
global {
        usage-count no;
        # minor-count dialog-refresh disable-ip-verification
}
 
common {
        protocol C;
 
 
        startup {
                 wfc-timeout 120;
                 degr-wfc-timeout 120;
        }
 
        disk {
                on-io-error detach;
                fencing resource-only;
        }
 
        net {
                cram-hmac-alg "sha1";
                shared-secret "mydrbdlab";
        }
 
        syncer {
                rate 100M;
        }
}
 
定义资源:
名字为web.res
编辑
[root@master drbd.d]# vim web.res
resource web {
      
        on master {                           
                device /dev/drbd0;           
                disk /dev/sda4;               
                address 192.168.1.2:7898;     
                meta-disk internal;           
        }
        on slave {
                device /dev/drbd0;
                disk /dev/sda4;
                address 192.168.1.3:7898;
                meta-disk internal;
        }
}
 
将此两个文件拷贝到从属服务器中(地址为192.168.1.3)
[root@master drbd.d]# scp global_common.conf 192.168.1.3:/etc/drbd.d/
[root@master drbd.d]# scp web.res 192.168.1.3:/etc/drbd.d/

linux
相关资讯       Linux集群  高可用群集 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或��接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款