MySQL Cluster三机集群+HA高可用+负载均衡配置手册(6)

启用内核的包转发功能
修改/etc/sysctl.conf
#net.ipv4.ip_forward = 0
net.ipv4.ip_forward = 1
[root@db1 etc]# sysctl -p //使其马上生效
net.ipv4.ip_forward = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296

安装heartbeat和lidirectord软件
[root@db1 heartbeat2_x86_64]# ls -l
-rw-r--r-- 1 root root 1691714 11-10 11:31 heartbeat-2.1.4-11.el5.x86_64.rpm
-rw-r--r-- 1 root root  111941 11-10 12:08 heartbeat-ldirectord-2.1.4-11.el5.x86_64.rpm
-rw-r--r-- 1 root root  93297 11-10 11:57 heartbeat-pils-2.1.4-11.el5.x86_64.rpm
-rw-r--r-- 1 root root  190686 11-10 11:56 heartbeat-stonith-2.1.4-11.el5.x86_64.rpm
-rw-r--r-- 1 root root  33839 11-10 12:10 ipvsadm-1.24-12.el5.x86_64.rpm
-rw-r--r-- 1 root root  62324 11-10 11:44 libnet-1.1.6-2.el5.pp.x86_64.rpm
-rw-r--r-- 1 root root  38792 2011-09-10 libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm
-rw-r--r-- 1 root root  171524 2011-09-10 openhpi-libs-2.14.0-5.el5.x86_64.rpm
-rw-r--r-- 1 root root  224092 11-10 12:18 perl-DBD-mysql-4.005-1.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root  860170 11-10 12:19 perl-DBI-1.58-2.el5.rf.x86_64.rpm
-rw-r--r-- 1 root root  93196 2011-09-10 perl-MailTools-1.77-1.el5.CentOS.noarch.rpm
-rw-r--r-- 1 root root  45282 11-10 12:26 perl-Net-Daemon-0.39-1.el5.rf.noarch.rpm
-rw-r--r-- 1 root root  33187 11-10 12:25 perl-PlRPC-0.2018-1.2.el5.rf.noarch.rpm
-rw-r--r-- 1 root root  32736 2007-07-02 perl-TimeDate-1.16-5.el5.noarch.rpm

[root@db1 heartbeat2_x86_64]# rpm -ivh *.rpm
[root@db2 heartbeat2_x86_64]# ls
heartbeat-2.1.4-11.el5.x86_64.rpm            ipvsadm-1.24-12.el5.x86_64.rpm          perl-DBD-mysql-4.005-1.el5.rf.x86_64.rpm    perl-PlRPC-0.2018-1.2.el5.rf.noarch.rpm
heartbeat-ldirectord-2.1.4-11.el5.x86_64.rpm  libnet-1.1.6-2.el5.pp.x86_64.rpm        perl-DBI-1.58-2.el5.rf.x86_64.rpm            perl-TimeDate-1.16-5.el5.noarch.rpm
heartbeat-pils-2.1.4-11.el5.x86_64.rpm        libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm  perl-MailTools-1.77-1.el5.centos.noarch.rpm
heartbeat-stonith-2.1.4-11.el5.x86_64.rpm    openhpi-libs-2.14.0-5.el5.x86_64.rpm    perl-Net-Daemon-0.39-1.el5.rf.noarch.rpm
[root@db2 heartbeat2_x86_64]# rpm -ivh *.rpm

配置heartbeat
[root@db2 etc]# vi /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
172.16.1.75    db2.test.com      db2
172.16.1.74    db1.test.com      db1
172.16.1.78    demo.test.com    demo
172.16.1.73    db.test.com      db        #后面要专门设置这样一个虚拟IP地址

[root@db1 ~]# vi /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
172.16.1.74    db1.test.com      db1
172.16.1.75    db2.test.com      db2
172.16.1.78    demo.test.com    demo
172.16.1.73    db.test.com      db        #后面要专门设置这样一个虚拟IP地址

复制一些文件
[root@db2 doc]# cd /usr/share/doc/heartbeat-2.1.4/
[root@db2 heartbeat-3.0.3]# ls
apphbd.cf  authkeys  AUTHORS  ChangeLog  COPYING  COPYING.LGPL  ha.cf  haresources  README
[root@db2 heartbeat-3.0.3]# cp ha.cf /etc/ha.d/
[root@db2 heartbeat-3.0.3]# cp haresources /etc/ha.d/
[root@db2 heartbeat-3.0.3]# cp authkeys /etc/ha.d/

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

转载注明出处:https://www.heiqu.com/e6d08f24de9c8aafe351cad59d812345.html