群集之 COROSYNC OPENAIS +PACEMAKER +REBD+WEB

群集之

COROSYNC OPENAIS +PACEMAKER +REBD+WEB

DRBD

一、准备环境

1.系统环境

# uname �Cr //内核版本
2.6.18-164.el5
# cat /etc/redhat-release  //查看系统信息
Red Hat Enterprise Linux Server release 5.4 (Tikanga)

2.修改主机名称等

在节点1上进行修改

# hostname wj1.a.com //修改主机名称
# vim /etc/sysconfig/network //修改文件

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=wj1.a.com

之后退出再次登陆。

# hostname //查看名称
wj1.a.com
# vim /etc/hosts //修改hosts文件

127.0.0.1                localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.2.1 wj1.a.com
192.168.2.3 wj 2.a.com

在节点2上进行修改

# hostname wj2.a.com //修改主机名称
# vim /etc/sysconfig/network //修改文件

NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=wj2.a.com

之后退出再次登陆。

# hostname //查看名称
wj2.a.com
# vim /etc/hosts //修改hosts文件

127.0.0.1                localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.2.1 wj1.a.com
192.168.2.3 wj2.a.com

3.安装所需的文件

预先将所需的文件上传到管理员家目录。以下操作在wj1.a.com和wj2.a.com上都进行操作。

# yum localinstall *.rpm --nogpgcheck �Cy //使用yum进行安装可以有效的解决包的依赖性问题。

4.同步时钟

要求两个节点上的始终必须要一致。

# hwclock -s //同步始终

5.加载模块

在两个节点上都去进行如下操作。

# modprobe drbd //加载drbd模块
#

# lsmod |grep drbd //查看模块
drbd                  228528  0
#

6.创建新分区

以下操作要求在wj1.a.com和wj2.a.com上都进行。同时要求两个节点所创建的新分区大小一致。

# fdisk -l //查看有关情况

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1288    10241437+  83  Linux
/dev/sda3            1289        1415     1020127+  82  Linux swap / Solaris
# fdisk /dev/sda

The number of cylinders for this disk is set to 2610.
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 (1416-2610, default 1416):
Using default value 1416
Last cylinder or +size or +sizeM or +sizeK (1416-2610, default 2610): +1G //两个节点的分区大小要一致。

Command (m for help): p //显示

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1288    10241437+  83  Linux
/dev/sda3            1289        1415     1020127+  82  Linux swap / Solaris
/dev/sda4            1416        1538      987997+  83  Linux

Command (m for help): w 保存

# fdisk -l //再次查看

Disk /dev/sda: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        1288    10241437+  83  Linux
/dev/sda3            1289        1415     1020127+  82  Linux swap / Solaris
/dev/sda4            1416        1538      987997+  83  Linux
#

# partprobe /dev/sda //重新加载

 

二、DRBD配置

以下操作要求在节点wj1和wj2上都做。

1.修改conf配置文件

# cd /usr/share/doc/drbd83-8.3.8/
#ls
ChangeLog  COPYING drbd.conf  file.list  README

#cp drbd.conf /etc/ 复制配置文件到相关目录
cp: overwrite `/etc/drbd.conf'? y
#cd /etc/drbd.d/
# ls
global_common.conf
# cp -p global_common.conf global_common.conf.bak //最好对文件进行备份
# vim global_common.conf

//第一列是行的序号

1 global {
2         usage-count no;
3 }
4
5 common {
6         protocol C;
7         startup {

8                 wfc-timeout 120;

9                 degr-wfc-timeout 120;

10         }

11         disk {

12                 on-io-error detach;

13                 fencing resource-only;

14         }

15         net {

16         cram-hmac-alg "sha1";

17         shared-secret "mydrbdlab";      
18         }
19         syncer {
20                 rate 100M;
21         }
22 }

clip_image002

 

2.修改资源文件

# cd /etc/drbd.d/

# vim web.res

1 resource web {
2        on wj1.a.com {
3        device /dev/drbd0;
4        disk /dev/sda5;
5        address 192.168.2.1:7789;
6        meta-disk  internal;
7        }
8        on wj2.a.com {
9        device /dev/drbd0;
10        disk /dev/sda5;
11        address 192.168.2.3:7789;
12        meta-disk  internal;
13        }
14 }

3.创建资源

#drbdadm create-md web
Writing meta data...
initializing activity log
NOT initialized bitmap
New drbd meta data block successfully created.

 

clip_image004

 

clip_image006

 

 

clip_image008

 

4.启动服务、测试

创建文件系统(在主节点上实现)

/etc/init.d/corosync start

mkfs -t ext3 -L drbdweb /dev/drbd0

[root@wj2 ~]# mkdir /web

[root@wj2 ~]# drbdadm primary web

[root@wj2 ~]# drbd-overview

0:web Connected Primary/Secondary UpToDate/UpToDate C r----

[root@wj2 ~]# drbdadm role web

Primary/Secondary

[root@wj2 ~]# mount /dev/drbd0 /web

[root@wj2 web]# vim test.html

[root@wj2 ~]# umount /web

[root@wj2 ~]# drbdadm secondary web

测试,把wj2变成从的,wj1 变成主的

[root@wj1 web]# drbdadm primary web

[root@wj1 web]# mount /dev/drbd0 /web

[root@wj1 web]# ll /web

总计 20

drwx------ 2 root root 16384 10-18 00:13 lost+found

-rw-r--r-- 1 root root 18 10-17 16:28 test.html

[root@wj1 web]#

 

COROSYNC OPENAIS +PACEMAKER 配置

1.配置两个节点ip地址,静态的

2.配置每一个节点上的名称和hosts文件

3.生成密钥

ssh-keygen -t rsa

在节点1上

ssh-copy-id -i .ssh/id_rsa.pub wj2.a.com

在节点2上

sh-copy-id -i .ssh/id_rsa.pub wj1.a.com

测试无密码的方式通讯

3.配置yum客户端,拷贝软件

[root@wj1 ~]# yum localinstall cluster-glue-1.0.6-1.6.el5.i386.rpm cluster-glue-libs-1.0.6-1.6.el5.i386.rpm corosync-1.2.7-1.1.el5.i386.rpm corosynclib-1.2.7-1.1.el5.i386.rpm heartbeat-3.0.3-2.3.el5.i386.rpm heartbeat-libs-3.0.3-2.3.el5.i386.rpm libesmtp-1.0.4-5.el5.i386.rpm pacemaker-1.1.5-1.1.el5.i386.rpm pacemaker-libs-1.1.5-1.1.el5.i386.rpm perl-TimeDate-1.16-5.el5.noarch.rpm resource-agents-1.0.4-1.1.el5.i386.rpm --nogpgcheck

rpm -ivh openais*

做个快照

4.进入 /etc/corosync目录

root@wj1 corosync]# cd /etc/corosync/

[root@wj1 corosync]# ls

amf.conf.example corosync.conf.example service.d uidgid.d

amf.conf.example 是openais的一个样本

5.先置第一个节点

root@wj1 corosync]# cp corosync.conf.example corosync.conf

compatibility: whitetank (表示兼容corosync 0.86的版本,向后兼容,兼容老的版本,一些

新的功能可能无法实用)

(图腾的意思 ,多个节点传递心跳时的相关协议的信息)

totem {

version: 2 版本号

secauth: off 是否代开安全认证

threads: 0 多少个现成认证 0 无限制

interface {

ringnumber: 0

bindnetaddr: 192 168.2.2 通过哪个网络地址进行通讯,可以给个主机地址(给成192.168.2.0

mcastaddr: 226.94.1.1

mcastport: 5405

}

}

logging {

fileline: off

to_stderr: no 是否发送标准出错

to_logfile: yes 日志

to_syslog: yes 系统日志 (建议关掉一个),会降低性能

logfile: /var/log/cluster/corosync.log (手动创建目录)

debug: off 排除时可以起来

timestamp: on 日志中是否记录时间

一下是openais的东西,可以不用代开

logger_subsys {

subsys: AMF

debug: off

}

}

amf {

mode: disabled

}

补充一些东西,前面只是底层的东西,因为要用pacemaker

service {

ver: 0

name: pacemaker

}

虽然用不到openais ,但是会用到一些子选项

aisexec {

user: root

group: root

}

6.创建目录 mkdir /var/log/cluster

7,为了便面其他主机加入该集群,需要认证,生成一个authkey

[root@wj1 corosync]# corosync-keygen (需要实用/etc/urandom,对于一个新的主机,可能会卡到哪里)

[root@wj1 corosync]# ll

total 28

-rw-r--r-- 1 root root 5384 Jul 28 2010 amf.conf.example

-r-------- 1 root root 128 May 7 16:16 authkey

-rw-r--r-- 1 root root 513 May 7 16:14 corosync.conf

-rw-r--r-- 1 root root 436 Jul 28 2010 corosync.conf.example

drwxr-xr-x 2 root root 4096 Jul 28 2010 service.d

drwxr-xr-x 2 root root 4096 Jul 28 2010 uidgid.d

authkey 不是文本文件

8. 通过到node2上去 (使用 -p 以保留权限)

[root@wj1 corosync]# scp -p authkey corosync.conf wj2:/etc/corosync/

authkey 100% 128 0.1KB/s 00:00

corosync.conf 100% 513 0.5KB/s 00:00

[root@node1 corosync]#

9,在另外的一个节点上创建日志目录

[root@wj corosync]# ssh node2 'mkdir /var/log/cluster'

10.在wj1上启动服务

service corosync start

11.验证corosync引擎是否正常启动了

grep -i -e "corosync cluster engine" -e "configuration file" /var/log/messages

 

clip_image010

 

12。查看初始化成员节点通知是否发出

grep -i totem /var/log/messages

 

clip_image012

 

13.检查过程中是否有错误产生

grep -i error: /var/log/messages |grep -v unpack_resources (便面stonith的错误)

14.检查pacemaker时候已经启动了

[root@wj1 corosync]# grep -i pcmk_startup /var/log/messages

Oct 18 19:19:21 host corosync[4186]: [pcmk ] info: pcmk_startup: CRM: Initialized

Oct 18 19:19:21 host corosync[4186]: [pcmk ] Logging: Initialized pcmk_startup

Oct 18 19:19:21 host corosync[4186]: [pcmk ] info: pcmk_startup: Maximum core file size is: 4294967295

Oct 18 19:19:21 host corosync[4186]: [pcmk ] info: pcmk_startup: Service: 9

Oct 18 19:19:21 host corosync[4186]: [pcmk ] info: pcmk_startup: Local hostname: wj1.a.com

15 前集群的节点上启动另外一个节点

[root@wj1 corosync]# ssh wj2.a.com '/etc/init.d/corosync start'

Starting Corosync Cluster Engine (corosync): [确定]

16,将前面的验证步骤在另外一个节点上再次验证一次

17.在任何一个节点上 查看集群的成员状态

[root@wj1 corosync]# crm status

============

Last updated: Thu Oct 18 19:33:21 2012

Stack: openais

Current DC: wj1.a.com - partition with quorum

Version: 1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f

2 Nodes configured, 2 expected votes

0 Resources configured.

============

Online: [ wj1.a.com wj2.a.com ]

[root@wj1 corosync]#

提示:集群的节点之间的时间应该是同步的,

提供高可用服务

在corosync中,定义服务可以用两种借口

1.图形接口 (使用hb―gui)

2.crm (pacemaker 提供,是一个shell)

比如

[root@wj1 corosync]# ssh wj2.a.com 'date'

2012年 10月 18日 星期四 11:45:39 CST

[root@wj1 corosync]# crm configure show

node wj1.a.com

node wj2.a.com

property $id="cib-bootstrap-options" \

dc-version="1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f" \

cluster-infrastructure="openais" \

expected-quorum-votes="2"

[root@wj1 corosync]#

用于查看cib的相关信息

如何验证该文件的语法错误

[root@wj1 corosync]# crm_verify -L

crm_verify[4321]: 2012/10/18_19:35:27 ERROR: unpack_resources: Resource start-up disabled since no STONITH resources have been defined

crm_verify[4321]: 2012/10/18_19:35:27 ERROR: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option

crm_verify[4321]: 2012/10/18_19:35:27 ERROR: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity

Errors found during check: config not valid

-V may provide more details

[root@wj1 corosync]#

可以看到有stonith错误,在高可用的环境里面,会禁止实用任何支援

可以禁用stonith

[root@wj1 corosync]# crm

crm(live)# configure

crm(live)configure# property stonith-enabled=false

crm(live)configure# commit

crm(live)configure# show

node wj1.a.com

node wj2.a.com

property $id="cib-bootstrap-options" \

dc-version="1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f" \

cluster-infrastructure="openais" \

expected-quorum-votes="2" \

stonith-enabled="false"

crm(live)configure#

再次进行检查

[root@wj1 corosync]# crm_verify -L

[root@wj1 corosync]#

没有错误了

系统上有专门的stonith命令

stonith -L 显示stonith所指示的类型

crm可以使用交互式模式

可以执行help

保存在cib里面,以xml的格式

集群的资源类型有4种

primitive 本地主资源 (只能运行在一个节点上)

group 把多个资源轨道一个组里面,便于管理

clone 需要在多个节点上同时启用的 (如ocfs2 ,stonith ,没有主次之分)

master 有主次之分,如drbd

现在用的资源

ip地址 http服务 共享存储

用资源代理进行配置

ocf lsb的

使用list可以查看

crm(live)ra# classes

heartbeat

lsb

ocf / heartbeat pacemaker

stonith

可以实用list lsb 查看资源代理的脚本

[root@wj1 corosync]# crm

crm(live)# ra

crm(live)ra# # list lsb

NetworkManager acpid anacron apmd

atd auditd autofs avahi-daemon

avahi-dnsconfd bluetooth capi conman

corosync cpuspeed crond cups

cups-config-daemon dnsmasq dund firstboot

functions gpm haldaemon halt

heartbeat hidd hplip ip6tables

ipmi iptables irda irqbalance

isdn kdump killall krb524

kudzu lm_sensors logd lvm2-monitor

mcstrans mdmonitor mdmpd messagebus

microcode_ctl multipathd netconsole netfs

netplugd network nfs nfslock

nscd ntpd openais openibd

pacemaker pand pcscd portmap

psacct rawdevices rdisc readahead_early

readahead_later restorecond rhnsd rpcgssd

rpcidmapd rpcsvcgssd saslauthd sendmail

setroubleshoot single smartd sshd

syslog vncserver wdaemon winbind

wpa_supplicant xfs xinetd ypbind

(是/etc/init.d目录下的)

查看ocf的heartbeat

crm(live)ra# list ocf heartbeat

实用info或者meta 用于显示一个资源的详细信息

meta ocf:heartbeat:IPaddr 各个子项用:分开

配置一个资源,可以在configuration 下面进行配置

1.先资源名字

primitive webIP ocf:heartbeat:IPaddr params ip=192.168.2.2

2.查看

crm(live)configure# show

node node1.a.com

node node2.a.com

primitive webIP ocf:heartbeat:IPaddr \

params ip="192.168.2.2"

property $id="cib-bootstrap-options" \

dc-version="1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f" \

cluster-infrastructure="openais" \

expected-quorum-votes="2" \

stonith-enabled="false"

3.提交 crm(live)configure# commit

4. crm(live)# status

============

Last updated: Thu Oct 18 19:48:18 2012

Stack: openais

Current DC: wj1.a.com - partition with quorum

Version: 1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f

2 Nodes configured, 2 expected votes

1 Resources configured.

============

Online: [ wj1.a.com wj2.a.com ]

webIP (ocf::he 可以看出该资源在wj1上启动

5.实用ifconfig 在节点1上进行查看

[root@wj1 corosync]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:0C:29:8A:85:1D

inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fe8a:851d/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:17092 errors:0 dropped:0 overruns:0 frame:0

TX packets:21479 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:5044547 (4.8 MiB) TX bytes:5137622 (4.8 MiB)

Interrupt:67 Base address:0x2000

eth0:0 Link encap:Ethernet HWaddr 00:0C:29:8A:85:1D

inet addr:192.168.2.2 Bcast:192.168.2.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Interrupt:67 Base address:0x2000

eth1 Link encap:Ethernet HWaddr 00:0C:29:8A:85:27

inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0

inet6 addr: fe80::20c:29ff:fe8a:8527/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:3838 errors:0 dropped:0 overruns:0 frame:0

TX packets:50 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:944796 (922.6 KiB) TX bytes:8066 (7.8 KiB)

Interrupt:67 Base address:0x2080

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:4111 errors:0 dropped:0 overruns:0 frame:0

TX packets:4111 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:3223194 (3.0 MiB) TX bytes:3223194 (3.0 MiB)

6.定义web服务资源

在两个节点上都要进行安装

安装完毕后,可以查看httpd的lsb脚本

[root@node2 corosync]# crm ra list lsb

或者

crm(live)ra# list lsb

查看httpd的参数

crm(live)ra# meta lsb:httpd

lsb:httpd

Apache is a World Wide Web server. It is used to serve \

HTML files and CGI.

Operations' defaults (advisory minimum):

start timeout=15

stop timeout=15

status timeout=15

restart timeout=15

force-reload timeout=15

monitor interval=15 timeout=15 start-delay=15

crm(live)ra#

定义httpd的资源

crm(live)configure# primitive webserver lsb:httpd

crm(live)configure# show

node wj1.a.com

node wj2.a.com

primitive webIP ocf:heartbeat:IPaddr \

params ip="192.168.2.2"

primitive webserver lsb:httpd

property $id="cib-bootstrap-options" \

dc-version="1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f" \

cluster-infrastructure="openais" \

expected-quorum-votes="2" \

stonith-enabled="false"

crm(live)configure#

crm(live)# status

============

Last updated: Thu Oct 18 20:36:53 2012

Stack: openais

Current DC: wj1.a.com - partition WITHOUT quorum

Version: 1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f

2 Nodes configured, 2 expected votes

2 Resources configured.

============

Online: [ wj1.a.com ]

OFFLINE: [ wj2.a.com ]

crm(live)#

发现httpd已经启动了,但是在node2节点上

(高级群集服务资源越来越多,会分布在不同的节点上,以尽量负载均衡)

需要约束在同一个节点上,定义成一个组

可以实用 crm(live)configure# help group 查看配置组的帮助 信息

crm(live)configure# help group

The `group` command creates a group of resources.

Usage:

...............

group <name> <rsc> [<rsc>...]

[meta attr_list]

[params attr_list]

attr_list :: [$id=<id>] <attr>=<val> [<attr>=<val>...] | $id-ref=<id>

...............

Example:

...............

group internal_www disk0 fs0 internal_ip apache \

meta target_role=stopped

...............

定义组

crm(live)configure# group web webIP webserver

crm(live)configure# show

node wj1.a.com

node wj2.a.com

primitive webIP ocf:heartbeat:IPaddr \

params ip="192.168.2.2"

primitive webserver lsb:httpd

group web webIP webserver

property $id="cib-bootstrap-options" \

dc-version="1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f" \

cluster-infrastructure="openais" \

expected-quorum-votes="2" \

stonith-enabled="false"

在次查看群集的状态

crm(live)# status

============

Last updated: Thu Oct 18 21:09:28 2012

Stack: openais

Current DC: wj1.a.com - partition with quorum

Version: 1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f

2 Nodes configured, 2 expected votes

2 Resources configured.

============

Online: [ wj1.a.com wj2.a.com ]

webIP (ocf::heartbeat:IPaddr): Started wj1.a.com

webserver (lsb:httpd): Started wj2.a.com (现在ip地址和 httpd都已经在wj1上了)

lsb之类的服务,一定不能自动启动 chkconfig httpd off

把drbd添加到corosync服务上

代码

crm configure primitive drbd_web_FS ocf:heartbeat:Filesystem params device="/dev/drbd0"

directory="/web" fstype="ext3"

crm configure primitive httpd_drbd_web ocf:heartbeat:drbd params drbd_resource="web" op monitor

interval="60s" role="Master" timeout="40s" op monitor interval="70s" role="Slave" timeout="40s"

crm configure master MS_Webdrbd httpd_drbd_web meta master-max="1" master-node-max="1" clone-

max="2" clone-node-max="1" notify="true"

crm configure colocation drbd_web_FS_on_MS_Webdrbd inf: drbd_web_FS MS_Webdrbd:Master

crm configure order drbd_web_FS_after_MS_Webdrbd inf: MS_Webdrbd:promote drbd_web_FS:start

crm configure property no-quorum-policy="ignore"

配置查看

[root@wj1 ~]# crm configure show

node wj1.a.com

node wj2.a.com

primitive drbd_web_FS ocf:heartbeat:Filesystem \

params device="/dev/drbd0" directory="/web" fstype="ext3"

primitive httpd_drbd_web ocf:heartbeat:drbd \

params drbd_resource="web" \

op monitor interval="60s" role="Master" timeout="40s" \

op monitor interval="70s" role="Slave" timeout="40s"

primitive webIP ocf:heartbeat:IPaddr \

params ip="192.168.2.2"

primitive webserver lsb:httpd

group web webIP webserver

ms MS_Webdrbd httpd_drbd_web \

meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true"

colocation drbd_web_FS_on_MS_Webdrbd inf: drbd_web_FS MS_Webdrbd:Master

order drbd_web_FS_after_MS_Webdrbd inf: MS_Webdrbd:promote drbd_web_FS:start

property $id="cib-bootstrap-options" \

dc-version="1.1.5-1.1.el5-01e86afaaa6d4a8c4836f68df80ababd6ca3902f" \

cluster-infrastructure="openais" \

expected-quorum-votes="2" \

stonith-enabled="false" \

no-quorum-policy="ignore"

[root@wj1 ~]#

[root@wj2 web]# cd /etc/drbd.d/

[root@wj2 drbd.d]# vim global_common.conf

clip_image014

 

WEB服务

安装httpd

在节点上建立html网页

[root@wj2 html]# pwd

/var/www/html

[root@wj2 html]# ll

总计 4

-rw-r--r-- 1 root root 12 10-18 13:22 index.html

[root@wj2 html]#

Start httpd start

root@wj1 html]# pwd

/var/www/html

[root@wj1 html]# ll

总计 4

-rw-r--r-- 1 root root 12 10-18 13:22 index.html

[root@wj1html]#

Start httpd start

测试

现在的状态

clip_image016

clip_image018

停止wj2的corosync服务查看结果

[root@wj2 html]# service corosync stop

Signaling Corosync Cluster Engine (corosync) to terminate: [确定]

Waiting for corosync services to unload:........ [确定]

在节点一上进行观察

 

clip_image020

Corosync Drbd服务自动转换完成

 

 

 

corosync的常见指令

1,crm_attribute 修改集群的全局属性信息

比如前面的stonith和quorum

实际上是修改dc上的cib

2. crm_resource 修改资源

3. crm_node 管理节点

crm_node -e 查看节点的时代(配置文件修改过几次了)

[root@node2 corosync]# crm_node -q 显示当前节点的票数

1

4. cibadmin 集群配置的工具

-u, --upgrade Upgrade the configuration to the latest syntax

-Q, --query Query the contents of the CIB

-E, --erase Erase the contents of the whole CIB

-B, --bump Increase the CIB's epoch value by 1

如果某一个资源定义错了,就可以实用该工具进行删除

-D, --delete Delete the first object matching the supplied criteria, Eg.

也可以在crm的命令行下

crm(live)configure# delete

usage: delete <id> [<id>...]

也可以在该模式下执行edit

执行完毕后,commit 提交

你可能感兴趣的:(系统,cat)