1

I deployed vespa docker image on two nodes, got the following errors while running '/opt/vespa/bin/vespa-deploy prepare', configs are as follows. If I replaced 'yyy.com' with 'localhost', it looks fine. Anyone know what was the issue?

Session 21 for tenant 'default' created. Preparing session 21 using http://localhost:19071/application/v2/tenant/default/session/21/prepared Request failed. HTTP status code: 400 Invalid application package: default.default: Error loading model: Could not find host in the application's host system: 'vespa-container'. Hostsystem=host 'yyy.com',host 'xxx.com'

---- hosts.xml-----

<hosts>
   <host name="yyy.com">
     <alias>admin0</alias>
   </host>
   <host name="xxx.com">
     <alias>node2</alias>
   </host>

 </hosts>

--- services.xml ---

  3 <services version="1.0">
  4   <admin version="2.0">
  5     <adminserver hostalias="admin0"/>
  6     <configservers>
  7       <configserver hostalias="admin0"/>
  8     </configservers>
  9   </admin>
 10   <container id="container" version="1.0">
 11     <document-api />
 12     <search />
 13     <nodes>
 14       <node hostalias="admin0" />
 15       <node hostalias="node2" />
 16     </nodes>
 17   </container>
 18 
 19   <content id="music" version="1.0">
 20     <redundancy>1</redundancy>
 21     <documents>
 22       <document type="music" mode="index" />
 23     </documents>
 24     <nodes>
 25       <node hostalias="admin0" distribution-key="0" />
 26       <node hostalias="node2" distribution-key="1" />
 27     </nodes>
 28   </content>
 29 
 30 </services>


//inside docker container, /etc/hosts
172.17.0.2      vespa-container
user221074
  • 79
  • 7
  • How did you run the containers on the hosts ? (docker swarm, Kubernetes, docker compose, ...) – Arnstein Ressem Apr 03 '18 at 20:00
  • 1
    I workarounded this by specifying the real hostnames when running 'docker run ..', for instance, the below command worked in my test environment. "docker run --detach --name vespa --hostname yyy.com ..." . However, that means I need to change the real hostname on each host to create container. – user221074 Apr 04 '18 at 02:05
  • If you run a single docker container per host you could also consider using 'docker run --net=host ...'. – Arnstein Ressem Apr 05 '18 at 07:45

2 Answers2

3

Your problem is that 'localhost' inside the container is 'vespa-container', but it must be the FQDN reachable form the other nodes, e.g xxx.com/yyy.com.

If you are interested in the details, the exact code that resolves the name vespa-container but must resolve to the FQDN is getPreferredHostname in https://github.com/vespa-engine/vespa/blob/master/vespajlib/src/main/java/com/yahoo/net/HostName.java

Jon
  • 2,043
  • 11
  • 9
0

I suppose this is because your container probably do not resolve "yyy.com" and "xxx.com".

Can you ping from inside the container the yyy.com and xxx.com ? What are the hostname of the 2 containers you have on your nodes?

You should put your nodes IP and hostname in your /etc/hosts, so they can communicate with each other.

Robin
  • 46
  • 2
  • "yyy.com" (admin) and "xxx.com" are two hostnames of my nodes. I just hide the real names on stackoverflow.. They both are ping-able from inside both docker containers. – user221074 Apr 04 '18 at 02:00