当前位置:首页 > 电脑常识 > 正文

Linux 之HA集群配置 8090安适门户

11-20 电脑常识

HA(高可用 High avaiilable)集群
Web1 供给处事,如果1主宕机了,2备就可以顿时启用,这样有用户这端没有任何影响。
在架构的时候要配置一条心跳线来通报信息。流动IP 也是就是VIP,是主从对外配合的IP。

[root@LNMP ~]# iptables -F
[root@LNMP ~]# getenforce
Disabled
[root@LNMP ~]# vim /etc/hosts #在主上编译上
10.72.4.21 LNMP
10.72.4.14 OBird
[root@OBird ~]# vim /etc/hosts #复制到从上
10.72.4.21 LNMP
10.72.4.14 OBird
#
[root@LNMP ~]# wget 
#下载epel
[root@LNMP ~]# rpm -ivh epel-release-6-8_64.noarch.rpm  #安置(主从都安置)
[root@LNMP ~]# yum list |grep heartbeat
heartbeat.x86_64                            3.0.4-2.el6                  epel
heartbeat-devel.i686                        3.0.4-2.el6                  epel
heartbeat-devel.x86_64                      3.0.4-2.el6                  epel
heartbeat-libs.i686                         3.0.4-2.el6                  epel
heartbeat-libs.x86_64                       3.0.4-2.el6                  epel
主从各自安置 heaerbeat & libnet
[root@LNMP ~]# yum install -y heartbeat
[root@LNMP ~]# yum install libnet
[root@OBird ~]# yun install -y heartbeat
[root@OBird ~]# yum install libnet
[root@LNMP ~]# cd /usr/share/doc/heartbeat-3.0.4/ #进到目录下拷贝样例
[root@LNMP heartbeat-3.0.4]# ls
apphbd.cf  authkeys  AUTHORS  ChangeLog  COPYING  COPYING.LGPL  ha.cf  haresources  README
[root@LNMP heartbeat-3.0.4]# cp authkeys ha.cf haresources /etc/ha.d/
[root@LNMP heartbeat-3.0.4]#

[root@LNMP heartbeat-3.0.4]# cd /etc/ha.d/
[root@LNMP ha.d]# ls
authkeys  ha.cf  harc  haresources  rc.d  README.config  resource.d  shellfuncs
[root@LNMP ha.d]# vim authkeys  #编译验证配置文件
#auth 1  #打开变动为 auth 1
#1 crc
#2 sha1 HI!
#3 md5 Hello! #打开md5验证:3 md5 Hello!
[root@LNMP ha.d]# chmod 600 authkeys #编译目录权限,不然heartbeat 处事不能启动
[root@LNMP ha.d]# cd /etc/sysconfig/network-scripts/ #配置虚拟网卡&IP
[root@LNMP network-scripts]# ls
ifcfg-eth0   ifdown-eth   ifdown-post    ifdown-tunnel  ifup-eth   ifup-plip   ifup-routes    init.ipv6-global
ifcfg-lo     ifdown-ippp  ifdown-ppp     ifup           ifup-ippp  ifup-plusb  ifup-sit       net.hotplug
ifdown       ifdown-ipv6  ifdown-routes  ifup-aliases   ifup-ipv6  ifup-post   ifup-tunnel    network-functions
ifdown-bnep  ifdown-isdn  ifdown-sit     ifup-bnep      ifup-isdn  ifup-ppp    ifup-wireless  network-functions-ipv6
[root@LNMP network-scripts]# cp ifcfg-eth0 ifcfg-eth0\:1 #配置虚拟网卡&IP
[root@LNMP network-scripts]# vim ifcfg-eht0\:1
DEVICE=eth0:1
#HWADDR=00:0C:29:5A:02:3F
TYPE=Ethernet
#UUID=22567e42-4d72-40e9-8ca3-98098c239d9c
ONBOOT=no #开机不不启动,楼主是桥接模式,所以是静态且不启动
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=10.72.4.110
NETMASK=255.255.254.0
#GATEWAY=10.72.4.1

温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/file/pc/12582.html

博客主人杰米WWW
杰米博客,为大家提供seo以及it方面技巧喜欢的朋友收藏哦!
  • 11365文章总数
  • 1378073访问次数
  • 建站天数
  •