chinaab 发表于 2019-1-1 14:26:57

HAProxy负载均衡:

  配置HAProxy负载均衡

  (使用3台虚拟机,1台作为HAProxy调度器、2台作为Real Server、物理机作为客户端)
  (HAProxy调度器IP:192.168.4.50    Web服务器IP:192.168.4.53/54)                  
  一、基本配置
  1、 装包
  # yum -y install haproxy
  . 2 修改配置文件
  # cp /etc/haproxy/haproxy.cfg /root/                                       备份配置文件
  # chkconfig haproxy on                                                            开机自启
  # chkconfig --list haproxy                                                         加入系统命令
  haproxy      0:关闭1:关闭2:启用3:启用4:启用5:启用
  

  # vim /etc/haproxy/haproxy.cfg
  31   user      haproxy                                                         /var/www/html/index.html
  # secho '192.168.4.53'> /var/www/html/index.html
  #yum -y install httpd
  # echo '192.168.4.53'> /var/www/html/index.html
  #yum -y install httpd
三 、启动服务器并设置开机启动
    #systemctl start haproxy
    #systemctl enable haproxy
   

四、客户端验证
    # firefox http://192.168.4.50/haproxy-admin            >测试状态监控页面是否正常
   






页: [1]
查看完整版本: HAProxy负载均衡: