Heartbeat+MySQL+NFS 实现高可用(HA)的MySQL集群

大纲
一、环境准备
二、拓扑准备
三、安装与配置heartbrat
四、配置NFS服务
五、安装与配置MySQL
六、crm配置资源


一、环境准备
1.操作系统
CentOS 5.5 X86_64 位系统

2.软件环境
heartbeat-2.1.4-11.el5

heartbeat-gui-2.1.4-11.el5

mysql-5.5.33(注:这里用的mysql版本是通用二进制包,直接解压就能用的,若有博友对mysql安装有问题,请参考:  )

3.高可用集群使用条件
(1).节点名称必须跟 uname -n 命令的执行结果一致
node1:
[root@node1 src]# uname -n 
node1.test.com
[root@node1 src]# vim /etc/hosts
# Do not remove the following line, or various programs 
# that require network functionality will fail. 
127.0.0.1              localhost.localdomain localhost 
::1            localhost6.localdomain6 localhost6 
192.168.18.201  node1.test.com  node1 
192.168.18.202  node2.test.com  node2

node2:
[root@node2 ~]# uname -n 
node2.test.com 
[root@node2 ~]# vim /etc/hosts
# Do not remove the following line, or various programs 
# that require network functionality will fail. 
127.0.0.1              localhost.localdomain localhost 
::1            localhost6.localdomain6 localhost6 
192.168.18.201  node1.test.com  node1 
192.168.18.202  node2.test.com  node2

(2).各节点之间ssh互信
node1: 
ssh-keygen  -t rsa -f ~/.ssh/id_rsa  -P '' 
ssh-copy-id -i .ssh/id_rsa.pub root@node2.test.com
node2:
ssh-keygen  -t rsa -f ~/.ssh/id_rsa  -P '' 
ssh-copy-id -i .ssh/id_rsa.pub root@node2.test.com

(3).各节点之间时间同步
node1:
[root@node1 ~]# ntpdate 202.120.2.101
node2:
[root@node2 ~]# ntpdate 202.120.2.101

4.增加EPEL yum源
node1,node2:
[root@node src]# wget Fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
[root@node src]# rpm -ivh epel-release-5-4.noarch.rpm
warning: epel-release-5-4.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
1:epel-release          ########################################### [100%]
[root@node src]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[root@node src]# yum list

5.关闭防火墙与SELinux
node1,node2:
[root@node ~]# service iptables stop
[root@node ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#      enforcing - SELinux security policy is enforced.
#      permissive - SELinux prints warnings instead of enforcing.
#      disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#      targeted - Only targeted network daemons are protected.
#      strict - Full SELinux protection.
SELINUXTYPE=targeted

二、拓扑准备

Heartbeat+MySQL+NFS 实现高可用(HA)的MySQL集群

说明:拓扑与前面几篇(见下面链接)一致,这里就不详细说明了。

Linux 高可用(HA)集群基本概念详解

Linux 高可用(HA)集群之Heartbeat详解

接下来请看第2页精彩内容

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/8fb991ef59c13e32f6c8de6aecf9d5e9.html