ElasticHQ / elasticsearch-HQ

Monitoring and Management Web Application for ElasticSearch instances and clusters.
http://www.elastichq.org
Other
4.96k stars 530 forks source link

how to set address of custom Elastichsearch instance #472

Closed stefanocudini closed 4 years ago

stefanocudini commented 5 years ago

I'm using the docker version of Es-HQ, I can't connect to my external instance of Es v5.6 running on another docker container.

` Message: 'Unable to create connection to: http: // localhost: 9200' Arguments: (ConnectionError (MaxRetryError ("HTTPConnectionPool (host = 'localhost', port = 9200): Max retries exceeded with url: / (Caused by NewConnectionError ('<urllib3.connection.HTTPConnection object at 0x7fac7ff633c8>: Failed to establish a new connection: [Errno 111] ECONNREFUSED ',)) ",),),) ` There is an environment variable to set to specify the address and port of the ES location?

stefanocudini commented 5 years ago

eshq

fpragana commented 5 years ago

you can's use localhost. Use the network name of you elasticsearch docker instance.

stefanocudini commented 5 years ago

I'm just use localhost :( my elastich search is listening to this port but the problem remain..

cooldark commented 5 years ago

With "network.host: localhost" only how can a connection be established?

salaboy commented 4 years ago

Same problem here.. I have ES running in Kubernetes and I am doing a port forward to 9200 but the connection fails with Error 111. I know that ElasticSearch is reachable with http://localhost:9200 as curl returns the following:

curl -XGET http://localhost:9200
{
  "name" : "elasticsearch-master-2",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "7eKf2jHaT5uvsuHrzdSktg",
  "version" : {
    "number" : "6.8.1",
    "build_flavor" : "default",
    "build_type" : "docker",
    "build_hash" : "1fad4e1",
    "build_date" : "2019-06-18T13:16:52.517138Z",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}
royrusso commented 4 years ago

Questions:

cmdickson commented 4 years ago

I am running into the same issue. Running ES locally, straight from command-line.

Is everyone running the latest HQ? (I see 3.5.0 in the screenshot)

Running 3.5.4

Are you folks using the docker distro or running from source?

Docker distro

Are there reverse proxies in the way?

No

Update: Just cloned the repo and ran from source. I was able to get connected to my local ES.

royrusso commented 4 years ago

So when running Elasticsearch and HQ in containers, you have to use the container name to connect between them. localhost will not work... this is a docker thing.

Here is a sample docker-compose file that will autofill the container name in HQ and I have tested to work. Run with docker-compose up

version: '2'
services:
  elastichq:
    image: elastichq/elasticsearch-hq
    container_name: elastichq
    environment:
      - HQ_DEFAULT_URL=http://elasticsearch:9200
      - HQ_DEBUG=False
    ports:
      - 5000:5000
    networks:
      - esnet

  elasticsearch:
    image: elasticsearch:2.4.6
    container_name: elasticsearch
    environment:
      - cluster.name=elasticsearch
      - node.name=node_1
      - network.host=0.0.0.0
      - network.publish_host=0.0.0.0
      - bootstrap.memory_lock=true
      - http.cors.enabled=true
      - http.cors.allow-origin=*
      - http.host=0.0.0.0
      - transport.host=0.0.0.0
      - bootstrap.system_call_filter=false
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
    ulimits:
      memlock:
        soft: -1
        hard: -1
    networks:
      - esnet

volumes:
  esdata1:
    driver: local
networks:
  esnet:
    driver: bridge
ilterkaganocal commented 4 years ago

To use to docker-compose example above with elastic search 7.6.0

set elasticsearch.image and elasticsearch.environment : - cluster.initial_master_nodes as follows

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.0
    environment:
      - cluster.initial_master_nodes=node_1