分类: LINUX
2012-05-08 19:48:33
尝试
方针:深入
相识
HA集群原理和RHCS套件中妨碍
域的观念
。
尝试
环境
:
尝试
预备:创建
好yum,由于
安装软件包时凭借的包比拟
多。
尝试
步调
:
一、尝试
环境
的预备
二、RHCS套件的安装
三、RHCS套件的设置
四、大略
的测试
尝试
环境
图例:
一、尝试 环境 的预备
IP所在 主机名 脚色
192.168.0.201 node1.deying.com Web Server
192.168.0.202 node2.deying.com MySQL Server
192.168.0.203 node3.deying.com Web Server 和MySQl Server HA
尝试
阐发
:判别
用两台打定机做Web Server和 MySQL Server ,用一台电脑做它们的HA,假如
有一台做事器DOWN了,就把该做事器运行的做事切换到做HA的备用机上,也就是设置两个妨碍
域。
(一)同上表格设置好干系
选项,并安装做事软件包
(二)应用
hosts文件实现主机名的理会
[root@node1 ~]# 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.0.201 node1.deying.com node1
192.168.0.202 node2.deying.com node2
192.168.0.203 node3.deying.com node3
[root@node1 ~]# scp /etc/hosts 192.168.0.202:/etc/hosts
[root@node1 ~]# scp /etc/hosts 192.168.0.203:/etc/hosts
二、RHCS套件的安装
1.在集群的三个成员中都安装一下软件包
[root@node1 ~]# yum install cman
[root@node1 ~]# rpm-ivhsystem-config-cluster-1.0.55-1.0.noarch.rpm
[root@node1 ~]# yum install oddjob
[root@node1 ~]# rpm -ivh modcluster-0.12.1-2.el5.i386.rpm
[root@node1 ~]# rpm -ivh Cluster_Administration-zh-CN-5.2-1.noarch.rpm
[root@node1 ~]# rpm -ivh lm_sensors-2.10.7-4.el5.i386.rpm
[root@node1 ~]# rpm -ivh net-snmp-5.3.2.2-5.el5.i386.rpm
[root@node1 ~]# rpm -ivh cluster-snmp-0.12.1-2.el5.i386.rpm
[root@node1 ~]# rpm -ivh tog-pegasus-2.7.1-2.el5.i386.rpm
[root@node1 ~]# rpm -ivh cluster-cim-0.12.1-2.el5.i386.rpm
2.在node2和node3上安装MySQL,node1上安装apache。
[root@node1 ~]# rpm -ivh httpd-2.2.3-22.el5.i386.rpm
[root@node1 ~]# echo "deying.com" > /var/www/html/index.html
[root@node1 ~]# /etc/init.d/httpd start
[root@node2 ~]# rpm -ivh perl-DBI-1.52-2.el5.i386.rpm
[root@node2 ~]# rpm -ivh mysql-5.0.45-7.el5.i386.rpm
[root@node2 ~]# rpm -ivh perl-DBD-MySQL-3.0007-2.el5.i386.rpm
[root@node2 ~]# rpm -ivh mysql-server-5.0.45-7.el5.i386.rpm
[root@node2 ~]# /etc/init.d/mysqld start
[root@node3 ~]# mysqladmin -u root password deying
[root@node3 ~]# rpm -ivh perl-DBI-1.52-2.el5.i386.rpm
[root@node3 ~]# rpm -ivh mysql-5.0.45-7.el5.i386.rpm
[root@node3 ~]# rpm -ivh perl-DBD-MySQL-3.0007-2.el5.i386.rpm
[root@node3 ~]# rpm -ivh mysql-server-5.0.45-7.el5.i386.rpm
[root@node3 ~]# /etc/init.d/mysqld start
[root@node3 ~]# mysqladmin -u root password deying
[root@node3 ~]# /etc/init.d/mysqld stop
[root@node3 ~]# rpm -ivh httpd-2.2.3-22.el5.i386.rpm
[root@node3 ~]# echo "deying.com" > /var/www/html/index.html
三、具体 的设置
[root@node1 ~]# system-config-cluster
1.在弹出的窗口中点击Create New Configuration
Choose a name for the cluster: deying
Address:(225.0.0.1-234.255.255.255)恣意
一个多
播所在
2.Cluster Nodes (节点的设置)
点击 Cluster Nodes 点击Add a Cluster Node
Cluster Node Name:node1.deying.com
Quorum Votes:1
Multicast interface:eth0
Cluster Node Name:node2.deying.com
Quorum Votes:1
Multicast interface:eth0
Cluster Node Name:node3.deying.com
Quorum Votes:11
Multicast interface:eth0
3.Failover Domanins (妨碍
域的设置)
点击Failover Domains ,点击 Create a Failover Domain创建
两个妨碍
域,
Name for new Failover Domain:apache
Name for new Failover Domain:mysql
4.Resources (资源的设置)
点击Resources ,点击Create a Resource 创建
四个资源,判别
是IP Address 和两个做事管理
脚本Script
IP Address :192.168.0.128
IP Address :192.168.0.129
Script :Name :apache file (with path):/etc/init.d/httpd
Script :Name :mysql file (with path):/etc/init.d/mysqld
5.Services (做事的设置)
点击Service 点击Create a Service
Add a Service Name:apache 如下图
点击Create a Service
Add a Service Name:mysql 如下图
点击主菜单 File -->Save-->OK--->OK 设置完成封闭
窗口
[root@node1 ~]# scp /etc/cluster/cluster.conf 192.168.0.202:/etc/cluster/
[root@node1 ~]# scp /etc/cluster/cluster.conf 192.168.0.203:/etc/cluster/
必需
按下面的序次
启动做事
[root@node1 ~]# /etc/init.d/cman start
[root@node2 ~]# /etc/init.d/cman start
[root@node3 ~]# /etc/init.d/cman start
[root@node1 ~]# /etc/init.d/rgmanager start
[root@node2 ~]# /etc/init.d/rgmanager start
[root@node3 ~]# /etc/init.d/rgmanager start