lvs-dr 模式-piranha
系统: redhat 6.5 mini
机器名 |
ip |
vip |
lvs01(主lvs) |
192.168.20.10 |
192.168.20.254 |
lvs02(备lvs) |
192.168.20.20 |
|
rs01 (web) |
192.168.20.100 |
|
rs02 (web) |
192.168.20.200 |
1、 在各个机器上配置ip地址,机器名,关闭selinux,同步时间
[root@lvs01 ~]# hostname
lvs01
[root@lvs01 ~]# getenforce
Disabled
[root@lvs02 ~]# hostname
lvs02
[root@lvs02 ~]# getenforce
Disabled
[root@rs01 ~]# hostname
rs01
[root@rs01 ~]# getenforce
Disabled
[root@rs02 ~]# hostname
rs02
[root@rs02 ~]# getenforce
Disabled
[root@lvs01 yum.repos.d]# cat /etc/hosts
192.168.20.10 lvs01
192.168.20.20 lvs02
192.168.20.100 rs01
192.168.20.200 rs02
[root@lvs01 yum.repos.d]# ntpdate 0.rhel.pool.ntp.org
[root@lvs02 yum.repos.d]# ntpdate 0.rhel.pool.ntp.org
[root@rs01 yum.repos.d]# ntpdate 0.rhel.pool.ntp.org
[root@rs02 yum.repos.d]# ntpdate 0.rhel.pool.ntp.org
2、 在各个机器关闭防火墙,配置yum源
[root@lvs01 yum.repos.d]# service iptables stop
[root@lvs01 yum.repos.d]# chkconfig iptables off
[root@lvs02 ~]# service iptables stop
[root@lvs02 ~]# chkconfig iptables off
[root@rs01 ~]# service iptables stop
[root@rs01 ~]# chkconfig iptables off
[root@rs02 ~]# service iptables stop
[root@rs02 ~]# chkconfig iptables off
[root@lvs01 yum.repos.d]# service iptables stop
[root@lvs01 yum.repos.d]# chkconfig iptables off
[root@lvs01 yum.repos.d]# cat rhel-source.repo
[base]
name=base
baseurl=file:///mnt
enabled=1
gpgcheck=0
[LB]
name=LB
baseurl=file:///mnt/LoadBalancer
enabled=1
gpgcheck=0
[HA]
name=HA
baseurl=file:///mnt/HighAvailability
enabled=1
gpgcheck=0
[RS]
name=RS
baseurl=file:///mnt/ResilientStorage
enabled=1
gpgcheck=0
[root@lvs01 yum.repos.d]# scp rhel-source.repo lvs02:/etc/yum.repos.d/rhel-source.repo
3、 在rs01.rs02上部署web服务,设置arptables,添加vip
[root@rs01 ~]#ip addr add 192.168.20.254/24 dev eth0
[root@rs01 ~]# echo "ip addr add 192.168.20.254/24 dev eth0">>/etc/rc.d/rc.local
[root@rs01 ~]# arptables -A IN -d 192.168.20.254 -j DROP
[root@rs01 ~]# arptables -A OUT -s 192.168.20.254 -j mangle --mangle-ip-s 192.168.20.100
[root@rs01 ~]# service arptables_jf save
将当前规则保存到 /etc/sysconfig/arptables: [确定]
[root@rs01 ~]# chkconfig arptables_jf on
[root@rs01 ~]# yum install -y httpd
[root@rs01 ~]# echo "rs01">/var/www/html/index.html
[root@rs01 ~]# service httpd restart
[root@rs01 ~]# chkconfig httpd on
[root@rs02 ~]# arptables -A IN -d 192.168.20.254 -j DROP
[root@rs02 ~]# arptables -A OUT -s 192.168.20.254 -j mangle --mangle-ip-s 192.168.20.100
[root@rs02 ~]# service arptables_jf save
将当前规则保存到 /etc/sysconfig/arptables: [确定]
[root@rs02 ~]# chkconfig arptables_jf on
[root@rs02 ~]#ip addr add 192.168.20.254/24 dev eth0
[root@rs02 ~]# echo "ip addr add 192.168.20.254/24 dev eth0">>/etc/rc.d/rc.local
[root@rs02 ~]# yum install -y httpd
[root@rs02 ~]# echo "rs02">/var/www/html/index.html
[root@rs02 ~]# service httpd restart
[root@rs02 ~]# chkconfig httpd on
4、 在lvs01,lvs02安装LB,在lvs01上配置lvs集群登录用户和密码
[root@lvs01 yum.repos.d]# yum groupinstall "Load Balancer"
[root@lvs02 yum.repos.d]# yum groupinstall "Load Balancer"
[root@lvs01 yum.repos.d]# piranha-passwd
New Password:
Verify:
Adding password for user piranha
[root@lvs01 yum.repos.d]# /etc/init.d/piranha-gui start
[root@lvs01 yum.repos.d]# chkconfig piranha-gui on
5、通过浏览器配置lvs集群
5.1 在浏览器输入http://192.168.20.10:3636 输入用户名和密码
5.2 配置lvs01,ip地址,选direct
5.3 配置lvs02
5.4 配置对外服务和真实服务器
5.5 将在lvs01 上的配置文件复制到lvs02 上,在lvs01,lvs02 上启动负载均衡的监控进程
[root@lvs01 ~]# scp /etc/sysconfig/ha/lvs.cf lvs02:/etc/sysconfig/ha/lvs.cf
root@lvs02's password:
lvs.cf 100% 865 0.8KB/s 00:00
[root@lvs01 ~]# /etc/init.d/pulse restart
Shutting down pulse: [失败]
Starting pulse: [确定]
[root@lvs01 ~]# chkconfig pulse on
[root@lvs02 ~]# /etc/init.d/pulse restart
Shutting down pulse: [失败]
Starting pulse: [确定]
[root@lvs02 ~]# chkconfig pulse on
5.6 lvs 正常运行的状态
1、 测试
3.1 正常访问
3.2 lvs01 宕机了,可以正常访问
3.3 rs01 宕机了,也可正常访问
lvs-dr 模式-piranha的更多相关文章
- LVS DR模式 负载均衡服务搭建
LVS 负载均衡 最近在研究服务器负载均衡,阅读了网上的一些资料,发现主要的软件负载均衡方案有nginx(针对HTTP服务的负载均衡),LVS(针对IP层,MAC层的负载均衡).LVS模式工作在网络层 ...
- 一个公网地址部署LVS/DR模式
http://blog.chinaunix.net/uid-7411781-id-3436142.html 一个公网地址部署LVS/DR模式 网上看了很多关于LVS的文章,在选取2种模式LVS/D ...
- LVS DR模式搭建、keepalived+lvs
1.LVS DR模式搭建 条件: 即三台机器,在同一内网. 编辑脚本文件:/usr/local/sbin/lvs_dr.sh #! /bin/bashecho 1 > /proc/sys/net ...
- LVS DR模式搭建 keepalived lvs
LVS DR模式搭建• 三台机器 • 分发器,也叫调度器(简写为dir)172.16.161.130 • rs1 172.16.161.131 • rs2 172.16.161.132 • vip 1 ...
- lvs之 lvs+nginx+tomcat_1、tomcat_2+redis(lvs dr 模式)
前提:已经安装好 lvs+nginx+tomcat_1.tomcat_2+redis环境 ,可参考 (略有改动,比如tomcat_1.tomcat_2安装在两台机器上,而不是单机多实例 ,自行稍稍变动 ...
- CentOS下LVS DR模式负载均衡配置详解
一安装LVS准备: 1.准备4台Centos 6.2 x86_64 注:本实验关闭 SELinux和IPtables防火墙. 管理IP地址 角色 备注 192.168.1.101 LVS主调度器(Ma ...
- Keepalived+LVS DR模式高可用架构实践
Keepalived最初是为LVS设计,专门监控各服务器节点的状态(LVS不带健康检查功能,所以使用keepalived进行健康检查),后来加入了VRRP(虚拟路由热备协议(Virtual Route ...
- Linux centosVMware Linux集群架构LVS DR模式搭建、keepalived + LVS
一.LVS DR模式搭建 三台机器 分发器,也叫调度器(简写为dir) davery :1.101 rs1 davery01:1.106 rs2 davery02:11.107 vip 133.200 ...
- LVS DR模式实验
LVS DR模式实验 三台虚拟机,两个台节点机(Apache),一台DR实验调度机 一:关闭相关安全机制 systemctl stop firewalld iptables -F setenforce ...
- lvs dr 模式请求过程
一. lvs dr 模式请求过程 1.整个请求过程如下: client在发起请求之前,会发一个arp广播的包,在网络中找"谁是vip",由于所有的服务器,lvs和rs都有vip,为 ...
随机推荐
- DaemonSet 案例分析 - 每天5分钟玩转 Docker 容器技术(130)
本节详细分析两个 k8s 自己的 DaemonSet:kube-flannel-ds 和 kube-proxy . kube-flannel-ds 下面我们通过分析 kube-flannel-ds 来 ...
- 撸一撸Spring Cloud Ribbon的原理
说起负载均衡一般都会想到服务端的负载均衡,常用产品包括LBS硬件或云服务.Nginx等,都是耳熟能详的产品. 而Spring Cloud提供了让服务调用端具备负载均衡能力的Ribbon,通过和Eure ...
- php header解决跨域问题
header('Access-Control-Allow-Credentials:true'); header('Access-Control-Allow-Origin:http://wdjkj.co ...
- 详解CSS display:inline-block的应用
阅读目录 基础知识 inline-block的问题 inline-block的应用 总结 本文详细描述了display:inline-block的基础知识,产生的问题和解决方法以及其常见的应用场景,加 ...
- docker dead but pid file exists
CentOS 6安装docker 报docker dead but pid file exists 执行 yum install epel-release yum install docker-io ...
- nf共享
实验环境是两台Centos6.8 客户端是192.168.3.218 服务端是192.168.3.219 首先配置服务端 1 安装包 用yum安装需要的服务包(两边都安装) yum install n ...
- Js比较对Object类型进行排序
<script> var data=[{name:"121",age:"18",year:"2018"},{name:" ...
- java线程优先级
java的线程优先级分为1-10 这10个等级 1为最强,最优先 10为最弱 如果大于10或者小于1则会抛异常 源代码为: public final void setPriority(int newP ...
- Linux 格式化和挂载数据盘
如果您已经为 ECS 实例配了数据盘,您需要先格式化数据盘并挂载文件系统后才能正常使用数据盘. 注意: 磁盘分区和格式化是高风险行为,请慎重操作.本文档描述如何处理一个新买的数据盘,如果您的数据盘上有 ...
- 深入理解Python的字符编码
原文:http://lukejin.iteye.com/blog/598303 在处理中文的时候,我们有时候会碰到中文乱码的问题. 究其根本原因是正确的字节序列按照错误的编码方式解码成字符 或者正确的 ...