Hello everyone, welcome back to Webzone Tech Tips Zidane Blog, Today I will share with you
Easily Deploy ELASTICSEARCH and KIBANA on Docker
Currently we have around 80% people using ElasticSearch with version 7.15.0, so I will introduce you a solution how to use this version first, newest version 8.15.0 will have detail guideline on this link, you can check it out for more information.
From 8.0.0 of ElasticSearch this must need https for access, you can check it on above link for more details information
On this version 7.15.0 we no need https for access ElasticSearch. So here is the docker-compose file detail:
Explore My Other Channel for More Cool and Valuable Insights
π Youtube Learn Tech Tipsπ Tiktok
π Facebook:
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0
ports:
- 9200:9200
environment:
- discovery.type=single-node
kibana:
image: docker.elastic.co/kibana/kibana:7.15.0
ports:
- 5601:5601
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
This is how we define two services: elasticsearch and kibana. We use the
official Docker images for both services. We also set some environment
variables and expose some ports.
- Elasticsearch: This service runs
on port 9200, which is the default port for Elasticsearch. We set
discovery.type to single-node, which means Elasticsearch runs on one
node only. This is good for development purposes.
- Kibana: This
service runs on port 5601, which is the default port for Kibana. We set
ELASTICSEARCH_HOSTS to http://elasticsearch:9200, which tells Kibana
where to find Elasticsearch. You cannot use http://localhost:9200 here because of on docker Kibana communication with ElasticSearch by elasticsearch services
After apply on docker-compose file, you MUST open allow PORT on your FIREWALL environment for reduce some bug "cannot access", you can check it out on below details
Here is Open port on MacOS -> Link
Here is Open port on Window -> Link
After open port and init your docker-compose file, we will go to how to use this docker compose configuration.
How to use this Docker Compose Configuration
You need to create a file named docker-compose.yml and copy the above contents into it. Then, go to the folder where the file is and run this command to start the containers:
docker-compose up
Be Note ElasticSearch need time to init, so you need wait for a minute after Docker start. then you can access below link: http://localhost:9200/ check is it start succeed, if you see below message on your browser. That's you have already complete setup and start ElasticSearch
{
"name" : "d26e34cb88e3",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "rjCJR_nuTMGnveIhGCX2jw",
"version" : {
"number" : "7.15.0",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "79d65f6e357953a5b3cbcc5e2c7c21073d89aa29",
"build_date" : "2021-09-16T03:05:29.143308416Z",
"build_snapshot" : false,
"lucene_version" : "8.9.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
And then for access Kibana tool, just access below link: http://localhost:5601/, If you see below screenshot, Congratulation, it already succeed to access Kibana tool