pelias / docker

Run the Pelias geocoder in docker containers, including example projects.
MIT License
318 stars 221 forks source link

pelias import all error ENOTFOUND - using a proxy #80

Closed jeremy-rutman closed 5 years ago

jeremy-rutman commented 5 years ago

after pelias prepare all worked, I now get another ENOTFOUND error as below...

deploy@dap-jupyter01:/mnt/open_street_map/pelias_docker/docker/projects/portland-metro$ pelias prepare all
...
Build completed!

deploy@dap-jupyter01:/mnt/open_street_map/pelias_docker/docker/projects/portland-metro$ pelias import all
info: [whosonfirst] Loading whosonfirst-data-continent-latest.csv records from /data/whosonfirst/meta
Elasticsearch ERROR: 2019-03-18T22:07:11Z
  Error: Request error, retrying
  HEAD http://elasticsearch:9200/pelias => getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200
      at Log.error (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/log.js:226:56)
      at checkRespForFailure (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:259:18)
      at HttpConnector.<anonymous> (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/connectors/http.js:164:7)
      at ClientRequest.wrapper (/code/pelias/whosonfirst/node_modules/lodash/lodash.js:4935:19)
      at ClientRequest.emit (events.js:182:13)
      at Socket.socketErrorListener (_http_client.js:392:9)
      at Socket.emit (events.js:182:13)
      at emitErrorNT (internal/streams/destroy.js:82:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
      at process._tickCallback (internal/process/next_tick.js:63:19)

info: [whosonfirst] Loading whosonfirst-data-country-latest.csv records from /data/whosonfirst/meta
info: [whosonfirst] Loading whosonfirst-data-region-latest.csv records from /data/whosonfirst/meta
info: [whosonfirst] Loading whosonfirst-data-county-latest.csv records from /data/whosonfirst/meta
Elasticsearch WARNING: 2019-03-18T22:07:11Z
  Unable to revive connection: http://elasticsearch:9200/

Elasticsearch WARNING: 2019-03-18T22:07:11Z
  No living connections

ERROR: Elasticsearch index pelias does not exist
You must use the pelias-schema tool (https://github.com/pelias/schema/) to create the index first
For full instructions on setting up Pelias, see http://pelias.io/install.html
/code/pelias/whosonfirst/node_modules/pelias-dbclient/src/configValidation.js:38
          throw new Error(`elasticsearch index ${config.schema.indexName} does not exist`);
          ^

Error: elasticsearch index pelias does not exist
    at existsCallback (/code/pelias/whosonfirst/node_modules/pelias-dbclient/src/configValidation.js:38:17)
    at respond (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:327:9)
    at sendReqWithConnection (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:226:7)
    at next (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/connection_pool.js:214:7)
    at process._tickCallback (internal/process/next_tick.js:61:11)
deploy@dap-jupyter01:/mnt/open_street_map/pelias_docker/docker/projects/portland-metro$ pelias elastic status
200
missinglink commented 5 years ago

The output of pelias compose ps should show an elasticsearch container running on port 9200

missinglink commented 5 years ago

The message Elasticsearch index pelias does not exist indicates that you have skipped steps in the README.

jeremy-rutman commented 5 years ago

i'll try again from scratch using pelias elastic stop , tho i blv i went thru all the steps as per the readme . Before stop/start i see containers on ports 9200,9300. After stop/start/wait/create I get 'index_already_exists_exception' which is mysterious given a missing index was what got me here in the first place - but maybe its a different index - in any case I'm assuming I can continue from that to download all . Incidentally there is some error

info: [openaddresses-download] Downloading us/wa/clark.csv
events.js:183
      throw er; // Unhandled 'error' event
      ^
Error: getaddrinfo EAI_AGAIN ftp2.census.gov:21
    at Object._errnoException (util.js:992:11)
    at errnoException (dns.js:55:15)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)

during download but it seems its not a showstopper

jeremy-rutman commented 5 years ago

stop/start/wait/create/download all/prepare all/import hits more or less the same error as above,

info: [whosonfirst] Loading whosonfirst-data-continent-latest.csv records from /data/whosonfirst/meta
Elasticsearch ERROR: 2019-03-19T11:31:46Z
  Error: Request error, retrying
  HEAD http://elasticsearch:9200/pelias => getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200
      at Log.error (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/log.js:226:56)
      at checkRespForFailure (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:259:18)
      at HttpConnector.<anonymous> (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/connectors/http.js:164:7)
      at ClientRequest.wrapper (/code/pelias/whosonfirst/node_modules/lodash/lodash.js:4935:19)
      at ClientRequest.emit (events.js:182:13)
      at Socket.socketErrorListener (_http_client.js:392:9)
      at Socket.emit (events.js:182:13)
      at emitErrorNT (internal/streams/destroy.js:82:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
      at process._tickCallback (internal/process/next_tick.js:63:19)

info: [whosonfirst] Loading whosonfirst-data-country-latest.csv records from /data/whosonfirst/meta
info: [whosonfirst] Loading whosonfirst-data-region-latest.csv records from /data/whosonfirst/meta
info: [whosonfirst] Loading whosonfirst-data-county-latest.csv records from /data/whosonfirst/meta
Elasticsearch WARNING: 2019-03-19T11:31:46Z
  Unable to revive connection: http://elasticsearch:9200/

Elasticsearch WARNING: 2019-03-19T11:31:46Z
  No living connections

ERROR: Elasticsearch index pelias does not exist
You must use the pelias-schema tool (https://github.com/pelias/schema/) to create the index first
For full instructions on setting up Pelias, see http://pelias.io/install.html
/code/pelias/whosonfirst/node_modules/pelias-dbclient/src/configValidation.js:38
          throw new Error(`elasticsearch index ${config.schema.indexName} does not exist`);
          ^

Error: elasticsearch index pelias does not exist
    at existsCallback (/code/pelias/whosonfirst/node_modules/pelias-dbclient/src/configValidation.js:38:17)
    at respond (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:327:9)
    at sendReqWithConnection (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:226:7)
    at next (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/connection_pool.js:214:7)
    at process._tickCallback (internal/process/next_tick.js:61:11)

On the assumption that the index_already_exists_exception was a showstopper I will try to restart everything from scratch by a docker restart , as pelias elastic stop doesn't seem to do the trick. As usual, pelias compose ps is faithfully showing elasticsearch on ports 9200 and 9300.

I have a suspicion that this all may be due to working behind a proxy but am not sure. If I set network_mode:host in elasticsearch section of docker-compose.yml then pelias elastic create doesnt complete so I only have that set in the services that afaict need outside access. Possibly the use of localhost is getting munged up somehow by proxy issues.

jeremy-rutman commented 5 years ago

I did sudo systemctl daemon-reload sudo systemctl restart docker pelias compose pull pelias elastic start pelias elastic wait after which pelias elastic create hits the same index_already_exists_exception ([index_already_exists_exception] index [pelias/k0Hmz31MTbG9SJYCo0JINg] already exists, with { index_uuid="k0Hmz31MTbG9SJYCo0JINg" & index="pelias" } so I'll try again with a different data_dir in .env on the assumption that the index being found is saved there - iiuc changes dont get saved in containers .

jeremy-rutman commented 5 years ago

so after moving the data_dir and starting over, I once again hit the same err . changed data_dir in .env to a new dir , then

pelias elastic start
pelias elastic wait
pelias elastic create

which this time completes with no index_already_exists error, then

pelias download all
pelias prepare all

and then

deploy@dap-jupyter01:/mnt/open_street_map/pelias_docker/docker/projects/portland-metro$ pelias import all
info: [whosonfirst] Loading whosonfirst-data-continent-latest.csv records from /data/whosonfirst/meta
Elasticsearch ERROR: 2019-03-19T13:34:23Z
  Error: Request error, retrying
  HEAD http://elasticsearch:9200/pelias => getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200
      at Log.error (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/log.js:226:56)
      at checkRespForFailure (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:259:18)
      at HttpConnector.<anonymous> (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/connectors/http.js:164:7)
      at ClientRequest.wrapper (/code/pelias/whosonfirst/node_modules/lodash/lodash.js:4935:19)
      at ClientRequest.emit (events.js:182:13)
      at Socket.socketErrorListener (_http_client.js:392:9)
      at Socket.emit (events.js:182:13)
      at emitErrorNT (internal/streams/destroy.js:82:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
      at process._tickCallback (internal/process/next_tick.js:63:19)

info: [whosonfirst] Loading whosonfirst-data-country-latest.csv records from /data/whosonfirst/meta
info: [whosonfirst] Loading whosonfirst-data-region-latest.csv records from /data/whosonfirst/meta
info: [whosonfirst] Loading whosonfirst-data-county-latest.csv records from /data/whosonfirst/meta
Elasticsearch WARNING: 2019-03-19T13:34:23Z
  Unable to revive connection: http://elasticsearch:9200/

Elasticsearch WARNING: 2019-03-19T13:34:23Z
  No living connections

ERROR: Elasticsearch index pelias does not exist
You must use the pelias-schema tool (https://github.com/pelias/schema/) to create the index first
For full instructions on setting up Pelias, see http://pelias.io/install.html
/code/pelias/whosonfirst/node_modules/pelias-dbclient/src/configValidation.js:38
          throw new Error(`elasticsearch index ${config.schema.indexName} does not exist`);
          ^

Error: elasticsearch index pelias does not exist
    at existsCallback (/code/pelias/whosonfirst/node_modules/pelias-dbclient/src/configValidation.js:38:17)
    at respond (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:327:9)
    at sendReqWithConnection (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/transport.js:226:7)
    at next (/code/pelias/whosonfirst/node_modules/elasticsearch/src/lib/connection_pool.js:214:7)
    at process._tickCallback (internal/process/next_tick.js:61:11)

deploy@dap-jupyter01:/mnt/open_street_map/pelias_docker/docker/projects/portland-metro$ pelias elastic status
200
deploy@dap-jupyter01:/mnt/open_street_map/pelias_docker/docker/projects/portland-metro$ pelias compose ps
        Name                   Command           State                       Ports                     
-------------------------------------------------------------------------------------------------------
pelias_elasticsearch   /bin/bash bin/es-docker   Up      0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp

The last few lines of the logs are


elasticsearch_1  | [2019-03-19T11:57:06,901][WARN ][o.e.d.i.m.StringFieldMapper$TypeParser] The [string] field is deprecated, please use [text] or [keyword] instead on [category]
elasticsearch_1  | [2019-03-19T11:57:06,958][INFO ][o.e.c.m.MetaDataCreateIndexService] [Rq_weo-] [pelias] creating index, cause [api], templates [], shards [1]/[0], mappings [venue, country, address, dependency, locality, county, borough, macroregion, localadmin, _default_, macrocounty, street, neighbourhood, postalcode, region]
elasticsearch_1  | [2019-03-19T11:57:07,198][INFO ][o.e.c.r.a.AllocationService] [Rq_weo-] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[pelias][0]] ...]).

the elasticsearch url instead of localhost is a sticking point:

deploy@dap-jupyter01:/mnt/open_street_map/pelias_docker/docker/projects/portland-metro$ curl -i -H GET http://elasticsearch:9200/_nodes
curl: (6) Could not resolve host: elasticsearch
deploy@dap-jupyter01:/mnt/open_street_map/pelias_docker/docker/projects/portland-metro$ curl -i -H GET http://localhost:9200/_nodes
HTTP/1.1 200 OK
content-type: application/json; charset=UTF-8
content-length: 7878

{"_nodes":{"total":1,"successful":1,"failed":0},"cluster_name":"pelias-dev","nodes":{"Rq_weo-SRwG734wisxEaqA":{"name":"Rq_weo-","transport_address":"172.19.0.2:9300","host":"172.19.0.2","ip":"172.19.0.2","version":"5.6.12","build_hash":"cfe3d9f","total_indexing_buffer":51897958,"roles":["master","data","ingest"],"attributes":{"ml.max_open_jobs":"10","ml.enabled":"true"},"settings":{"cluster":{"name":"pelias-dev"},"node":{"name":"Rq_weo-","attr":{"ml":{"max_open_jobs":"10","enabled":"true"}},"data":"true","master":"true"},"path":{"logs":"/usr/share/elasticsearch/logs","home":"/usr/share/elasticsearch"},"discovery":{"type":"single-node"},"thread_pool":{"bulk":{"queue_size":"1000"}},"client":{"type":"node"},"http":{"type":{"default":"netty4"},"port":"9200"},"bootstrap":{"memory_lock":"true"},"transport":{"type":{"default":"netty4"}},"xpack":{"monitoring":{"enabled":"false"},"security":{"enabled":"false"}},"network":{"host":"0.0.0.0"}},"os":{"refresh_interval_in_millis":1000,"n
...
missinglink commented 5 years ago

docker-compose allows containers to address each other using their service name, so in this case, the hostname elasticsearch refers to the container(s) created using the services.elasticsearch section of docker-compose.yml.

I think you said you changed the network type to 'host'? if this is the case then the network-discovery functionality may no longer be available. see: https://docs.docker.com/config/containers/container-networking/

I would recommend you use the default installation method and a machine which doesn't have any custom networking setup. We have not tested any other form of networking and we can't provide support for non-standard docker configurations.

jeremy-rutman commented 5 years ago

All our servers use a corporate proxy and I don;t blv I'll get an ok around that. I did set network_mode: host for a few services in the docker-compose.yml, which worked for allowing downloads but it seems its presence in some services or absence in others is causing trouble here ; I'll see if adding such a line e..g to api and/or schema will take care of it . Adding this line to 'elasticsearch' does cause trouble in the pelias elastic create step. In any case if I manage to get to the other side of this maybe its of use to other corporate users. Thanks for the pointers and help.

jeremy-rutman commented 5 years ago

A working kluge seems to be: add network_mode:host for services osm, oaddr and anything else requiring net access during pelias download all, then take out the network_mode lines , stop/start the elastic and continue to prepare all . The pelias test run finally ran , and despite 'regressions' that looks like maybe a result of some missing data, I think I can now go onto planet

pelias test run : 
.....
Aggregate test results
Pass: 386
Improvements: 2
Fail: 39
Placeholders: 0
Regressions: 49
Took 16015ms
Test success rate 89.66%
jeremy-rutman commented 5 years ago

in some proxy setups you might need to pass in the proxy values as environment variables, which conveniently enough can be done in the docker-compos.yml , for instance:

whosonfirst:
    environment:
    - http_proxy=http://my.proxy.com:3128
    - https_proxy=http://my.proxy.com:3128      
    - HTTP_PROXY=http://my.proxy.com:3128
    - HTTPS_PROXY=http://my.proxy.com:3128      

If you have those proxies set as environment variables on the host then you can do instead

whosonfirst:
    network_mode: host
Fr3dY2 commented 4 years ago

Hi,

I'm trying to install pelias on RHEL 8.1 and it fails in the 'pelias elastic create' command as well. I defined the proxy variables in Docker service scripts to make "pelias compose pull" work, but can't get past the index creation in ElasticSearch. However, both "pelias elastic wait" and "telnet 172.18.0.2 9200" work fine. I'm using containerd.io-1.2.6-3.3, docker-ce-19.03.5-3.el7 and docker-compose-1.25.0.

Basically, this is what I did:

vi /usr/lib/systemd/system/docker.service <-- Under [Service], add: Environment="HTTP_PROXY=http://proxyuser:proxypassword@proxyip:proxyport/" Environment="HTTPS_PROXY=http://proxyuser:proxypassword@proxyip:proxyport/"

pelias compose pull Pulling libpostal ... done Pulling schema ... done Pulling api ... done Pulling placeholder ... done Pulling whosonfirst ... done Pulling openstreetmap ... done Pulling openaddresses ... done Pulling transit ... done Pulling csv-importer ... done Pulling polylines ... done Pulling interpolation ... done Pulling pip ... done Pulling elasticsearch ... done Pulling fuzzy-tester ... done

pelias elastic start Creating network "pelias_default" with driver "bridge" Creating pelias_elasticsearch ... done

pelias elastic wait waiting for elasticsearch service to come up ......Elasticsearch up!

pelias elastic create

 create index
--------------

Elasticsearch ERROR: 2020-01-16T16:02:28Z
  Error: Request error, retrying
  GET http://elasticsearch:9200/ => connect EHOSTUNREACH 172.18.0.2:9200
      at Log.error (/code/pelias/schema/node_modules/elasticsearch/src/lib/log.js:239:56)
      at checkRespForFailure (/code/pelias/schema/node_modules/elasticsearch/src/lib/transport.js:298:18)
      at HttpConnector.<anonymous> (/code/pelias/schema/node_modules/elasticsearch/src/lib/connectors/http.js:171:7)
      at ClientRequest.wrapper (/code/pelias/schema/node_modules/lodash/lodash.js:4929:19)
      at ClientRequest.emit (events.js:209:13)
      at Socket.socketErrorListener (_http_client.js:406:9)
      at Socket.emit (events.js:209:13)
      at emitErrorNT (internal/streams/destroy.js:91:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
      at processTicksAndRejections (internal/process/task_queues.js:77:11)

Elasticsearch WARNING: 2020-01-16T16:02:29Z
  Unable to revive connection: http://elasticsearch:9200/

Elasticsearch WARNING: 2020-01-16T16:02:29Z
  No living connections

NoConnections [Error]: No Living connections
    at sendReqWithConnection (/code/pelias/schema/node_modules/elasticsearch/src/lib/transport.js:266:15)
    at next (/code/pelias/schema/node_modules/elasticsearch/src/lib/connection_pool.js:243:7)
    at processTicksAndRejections (internal/process/task_queues.js:75:11) {
  message: 'No Living connections'
}
unsupported elasticsearch version. try: >=6.5.4 || >=7.4.2
Adriano-Silva-DEV commented 1 year ago

Estou com este mesmo erro, conseguiu resolver?