每个主机的多个vespa docker容器?

时间:2018-03-05 16:54:05

标签: docker vespa

PB:我曾尝试在两台不同的主机上部署5个vespa容器,但我没有成功使我的vespa节点上升。

我将3个容器vespa0,vespa1,vespa2分别命名为第一个宿主,端口8080,8081,8082,vespa3,vespa4分别为端口8080,8081

我以这种方式启动vespa容器

sudo docker run --detach --net=host --name vespa0 --hostname admin_paul0 --privileged --volume $PWD/sample-apps:/vespa-sample-apps --publish 8080:8080 vespaengine/vespa

然后我用:

部署应用程序
sudo docker exec vespa0 bash -c '/opt/vespa/bin/vespa-deploy prepare /vespa-sample-apps/site_search_multi_node_on_multi_server/src/main/application && /opt/vespa/bin/vespa-deploy activate'

当我写命令时

sudo docker exec vespa0 bash -c '/opt/vespa/bin/vespa-get-cluster-state'

群集检测到两台主机上的节点,但只有一台已启动。

Cluster site:
site/distributor/0: down
site/distributor/1: down
site/distributor/3: down
site/distributor/4: up
site/storage/0: down
site/storage/1: down
site/storage/3: down
site/storage/4: up

特此申请的配置

host.xml

    <?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
    <hosts>
     <host name="admin_paul0">
    <alias>admin_paul0</alias>
  </host>

  <host name="stateless_paul0">
    <alias>stateless_paul0</alias>
  </host>

  <host name="content_paul0">
    <alias>content_paul0</alias>
  </host>

  <host name="content_paul1">
    <alias>content_paul1</alias>
  </host>

  <host name="stateless_paul1">
    <alias>stateless_paul1</alias>
  </host>
</hosts>

的services.xml

<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<services version="1.0">
  <admin version="2.0">
    <adminserver hostalias="admin_paul0"/>
    <configservers>
      <configserver hostalias="admin_paul0"/>
    </configservers>
  </admin>

  <container id="container" version="1.0">
    <document-api/>
    <search/>
    <nodes>
      <node hostalias="stateless_paul0"/>
      <node hostalias="stateless_paul1"/>
      <node hostalias="content_paul0"/>
      <node hostalias="content_paul1"/>
    </nodes>
  </container>

  <content id="site" version="1.0">
    <redundancy>1</redundancy>
    <documents>
      <document type="site" mode="index"/>
    </documents>
    <nodes>
      <node hostalias="content_paul0" distribution-key="0"/>
      <node hostalias="content_paul1" distribution-key="1"/>
      <node hostalias="stateless_paul0" distribution-key="3"/>
      <node hostalias="stateless_paul1" distribution-key="4"/>
    </nodes>
  </content>
</services>

您有任何可以使其有效的提示吗? :)

1 个答案:

答案 0 :(得分:4)

你必须隔离网络以使其工作,因为Vespa使用一系列其他冲突的端口(即没有--net = host)。在裸机主机上运行,​​您可以使用macvlan网络驱动程序为容器分配跨主机IP,否则您需要设置NPT或类似的东西。