Marathon-lb DCOS上具有不同端口的相同上下文路径服务

时间:2018-08-24 09:13:57

标签: elasticsearch kibana mesos marathon dcos

我已使用以下应用程序定义部署了elasticsearch和kibana

elasticsearch.json

{
  "id": "elasticsearch",
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "docker.elastic.co/elasticsearch/elasticsearch:6.3.2",
      "network": "BRIDGE",
      "portMappings": [
        { "hostPort": 9200, "containerPort": 9200, "servicePort": 0 },
        { "hostPort": 9300, "containerPort": 9300, "servicePort": 0 }
      ],
      "forcePullImage":true
    }
  },
  "instances": 1,
  "cpus": 1,
  "mem": 3048,
  "labels":{
    "HAPROXY_GROUP":"external",
    "HAPROXY_0_VHOST":"publichost",
    "HAPROXY_0_MODE":"http",
    "DCOS_PACKAGE_NAME": "elasticsearch"
  },
    "env": {
        "ES_JAVA_OPTS": "-Xmx2048m -Xms2048m"
      }
}

哪个将弹性搜索部署在“ /”上下文路径上

kibana.json

{
  "id": "kibana",
  "container": {
    "type": "DOCKER",
    "docker": {
      "image": "docker.elastic.co/kibana/kibana:6.3.2",
      "network": "BRIDGE",
      "portMappings": [
        { "hostPort": 5601, "containerPort": 5601, "servicePort":0}
      ],
      "forcePullImage":true
    },
  "volumes": [
   {
        "containerPath": "/usr/share/kibana/config",
        "hostPath": "/home/azureuser/kibana/config",
        "mode": "RW"
   }
]
  },
  "instances": 1,
  "cpus": 0.5,
  "mem": 2000,
  "labels":{
    "HAPROXY_0_VHOST":"publichost",
    "HAPROXY_0_MODE":"http",
    "DCOS_SERVICE_NAME": "kibana",
    "DCOS_SERVICE_SCHEME": "http",
    "DCOS_SERVICE_PORT_INDEX": "0"
  }
}

这也将kibana应用于“ /”上下文路径

然后如何访问kibana 当我尝试访问时 http://publichost/app/kibana不起作用,因为elasticsearch位于“ /”上

1 个答案:

答案 0 :(得分:0)

我是通过从Elasticsearch中删除"HAPROXY_GROUP":"external"来实现的,现在它不会部署在marathon-lb上,因此无法通过浏览器访问。