corosync和pacemaker实现httpd和mysql双集群
2015-09-23 00:20
691 查看
一、环境介绍:
三台均为双网卡:
openstack-control.example.com openstack-control
eth0:172.16.171.100
eth1:10.1.1.100
openstack-nova.example.com openstack-nova
eth0:172.16.171.110
eth1:10.1.1.110
openstack-neutron.example.com openstack-neutron
eth0:172.16.171.120
eth1:10.1.1.120
二、corosync和pacemaker配置步骤如下:
1、 配置时区及同步时间
2、配置集群节点间通过主机名互相通信
3、配置集群主机能使root用户基于无密码ssh秘钥方式进行通信
4、 关闭selinux和iptables
5、安装corosync和pacemaker包
6、 修改corosync.conf配置文件
compatibility: whitetank
totem {
version: 2
secauth: on
threads: 2
rrp_mode: passive
interface {
ringnumber: 0
bindnetaddr: 10.1.1.0
mcastaddr: 239.255.1.1
mcastport: 5405
ttl: 1
}
interface {
ringnumber: 1
bindnetaddr: 172.16.171.0
mcastaddr: 238.255.1.1
mcastport: 5406
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
logfile: /var/log/cluster/corosync.log
to_syslog: no
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
service {
ver: 0
name: pacemaker
}
7、生成认证文件:authkey 并传给其他集群服务器
8、启动corosync服务,并查看日志
9、安装crmsh http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/ [network_ha-clustering_Stable]
name=Stable High Availability/Clustering packages (CentOS_CentOS-6) type=rpm-md
baseurl=http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/repodata/repomd.xml.key
enabled=1
10、使用crmsh工具配置全局属性
crm(live)#configure
crm(live)configure#property stonith-enabled=false
crm(live)configure#property no-quorum-policy=ignore
crm(live)configure#property default-resource-stickiness=100
11、使用crmsh工具配置ip资源、nfs资源和mysql资源和配置这两个资源的协同约束(排列约束)、顺序约束
mysql:
crm(live)configure#primitive mysqlvip ocf:heartbeat:IPaddr params ip='10.1.1.200' nic='eth1' cidr_netmask='24' broadcast='10.1.1.0' op monitor interval=30s(启动延迟时间) timeout=20s(监控超时时间)
crm(live)configure#primitive mysqlnfs ocf:heartbeat:Filesystem params device='10.1.1.100:/mysqldata' directory='/mydata' fstype='nfs' op monitor interval=20s timeout=40s
crm(live)configure#verify
crm(live)configure#primitive mysqlserver lsb:mysqld op monitor interval=30s timeout=15s
crm(live)configure#colocation myserver inf: mysqlvip mysqlnfs mysqlserver
crm(live)configure#order mysqlnfs_before_mysqlserver mandatory: mysqlnfs mysqlserver
httpd:
crm(live)configure#primitive httpdvip
ocf:heartbeat:IPaddr params ip='172.16.171.200' nic='eth0'
cidr_netmask='24' broadcast='172.16.171.0' op monitor interval=30s(启动延迟时间)
timeout=20s(监控超时时间)
crm(live)configure#primitive httpdnfs
ocf:heartbeat:Filesystem params device='172.16.171.100:/myhttpd'
directory='/var/www/html' fstype='nfs' op monitor interval=20s timeout=40s
crm(live)configure#verify
crm(live)configure#primitive httpdserver lsb:httpd op monitor interval=30s timeout=15s
crm(live)configure#colocation myapacheserver inf: httpdvip httpdnfs httpdserver
crm(live)configure#order httpdnfs_before_httpdserver mandatory: httpdnfs httpdserver
具体查看如下图:
12、查看节点情况
crm(live)# status
Last updated: Wed Sep 23 00:08:39 2015
Last change: Wed Sep 23 00:08:33 2015
Stack: classic openais (with plugin)
Current DC: openstack-control.example.com - partition with quorum
Version: 1.1.11-97629de
3 Nodes configured, 3 expected votes
6 Resources configured
Online: [ openstack-control.example.com openstack-neutron.example.com openstack-nova.example.com ]
mysqlnfs (ocf::heartbeat:Filesystem): Started openstack-control.example.com
mysqlvip (ocf::heartbeat:IPaddr): Started openstack-control.example.com
mysqlserver (lsb:mysqld): Started openstack-control.example.com
httpdvip (ocf::heartbeat:IPaddr): Started openstack-control.example.com
httpdnfs (ocf::heartbeat:Filesystem): Started openstack-control.example.com
httpdserver (lsb:httpd): Started openstack-control.example.com
通过如下进行主备切换:
node online openstack-neutron.example.com
node standby openstack-neutron.example.com
本文出自 “秋天的童话” 博客,请务必保留此出处http://wushank.blog.51cto.com/3489095/1697290
三台均为双网卡:
openstack-control.example.com openstack-control
eth0:172.16.171.100
eth1:10.1.1.100
openstack-nova.example.com openstack-nova
eth0:172.16.171.110
eth1:10.1.1.110
openstack-neutron.example.com openstack-neutron
eth0:172.16.171.120
eth1:10.1.1.120
二、corosync和pacemaker配置步骤如下:
1、 配置时区及同步时间
2、配置集群节点间通过主机名互相通信
3、配置集群主机能使root用户基于无密码ssh秘钥方式进行通信
4、 关闭selinux和iptables
5、安装corosync和pacemaker包
6、 修改corosync.conf配置文件
compatibility: whitetank
totem {
version: 2
secauth: on
threads: 2
rrp_mode: passive
interface {
ringnumber: 0
bindnetaddr: 10.1.1.0
mcastaddr: 239.255.1.1
mcastport: 5405
ttl: 1
}
interface {
ringnumber: 1
bindnetaddr: 172.16.171.0
mcastaddr: 238.255.1.1
mcastport: 5406
ttl: 1
}
}
logging {
fileline: off
to_stderr: no
to_logfile: yes
logfile: /var/log/cluster/corosync.log
to_syslog: no
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
}
}
service {
ver: 0
name: pacemaker
}
7、生成认证文件:authkey 并传给其他集群服务器
8、启动corosync服务,并查看日志
9、安装crmsh http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/ [network_ha-clustering_Stable]
name=Stable High Availability/Clustering packages (CentOS_CentOS-6) type=rpm-md
baseurl=http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/network:/ha-clustering:/Stable/CentOS_CentOS-6/repodata/repomd.xml.key
enabled=1
10、使用crmsh工具配置全局属性
crm(live)#configure
crm(live)configure#property stonith-enabled=false
crm(live)configure#property no-quorum-policy=ignore
crm(live)configure#property default-resource-stickiness=100
11、使用crmsh工具配置ip资源、nfs资源和mysql资源和配置这两个资源的协同约束(排列约束)、顺序约束
mysql:
crm(live)configure#primitive mysqlvip ocf:heartbeat:IPaddr params ip='10.1.1.200' nic='eth1' cidr_netmask='24' broadcast='10.1.1.0' op monitor interval=30s(启动延迟时间) timeout=20s(监控超时时间)
crm(live)configure#primitive mysqlnfs ocf:heartbeat:Filesystem params device='10.1.1.100:/mysqldata' directory='/mydata' fstype='nfs' op monitor interval=20s timeout=40s
crm(live)configure#verify
crm(live)configure#primitive mysqlserver lsb:mysqld op monitor interval=30s timeout=15s
crm(live)configure#colocation myserver inf: mysqlvip mysqlnfs mysqlserver
crm(live)configure#order mysqlnfs_before_mysqlserver mandatory: mysqlnfs mysqlserver
httpd:
crm(live)configure#primitive httpdvip
ocf:heartbeat:IPaddr params ip='172.16.171.200' nic='eth0'
cidr_netmask='24' broadcast='172.16.171.0' op monitor interval=30s(启动延迟时间)
timeout=20s(监控超时时间)
crm(live)configure#primitive httpdnfs
ocf:heartbeat:Filesystem params device='172.16.171.100:/myhttpd'
directory='/var/www/html' fstype='nfs' op monitor interval=20s timeout=40s
crm(live)configure#verify
crm(live)configure#primitive httpdserver lsb:httpd op monitor interval=30s timeout=15s
crm(live)configure#colocation myapacheserver inf: httpdvip httpdnfs httpdserver
crm(live)configure#order httpdnfs_before_httpdserver mandatory: httpdnfs httpdserver
具体查看如下图:
12、查看节点情况
crm(live)# status
Last updated: Wed Sep 23 00:08:39 2015
Last change: Wed Sep 23 00:08:33 2015
Stack: classic openais (with plugin)
Current DC: openstack-control.example.com - partition with quorum
Version: 1.1.11-97629de
3 Nodes configured, 3 expected votes
6 Resources configured
Online: [ openstack-control.example.com openstack-neutron.example.com openstack-nova.example.com ]
mysqlnfs (ocf::heartbeat:Filesystem): Started openstack-control.example.com
mysqlvip (ocf::heartbeat:IPaddr): Started openstack-control.example.com
mysqlserver (lsb:mysqld): Started openstack-control.example.com
httpdvip (ocf::heartbeat:IPaddr): Started openstack-control.example.com
httpdnfs (ocf::heartbeat:Filesystem): Started openstack-control.example.com
httpdserver (lsb:httpd): Started openstack-control.example.com
通过如下进行主备切换:
node online openstack-neutron.example.com
node standby openstack-neutron.example.com
本文出自 “秋天的童话” 博客,请务必保留此出处http://wushank.blog.51cto.com/3489095/1697290
相关文章推荐
- TCP/IP 简介(一)
- HDU 4002 Find the maximum (欧拉函数-积性函数的性质(2011年大连赛区网络赛第二题)
- 网络通信协议的一点理解
- RST复位报文段
- 1002 Mission Impossible 6 (2015年北京赛区网络赛B题)
- IOS9 HTTP
- VIEWGOOD(远古)独创技术助力网络电视台建设
- 数据中心:新一代网络的基础依托
- Android开发检测网络是否连接
- 基于okhttp的异步请求
- 一起学CC3200之OTA固件升级(使用HTTP方式下载APP:初级篇)
- 2015北京网络赛 G题 Boxes bfs
- VMware 设置ubuntu12.04 桥接网络
- C++网络编程卷1、卷2概述
- 打造安全的App!iOS安全系列之 HTTPS 进阶
- 反网络爬虫
- [网络原理]如何理解“链路层交换机通常用于接入网中,而路由器通常用于网络核心中”
- HTTP协议 : 协议的完整的通信过程
- HttpSessionListener案例: 自定义HttpSession扫描器
- 2015北京网络赛 J Clarke and puzzle 分块+bitset