接上一篇博客:

http://www.cnblogs.com/xiaoit/p/4499703.html

1:按照上篇博客安装后的配置文件在

  1. /usr/local/etc/keepalived/keepalived.conf

默认内容如下:

  1. ! Configuration File for keepalived
  2.  
  3. #全局定义块,以下模版不能省略
  4. global_defs {
  5. #如有故障,发邮件的地址。
  6. notification_email {
  7. acassen@firewall.loc
  8. failover@firewall.loc
  9. sysadmin@firewall.loc
  10. }
  11. notification_email_from Alexandre.Cassen@firewall.loc
  12. smtp_server 192.168.200.1
  13.  
  14. #邮件服务链接超时的最长时间
  15. smtp_connect_timeout 30
  16. router_id LVS_DEVEL
  17. }
  18.  
  19. #前面定义的后备的负载均衡服务器名称
  20. vrrp_instance VI_1 {
  21. #只有MASTER和BACKUP 两种状态,都必须大写。
  22. state MASTER
  23. #进行通信的端口
  24. interface eth0
  25.  
  26. #同一个vrrp实例的唯一标识。即同一个vrrp_stance,MASTER和BACKUP的virtual_router_id是一致的。在整个vrrp内也唯一。
  27. virtual_router_id 51
  28.  
  29. #权重,数值越大,权重越大。MASTER大于SLAVE
  30. priority 100
  31.  
  32. #MASTER和SLAVE负载均衡器之间同步检查的时间间隔。单位是:秒
  33. advert_int 1
  34.  
  35. #MASTER和SLAVE的认证方式
  36. authentication {
  37. auth_type PASS
  38. auth_pass 1111
  39. }
  40. virtual_ipaddress {
  41. 192.168.200.16
  42. 192.168.200.17
  43. 192.168.200.18
  44. }
  45. }
  46.  
  47. #virtual_ipaddress,需要添加端口
  48. virtual_server 192.168.200.100 443 {
  49. #服务健康检查周期,6秒
  50. delay_loop 6
  51.  
  52. #负载均衡调度算法rr|wrr|lc|wlc|sh|dh|lblc
  53. lb_algo rr
  54.  
  55. #负载均衡转发规则NAT|DR|TUN
  56. lb_kind NAT
  57. nat_mask 255.255.255.0
  58.  
  59. #回话保持时间,如果是动态服务,建议开启。默认50秒
  60. persistence_timeout 50
  61. protocol TCP
  62.  
  63. #真是IP
  64. real_server 192.168.201.100 443 {
  65.  
  66. #权重,数值越大,权重越高。分发的可能越大
  67. weight 1
  68. SSL_GET {
  69. url {
  70. path /
  71. digest ff20ad2481f97b1754ef3e12ecd3a9cc
  72. }
  73. url {
  74. path /mrtg/
  75. digest 9b3a0c85a887a256d6939da88aabd8cd
  76. }
  77. connect_timeout 3
  78. nb_get_retry 3
  79. delay_before_retry 3
  80. }
  81. }
  82. }
  83.  
  84. virtual_server 10.10.10.2 1358 {
  85. delay_loop 6
  86. lb_algo rr
  87. lb_kind NAT
  88. persistence_timeout 50
  89. protocol TCP
  90.  
  91. sorry_server 192.168.200.200 1358
  92.  
  93. real_server 192.168.200.2 1358 {
  94. weight 1
  95. HTTP_GET {
  96. url {
  97. path /testurl/test.jsp
  98. digest 640205b7b0fc66c1ea91c463fac6334d
  99. }
  100. url {
  101. path /testurl2/test.jsp
  102. digest 640205b7b0fc66c1ea91c463fac6334d
  103. }
  104. url {
  105. path /testurl3/test.jsp
  106. digest 640205b7b0fc66c1ea91c463fac6334d
  107. }
  108. connect_timeout 3
  109. nb_get_retry 3
  110. delay_before_retry 3
  111. }
  112. }
  113.  
  114. real_server 192.168.200.3 1358 {
  115. weight 1
  116. HTTP_GET {
  117. url {
  118. path /testurl/test.jsp
  119. digest 640205b7b0fc66c1ea91c463fac6334c
  120. }
  121. url {
  122. path /testurl2/test.jsp
  123. digest 640205b7b0fc66c1ea91c463fac6334c
  124. }
  125. connect_timeout 3
  126. nb_get_retry 3
  127. delay_before_retry 3
  128. }
  129. }
  130. }
  131.  
  132. virtual_server 10.10.10.3 1358 {
  133. delay_loop 3
  134. lb_algo rr
  135. lb_kind NAT
  136. nat_mask 255.255.255.0
  137. persistence_timeout 50
  138. protocol TCP
  139.  
  140. real_server 192.168.200.4 1358 {
  141. weight 1
  142. HTTP_GET {
  143. url {
  144. path /testurl/test.jsp
  145. digest 640205b7b0fc66c1ea91c463fac6334d
  146. }
  147. url {
  148. path /testurl2/test.jsp
  149. digest 640205b7b0fc66c1ea91c463fac6334d
  150. }
  151. url {
  152. path /testurl3/test.jsp
  153. digest 640205b7b0fc66c1ea91c463fac6334d
  154. }
  155. connect_timeout 3
  156. nb_get_retry 3
  157. delay_before_retry 3
  158. }
  159. }
  160.  
  161. real_server 192.168.200.5 1358 {
  162. weight 1
  163. HTTP_GET {
  164. url {
  165. path /testurl/test.jsp
  166. digest 640205b7b0fc66c1ea91c463fac6334d
  167. }
  168. url {
  169. path /testurl2/test.jsp
  170. digest 640205b7b0fc66c1ea91c463fac6334d
  171. }
  172. url {
  173. path /testurl3/test.jsp
  174. digest 640205b7b0fc66c1ea91c463fac6334d
  175. }
  176. connect_timeout 3
  177. nb_get_retry 3
  178. delay_before_retry 3
  179. }
  180. }
  181. }

参考:

http://www.keepalived.org/documentation.html

Keepalived系列一:Keepalived.conf 详解的更多相关文章

  1. Redis:默认配置文件redis.conf详解

    转: Redis:默认配置文件redis.conf详解 # Redis配置文件样例 # Note on units: when memory size is needed, it is possibl ...

  2. Redis配置文件redis.conf详解

    一.Redis配置文件redis.conf详解 # Note on units: when memory size is needed, it is possible to specifiy # it ...

  3. linux离线部署redis及redis.conf详解

    一.离线部署redis 由于博主部署的虚拟机没有网络也没有gcc编译器,所以就寻找具备gcc编译器的编译环境把redis编译安装好,Copy Redis安装目录文件夹到目标虚拟机的目录下.copy时r ...

  4. ASP.NET MVC深入浅出系列(持续更新) ORM系列之Entity FrameWork详解(持续更新) 第十六节:语法总结(3)(C#6.0和C#7.0新语法) 第三节:深度剖析各类数据结构(Array、List、Queue、Stack)及线程安全问题和yeild关键字 各种通讯连接方式 设计模式篇 第十二节: 总结Quartz.Net几种部署模式(IIS、Exe、服务部署【借

    ASP.NET MVC深入浅出系列(持续更新)   一. ASP.NET体系 从事.Net开发以来,最先接触的Web开发框架是Asp.Net WebForm,该框架高度封装,为了隐藏Http的无状态模 ...

  5. yum的配置文件yum.conf详解

    说明:经过网上抄袭和自己的总结加实验,非常详细,可留作参考. yum的配置一般有两种方式:   一种是直接配置/etc目录下的yum.conf文件, 另外一种是在/etc/yum.repos.d目录下 ...

  6. Hexo系列(三) 常用命令详解

    Hexo 框架可以帮助我们快速创建一个属于自己的博客网站,熟悉 Hexo 框架提供的命令有利于我们管理博客 1.hexo init hexo init 命令用于初始化本地文件夹为网站的根目录 $ he ...

  7. /etc/security/limits.conf 详解与配置

    目录 一. /etc/security/limits.conf 详解 /etc/security/limits.conf 配置解析 /etc/security/limits.d/ 目录 二. ulim ...

  8. Nginx知多少系列之(三)配置文件详解

    目录 1.前言 2.安装 3.配置文件详解 4.Linux下托管.NET Core项目 5.Linux下.NET Core项目负载均衡 6.Linux下.NET Core项目Nginx+Keepali ...

  9. httpd.conf详解,因为php始终报fileinfo扩展无法加载的错

    # # This is the main Apache HTTP server configuration file. It contains the # configuration directiv ...

  10. Signalr系列之虚拟目录详解与应用中的CDN加速实战

    目录 对SignalR不了解的人可以直接移步下面的目录 SignalR系列目录 前言 前段时间一直有人问我 在用SignalR 2.0开发客服系统[系列1:实现群发通讯]这篇文章中的"/Si ...

随机推荐

  1. WebRTC 基于GCC的拥塞控制(下)

    转自;http://blog.csdn.net/ljh081231/article/details/79152578 本文在文章[1]的基础上,从源代码实现角度对WebRTC的GCC算法进行分析.主要 ...

  2. tomcat使用不同jdk的解决方法

    1,修改bin文件夹下面的catalina.bat文件,把如下内容 rem ----- Execute The Requested Command -------------------------- ...

  3. 女子监狱第一季/全集Orange Is the New Black迅雷下载

    本季第一季 Orange Is the New Black 1 (2013) 看点:该剧描述主人公Piper Chapman(Taylor Schilling)在大学里结识了毒贩Alex(Laura ...

  4. mongodb centos7上的安装

    1,下载安装包 下载mongoDB的安装文件地址:https://www.mongodb.org/downloads#production 选择Linux 64-bit legacy 版本,下载到目标 ...

  5. nodejs ffi(DLL)

    npm install ffi Error: The specified module could not be found. npm rebuild var ffi = require('ffi') ...

  6. JAVA开发中文乱码的几个解决方案

    一:html乱码或者引入的JS乱码 1:第一步,text file encoding 首先确保文件的保存格式要UTF-8,如在eclipse中,要在文件上点属性,确保这里选择UTF-8 注意,在ecl ...

  7. 第三章 logstash - 输入插件之tcp与redis

    常用的输入插件: tcp redis 一.tcp 1.用法 input { tcp { port => 4560 codec => json_lines mode => server ...

  8. C#中byte[] 转 double[] 或 int[] 或 struct结构体

    方法:使用C#调用C++ memcpy实现各种参数类型的内存拷贝 using System.Runtime.InteropServices; public class GlbWSGridDataset ...

  9. Spring系列:Scheduled注解学习笔记

    一.试验代码 //@Scheduled(fixedRate = 5000) //@Scheduled(fixedDelay = 5000) @Scheduled(cron ="*/5 * * ...

  10. 客户端连接SQL报"Cannot Generate SSPI Context"错误

    这种错误实在是让人头痛, 如果你遇到它还没有头痛的话, 请先看看微软给出的针对这个错误的这篇KB811889. 一般我遇到这种错误都是直接放弃, 重新运行sysprep之后再安装一遍所需要的软件. 然 ...