I received the following error when attempting to connect Dockerized fscrawler to Dockerized elasticsearch:
[f.p.e.c.f.c.ElasticsearchClientManager] failed to create elasticsearch client, disabling crawler…
[f.p.e.c.f.FsCrawler] Fatal error received while running the crawler: [Connection refused]
When fscrawler is run for the fist time (i.e.,
docker-compose run fscrawler) it creates/config/{fscrawer_job}/_settings.ymlwith the following default setting:This will cause fscrawler to attempt to connect to localhost (i.e., 127.0.0.1). However, this will fail when fscrawler is located within a docker container because it is attempting to connect with the localhost of the CONTAINER. This was particularly confusing in my case because elasticsearch WAS accessible as localhost, but on the localhost of my physical computer (and NOT localhost of the container). Changing the url allowed fscrawler to connect to network address where elasticsearch actually resides.
I used the following docker image: https://hub.docker.com/r/toto1310/fscrawler
Ran
docker-compose up elasticsearch elasticsearch2to bring up elasticsearch nodes.Ran
docker-compose run fscrawlerto create_settings.ymlEdited
_settings.ymltoStarted fscrawler
docker-compose up fscrawler