Fork me on GitHub
代码改变世界

docker rancher 负载均衡做路由跳转

2016-04-05 20:29  freefei  阅读(1314)  评论(0编辑  收藏  举报

介绍

我们要实现的目的是 根据负载均衡 跳转到指定的应用容器中

  • 负载均衡中配置好 跳转的地址

当执行URL 请求的时候会自动跳转

测试方法

 curl -v --header 'Host:mu.03in.com' fei.03in.com

docker-compose.yml

home:
  labels:
    io.rancher.container.pull_image: always
  tty: true
  image: local.03in.com:5000/php:v9
  stdin_open: true
lb:
  ports:
  - 80:80
  labels:
    io.rancher.loadbalancer.target.home: ran.03in.com
    io.rancher.loadbalancer.target.host1: mu.03in.com
    io.rancher.loadbalancer.target.host2: fei.03in.com
  tty: true
  image: rancher/load-balancer-service
  links:
  - home:home
  - host2:host2
  - host1:host1
  stdin_open: true
host2:
  labels:
    io.rancher.container.pull_image: always
  tty: true
  image: local.03in.com:5000/php:v9
  stdin_open: true
host1:
  labels:
    io.rancher.container.pull_image: always
  tty: true
  image: local.03in.com:5000/php:v9
  stdin_open: true

@ https://github.com/ranmufei

守望者舆情监控

守望者舆情监控系统