-
Notifications
You must be signed in to change notification settings - Fork 489
Description
I am running lbry-sdk integration tests locally on MacOS, with elastic-search inside Docker. I used the lbry-sdk/Makefile command to launch it:
elastic-docker:
docker run -d -v lbryhub:/usr/share/elasticsearch/data -p 9200:9200 -p 9300:9300 -e"ES_JAVA_OPTS=-Xms512m -Xmx512m" -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.12.1
In order to connect herald -> elastic-search, I had to disable the SetSniff() option.
diff --git a/server/server.go b/server/server.go
index 415b728..7706e72 100644
--- a/server/server.go
+++ b/server/server.go
@@ -210,7 +210,7 @@ func MakeHubServer(ctx context.Context, args *Args) *Server {
if !args.DisableEs {
esUrl := args.EsHost + ":" + args.EsPort
opts := []elastic.ClientOptionFunc{
- elastic.SetSniff(true),
+ elastic.SetSniff(false),
elastic.SetSnifferTimeoutStartup(time.Second * 60),
elastic.SetSnifferTimeout(time.Second * 60),
elastic.SetURL(esUrl),
Probably the clearest explanation:
olivere/elastic#1138
More similar issues:
https://github.com/olivere/elastic/issues?q=is%3Aissue+docker+SetSniff+SetHealthCheck
Making a --nosniff option MAY NOT be the best solution here. I found the following comment describes how to fix this using the network.publish_host option of ElasticSearch. olivere/elastic#824 (comment)
Example:
docker run --env network.publish_host=127.0.0.1 ...
I tested "--env network.publish_host=127.0.0.1" and it worked for me.
Symbolic addresses like network.publish_host=_local_ are supported.