前言:
openstack中,controller节点的单点故障一直是影响整个云计算平台稳定性的重大问题,因此对controller节点的各个组件实现HA显得至关重要,由于controller节点上部署的服务组件众多,MySQL,rabbitmq,keystone,glance,nova等等,每种组件对于HA的实现都有着不同点和共同点,因此必须分开讨论,本文即时在参照之前国内一篇网文的基础之上,对其进行更新与修正,构建里一个基本的Mysql ha环境,广大爱好者可以借鉴本文的思路,最终将mysql的HA应用在两台controller节点上。
系统环境:
Ubuntu 12.04.2 LTS
节点1: 192.168.1.143(eth0) ha1
节点2: 192.168.1.144(eth0) ha2
Mysql virtual ip:192.168.1.10(这个稍后会用到)
以两天集群的集群环境为例,开始我们的Mysql HA部署
(1)所有节点,编辑/etc/hosts文件
vim /etc/hosts
添加以下内容
192.168.1.143 ha1
192.168.1.144 ha2
(2)安装pacemaker和corosync
apt-get install pacemaker corosync
要对corosync进行设置,将如下内容复制粘贴到所有节点的/etc/corosync/corosync.conf内:
# Please read the openais.conf.5 manual page
totem {
version: 2
# How long before declaring a token lost (ms)
token: 3000
# How many token retransmits before forming a new configuration
token_retransmits_before_loss_const: 10
# How long to wait for join messages in the membership protocol (ms)
join: 60
# How long to wait for consensus to be achieved before starting a new round of membership configuration (ms)
consensus: 3600
# Turn off the virtual synchrony filter
vsftype: none
# Number of messages that may be sent by one processor on receipt of the token
max_messages: 20
# Limit generated nodeids to 31-bits (positive signed integers)
clear_node_high_bit: yes
# Disable encryption
secauth: off
# How many threads to use for encryption/decryption
threads: 0
# Optionally assign a fixed node id (integer)
# nodeid: 1234
# This specifies the mode of redundant ring, which may be none, active, or passive.
rrp_mode: none
interface {
# The following values need to be set based on your environment
ringnumber: 0
bindnetaddr: 192.168.1.0
mcastaddr: 226.94.1.1
mcastport: 5405
}
}
amf {
mode: disabled
}
service {
# Load the Pacemaker Cluster Resource Manager
ver: 1
name: pacemaker
}
quorum {
provider:corosync_votequorum
expected_votes:2
}
aisexec {
user: root
group: root
}
logging {
fileline: off
to_stderr: yes
to_logfile: no
to_syslog: yes
syslog_facility: daemon
debug: off
timestamp: on
logger_subsys {
subsys: AMF
debug: off
tags: enter|leave|trace1|trace2|trace3|trace4|trace6
}
}
相关阅读:
Ubuntu 12.04 OpenStack Swift单节点部署手册
MySQL服务器的HA集群之Corosync+DRBD+Pacemaker实现
MySQL服务器的HA集群之Corosync+DRBD+Pacemaker实现-上篇
MySQL服务器的HA集群之Corosync+DRBD+Pacemaker实现-下篇