码迷,mamicode.com
首页 > 系统相关 > 详细

linux下高可用集群之corosync详解

时间:2016-08-05 12:09:46      阅读:556      评论:0      收藏:0      [点我收藏+]

标签:linux下高可用集群之corosync详解

linux下高可用集群之corosync详解

1.corosync相当于heartbeat功能,提供Messaging Layer,收集节点之间心跳等信息

 pacemaker相当于haresources,提供crm管理资源信息

2.实验:双集群节点为node1.willow.com,IP为1.1.1.18 node2.willow.com,IP为1.1.1.19

            在node1.willow.com主机配置如下:(与node2.willow.com集群配置全部相同)

2.1.安装corosync和pacemaker等需要安装的包

 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-cts-1.1.5-1.1.el5.i386.rpm

 pacemaker-libs-1.1.5-1.1.el5.i386.rpm

 resource-agents-1.0.4-1.1.el5.i386.rpm

#yum --nogpgcheck localinstall  *.rpm

2.2.配置corosync配置文件

#cp /etc/corosync/corosync.conf.example /etc/corosync/corosync.conf

#vim /etc/corosync/corosync.conf

totem {

        version: 2

        secauth: on

        threads: 2

        interface {

                ringnumber: 0

                bindnetaddr: 1.1.1.0

                mcastaddr: 226.98.1.21

                mcastport: 5405

        }

}


logging {

        fileline: off

        to_stderr: no

        to_logfile: yes

        to_syslog: no

        logfile: /var/log/cluster/corosync.log

        debug: off

        timestamp: on

        logger_subsys {

                subsys: AMF

                debug: off

        }

}


amf {

        mode: disabled

}


service {

        ver: 0

        name: pacemaker

}


aisexec {

        user: root

        group: root

}

2.3.生成authkey认证文件

#corosync-keygen 

2.4.从node1节点复制authkey和corosync.conf文件至node2节点上,内容保持一致并创建日志目录

mkdir /var/log/cluster

scp -p authkey corosync.conf node2:/etc/corosync/

ssh node2 ‘mkdir /var/log/cluster‘

2.5.启动corosync服务

service corosync start

ssh node2 ‘service corosync start‘

2.6.查看日志信息

#grep -e "Corosync Cluster Engine" -e "configuration file" /var/log/cluster/corosync.log 

Aug 05 09:36:14 corosync [MAIN  ] Corosync Cluster Engine (‘1.2.7‘): started and ready to provide service.

Aug 05 09:36:14 corosync [MAIN  ] Successfully read main configuration file ‘/etc/corosync/corosync.conf‘.

#grep TOTEM /var/log/cluster/corosync.log

Aug 05 09:36:14 corosync [TOTEM ] Initializing transport (UDP/IP).

Aug 05 09:36:14 corosync [TOTEM ] Initializing transmit/receive security: libtomcrypt SOBER128/SHA1HMAC (mode 0).

Aug 05 09:36:15 corosync [TOTEM ] The network interface [1.1.1.18] is now up.

Aug 05 09:36:15 corosync [TOTEM ] A processor joined or left the membership and a new membership was formed.

Aug 05 09:36:42 corosync [TOTEM ] A processor joined or left the membership and a new membership was formed.

#grep ERROR: /var/log/cluster/corosync.log

Aug 05 09:37:17 node1.willow.com pengine: [9917]: ERROR: unpack_resources: Resource start-up disabled since no STONITH resources have been defined

Aug 05 09:37:17 node1.willow.com pengine: [9917]: ERROR: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option

Aug 05 09:37:17 node1.willow.com pengine: [9917]: ERROR: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity

Aug 05 09:52:17 node1.willow.com pengine: [9917]: ERROR: unpack_resources: Resource start-up disabled since no STONITH resources have been defined

Aug 05 09:52:17 node1.willow.com pengine: [9917]: ERROR: unpack_resources: Either configure some or disable STONITH with the stonith-enabled option

Aug 05 09:52:17 node1.willow.com pengine: [9917]: ERROR: unpack_resources: NOTE: Clusters with shared data need STONITH to ensure data integrity

#grep pcmk_startup /var/log/cluster/corosync.log 

Aug 05 09:36:15 corosync [pcmk  ] info: pcmk_startup: CRM: Initialized

Aug 05 09:36:15 corosync [pcmk  ] Logging: Initialized pcmk_startup

Aug 05 09:36:15 corosync [pcmk  ] info: pcmk_startup: Maximum core file size is: 4294967295

Aug 05 09:36:15 corosync [pcmk  ] info: pcmk_startup: Service: 9

Aug 05 09:36:15 corosync [pcmk  ] info: pcmk_startup: Local hostname: node1.willow.com

2.7.crm_mon 监控


 将持续更新博客....................

本文出自 “夏维柳” 博客,请务必保留此出处http://willow.blog.51cto.com/6574604/1834627

linux下高可用集群之corosync详解

标签:linux下高可用集群之corosync详解

原文地址:http://willow.blog.51cto.com/6574604/1834627

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!