keepalive+双机热备+nginx

Posted Simon1020

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了keepalive+双机热备+nginx相关的知识,希望对你有一定的参考价值。

最近搭建keepalived双机热备, 在网上博采众之所长, 整理一下自己的笔记!

在新搭建的centos6.x下最好下载一下阿里云源:

  centos:http://mirrors.aliyun.com/help/centos

1、备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

3、之后运行yum makecache生成缓存

 

========================================================================================================

  准备2台电脑来做这个实验:


  192.168.232.137        web服务器  keepalived nginx
  192.168.232.138        web服务器  keepalived nginx\

  虚拟IP (VIP):192.168.232.17

  虚拟IP (VIP):192.168.232.18

137上面:

  vim /etc/sysconfig/network-scripts/ifcfg-eth0

 



以上是关于keepalive+双机热备+nginx的主要内容,如果未能解决你的问题,请参考以下文章

keepalive && Nginx 高可用配置

Nginx+keepalived双主配置(双机双主热备)

nginx + keepalive

Nginx 配置高可用的集群

Linux集群之keepalive+Nginx

keepalived+nginx 双机热备搭建