corosync 和openais 各自都能实现群集功能,但是功能比较简单,要想实现功能齐全、复杂的群集,需要将两者结合起来.corosync 和openais 各自都能实现群集功能,但是功能比较简单,要想实现功能齐全、复杂的群集,需要将两者结合起来。二者主要提供心跳探测,但是没有资源管理能力。pacemaker 可以提供资源管理能力,是从heartbeat的v3版本中分离出来的一个项目.
高可用群集要求:
硬件一致性
软件(系统)一致性
时间一致性
拓扑结构:
节点一:ip :192.168.10.1/24
节点二:ip :192.168.10.2/24
1、修改主机名
[root@node1 ~]# vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=node1.a.com
2.要求两个节点可以相互解析。
[root@node1 ~]# vim /etc/hosts
192.168.10.1 node1.a.com
192.168.10.2 node2.a.com
[root@node2 ~]# vim /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=node2.a.com
[root@node2 ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-server]
name=Red Hat Enterprise Linux server
baseurl=file:///mnt/cdrom/Server/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[rhel-cluster]
name=Red Hat Enterprise Linux server
baseurl=file:///mnt/cdrom/Cluster/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
# mkdir /mnt/cdrom
# mount /dev/cdrom /mnt/cdrom/
3.配制yum源
[root@node1 ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-server]
name=Red Hat Enterprise Linux server
baseurl=file:///mnt/cdrom/Server/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
[rhel-cluster]
name=Red Hat Enterprise Linux server
baseurl=file:///mnt/cdrom/Cluster/
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
4.使两个节点的时钟相同,在两个节点上执行以下命令
#hwclock -s
利用公钥使两个节点间实现无障碍通信
node1产生自己的密钥对:
[root@node1 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
[root@node1 ~]# cd /root/.ssh
[root@node1 .ssh]# ll
总计 32
-rw------- 1 root root 398 01-22 14:38 authorized_keys
-rw------- 1 root root 1675 01-22 14:26 id_rsa
-rw-r--r-- 1 root root 398 01-22 14:26 id_rsa.pub
-rw-r--r-- 1 root root 406 01-22 13:59 known_hosts
5.Node2产生自己的密钥对:
[root@node2 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
5c:e5:4a:fa:b3:ce:ca:5a:b8:bb:fd:1a:fe:1a:e9:76 root@node2.a.com
6.将两个节点的公钥文件拷贝到对方,此过程需要对方的登录密码
[root@node1 ~]# cd /root/.ssh/
[root@node1 .ssh]# ssh-copy-id -i id_rsa.pub node2
ssh: node2: Temporary failure in name resolution
[root@node1 .ssh]# ssh-copy-id -i id_rsa.pub node2.a.com
root@node2.a.com's password:
[root@node1 .ssh]# scp /etc/hosts node2.a.com:/etc
在node1上执行node2上的命令。 文字较多,添加附件如下:
转载于:https://blog.51cto.com/dg123/1129429