一、基于corosync实现web高可用基础配置
1.配置主机名
节点名称很关键,集群每个节的名称都得能互相解析。/etc/hosts中的主机名配置结果必须跟”uname -n”的解析的结果一致。
node1/node2都添加:
01.node1示例:
02.# vim /etc/hosts
03.172.18.109.233node1.test.com node1
04.172.18.109.235 node1.test.com node2
05.# ifconfig eth0 172.18.109.233 up
06.# hostname node1.test.com
07.# uname -n
08.# vim /etc/sysconfig/network //重启才生效,source也不生效
09.hostname=node1.test.com
2.时间同步
node1,node2都配置
1.# crontab -e
2.*/5 * * * * /usr/sbin/ntpdate 172.16.0.1 &> /dev/null
3.配置node之间SSH互信
1.node1:
2.#ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ''
3.# ssh-copy-id -i .ssh/id_rsa.pub root@node1.test.com
4.node2:
5.#ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ''
6.# ssh-copy-id -i .ssh/id_rsa.pub root@node1.test.com
7.node1:测试
8.# ssh node1.test.com ‘date’;date
4、关闭两台服务器的SELinux、Iptables与NetworkManager
setenforce 0 #关闭SELinux
service iptables stop #关闭Iptables
chkconfig iptables off #禁止Iptables开机启动
service NetworkManager stop
chkconfig NetworkManager off
chkconfig --list NetworkManager
NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
chkconfig network on
chkconfig --list network
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
注意:做的过程中必须关闭NetworkManager服务关闭并设置开机不能自动启动;将network服务设置开机自启动;否则作实验过程中会带来不必要的麻烦,造成集群系统不能正常运行。
5、配置yum源
配置epel YUM源:(该源包含heartbeat corosync pacemaker)
rpm -ivh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 #导入公钥文件
配置elrepo 源:(该源包含drbd)
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
yum relpolist #列出可用仓库
仓库标识 仓库名称 状态
base CentOS-6 - Base 6,696
(责任编辑:liangzh) |