Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Installing Elasticsearch and Kibana with Docker

Tech May 7 15

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

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...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

SBUS Signal Analysis and Communication Implementation Using STM32 with Fus Remote Controller

Overview In a recent project, I utilized the SBUS protocol with the Fus remote controller to control a vehicle's basic operations, including movement, lights, and mode switching. This article is aimed...

Leave a Comment

Anonymous

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