Elastic Search Depoly Note
1. Persistent Data and config folder as if when docker exit, the file can be persistent.
mkdir /usr/share/elasticsearch/config
mkdir /usr/share/elasticsearch/data
chgrp 0 /usr/share/elasticsearch/data
chgrp 0 /usr/share/elasticsearch/config
chmod g+rwx /usr/share/elasticsearch/data
chmod g+rwx /usr/share/elasticsearch/config
Docker store keystore first before run:
docker run -it --rm \
-v /usr/share/elasticsearch/config:/usr/share/elasticsearch/config \
-v :/usr/share/elasticsearch/data:/usr/share/elasticsearch/data \
docker.elastic.co/elasticsearch/elasticsearch:8.6.2 \
bin/elasticsearch-keystore create -p
Terminal should be respond like this:
Enter new password for the elasticsearch keystore (empty for no password):
Enter same password again:
Created elasticsearch keystore in /usr/share/elasticsearch/config/elasticsearch.keystore
2. Create network and reset the password to bind kibana.
- Create network for elastic:
docker network create elastic
- Run elastic
docker run -it --name es01 \
--net elastic -p 9200:9200 \
docker.elastic.co/elasticsearch/elasticsearch:8.6.2
Error ancounterd as follow:
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
....
....
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
- Add max memory map to sysctl.conf
vm.max_map_count = 262144
- Restart container using
docker start es01
3. If elastic successfully run, reset the password for elastic.
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic
- If terminal output like this:
ERROR: unable to create temporary keystore at [/usr/share/elasticsearch/config/elasticsearch.keystore.tmp], write permissions required for [/usr/share/elasticsearch/config] or run [elasticsearch-keystore upgrade]
Try reset your file permissions.