In this article, I am going to highlight what ElasticHQ is very briefly, its benefits and how we can install it using Docker.
ElasticHQ is a powerful GUI tool packed with tons of good features which can be used to make life easier and meaningful when using with Elasticsearch.
Some of its most useful features are:
- Indices, nodes, shards, document size can be seen visually.
- Visual cluster health indicator.
- Visually manage indices, nodes.
- Includes a
RestAPI feature which can be used to retrieve information without using terminal and curl commands.
- A powerful
Queryfeature to make life much easier to search through Elasticsearch documents. This is really great to validate if a document has been saved or not.
Now let's see its installation process. We will install ElasticHQ using Docker. This guide is based on Mac, however the commands should be identical or similar on other platforms. This guide also assumes, you are using Elasticsearch cluster on Docker.
Determine the Docker
networkwhich your Elasticsearch nodes are on. This is imperative to ensure both Elasticsearch cluster and ElasticHQ use the same Docker network.
In terminal run:
docker run -d -p 5000:5000 --network elasticsearch -e HQ_DEFAULT_URL='http://es01:9200' -e HQ_ENABLE_SSL=False --name elastichq elastichq/elasticsearch-hq
Change Elasticsearch cluster URL
--network elasticsearchto match yours.
If you are using Elasticsearch cluster using
docker-compose, ensure to use the Elasticsearch master node's
service nameas it appears in
Let's look at an example:
version: '3.1' services: elasticsearch: #master node's service name image: elasticsearch container_name: elasticsearch_cluster environment: - cluster.name=docker-cluster - bootstrap.memory_lock=true - "ES_JAVA_OPTS=-Xms512m -Xmx512m" ulimits: memlock: soft: -1 hard: -1 ports: - 9200:9200 volumes: - ./db:/usr/share/elasticsearch/data
- For this recipe to work, our docker command would have been changed to:
docker run -d -p 5000:5000 --network elasticsearch -e HQ_DEFAULT_URL='http://elasticsearch:9200' -e HQ_ENABLE_SSL=False --name elastichq elastichq/elasticsearch-hq
Otherwise ElasticHQ will not be able to connect to cluster.
This is an important point to remember!
- Now, update Elasticsearch node's configuration file
elasticsearch.ymlby adding below :
http.cors.enabled : true http.cors.allow-origin : "*" http.cors.allow-methods : OPTIONS, HEAD, GET, POST, PUT, DELETE
This configuration file can be accessed in Elasticsearch Docker container. If you have multiple nodes you will need to add these in each node's configuration.
Adding these values will ensure ElasticHQ can communicate with each Elasticsearch node available on your cluster.
Restart each Elasticsearch node.
Restart ElasticHQ service:
docker conatiner restart elastichq
ElasticHQ GUI is now accessible via
localhost:5000. Make sure to enter the correct Elasticsearch service URL and choose correct Elasticsearch cluster on the main admin page.
By using ElasticHQ, hope you can reduce your all guess work and increase productivity.