Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing Elasticsearch and Kibana with Docker

Tech May 7 28

1. Begin by pulling the required container images:


</div>2\. Create directories for volume mounting:

<div>```bash
sudo mkdir -p /opt/elasticsearch/config
sudo mkdir -p /opt/elasticsearch/data
sudo mkdir -p /opt/elasticsearch/plugins


</div>4\. Launch the Elasticsearch container with the following command:

<div>```bash
sudo docker run --name elasticsearch \
-p 9200:9200 \
-p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms84m -Xmx512m" \
-v /opt/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /opt/elasticsearch/data:/usr/share/elasticsearch/data \
-v /opt/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.12.0

  • -p: Maps host ports to conatiner ports
  • -e discovery.type=single-node: Enables single-node cluster mode
  • -e ES_JAVA_OPTS: Sets memory allocation limits for Java process
  • -v: Mounts local directories into container
  • -d: Runs container in detached mode

Check container status and logs:


</div>Common issues during installation:

- Permission error: Set read/write/execute permissions with `sudo chmod -R 777 /opt/elasticsearch/`
- Configuration syntax issue: Ensure correct spacing in configuration lines
- Memory constraint: Increase virtual memory limit using `sudo sysctl -w vm.max_map_count=262144`

5\. Launch Kibana container:

<div>```bash
docker run --name kibana \
-e ELASTICSEARCH_HOSTS=http://192.168.232.109:9200 \
-p 5601:5601 \
-d kibana:7.12.0


</div>Log errors like "Unable to revive connection: http://elasticsearch:9200/" indicate incorrect Elasticsearch host conifguration. This typically happens due to missing trailing characters in the `ELASTICSEARCH_HOSTS` environment variable.

To resolve, enter the running container and update the configuration:

<div>```bash
docker exec -it d1d /bin/bash

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Android OpenGL ES – Camera Preview and Recording with Filters

This article demonstrates a combination of OpenGL ES, camera integration, and real-time filter application on textures. The objective is to preview camera feeds, apply filters, and record the output s...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.