当容器在HOST网络中运行时如何配置marathon-lb?

时间:2017-03-29 09:25:38

标签: mysql docker marathon

我的马拉松比赛是在

之下
{
  "id": "/storage/mysql",
  "cmd": null,
  "cpus": 1,
  "mem": 512,
  "disk": 0,
  "instances": 1,
  "constraints": [
    [
      "hostname",
      "UNIQUE"
    ]
  ],
  "container": {
    "type": "DOCKER",
    "volumes": [],
    "docker": {
      "image": "reg.xxxxx.cn/library/mysql:5.7",
      "network": "HOST",
      "portMappings": [],
      "privileged": true,
      "parameters": [],
      "forcePullImage": false
    }
  },
  "env": {
    "MYSQL_ROOT_PASSWORD": "123456"
  },
  "labels": {
    "HAPROXY_GROUP": "internal"
  },
  "portDefinitions": [
    {
      "port": 3306,
      "protocol": "tcp",
      "labels": {}
    }
  ]
}

我发现haproxy(运行于192.168.30.142 View the screenshot)配置为:

frontend storage_mysql_3306
  bind *:3306
  mode tcp
  use_backend storage_mysql_3306

backend storage_mysql_3306
  balance roundrobin
  mode tcp
  server 192_168_30_144_31695 192.168.30.144:31695

mysql容器运行在192.168.30.144 View the screenshot,所以我想要的是:

server 192_168_30_144_3306 192.168.30.144:3306

那我该怎么做才能解决它? 谢谢!

1 个答案:

答案 0 :(得分:0)

我想我找到了答案 http://mesosphere.github.io/marathon/docs/host-port.html

Mesos代理不提供所有端口

我是对的吗?