Install Elasticsearch and Kibana using Docker
First things first, you must have Docker and Docker compose setup and installed on your machine. If you don’t have it installed already, follow this link to set it up on your machine.
For this tutorial, we will be making use of the docker-compose command to spin up our own containers running Elasticsearch and Kibana.
Go ahead and create a docker-compose.yml file and paste the code below,
This Docker compose recipe spins up 2 Docker containers on your machine. One container running Elasticsearch 7.8.1 and the other running Kibana 7.8.1. It maps Elasticsearch API to port 9200 and Kibana to port 5601 on your machine. You can check the official Docker images for all available configuration options for Elasticsearch and Kibana. For this tutorial, we will be enabling security on Elasticsearch (duh!) and configuring a password (default username is “elastic”).
The recipe also mounts the kibana.yml to the Kibana config directory, you will need to make a few changes to the file to make sure Kibana connects correctly to your container running Elasticsearch.
# To allow connections from remote users, set this parameter to a non-loopback address.server.host: "0.0.0.0"# The URLs of the Elasticsearch instances to use for all your queries.elasticsearch.hosts: ["http://elasticsearch:9200"]# If your Elasticsearch is protected with basic authentication, these settings provide
# the username and password that the Kibana server uses to perform maintenance on the Kibana
# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
# is proxied through the Kibana server.elasticsearch.username: "elastic"
UPDATE 19/3/22: As of version 8.1, using ‘elastic’ username to connect Kibana to ElasticSearch does not work. Use auth tokens instead or an older version.
After both yml files are ready, open up a terminal and navigate to your directory and execute the below command,
Head on over to http://localhost:9200/ to verify that Elasticsearch is now running (key in your username and password, default username is “elastic”), you should see a response like below,
"tagline": "You Know, for Search"
Follow this link to check out the documentation for the Elasticsearch Search API.
To verify that Kibana is successfully up and running on your machine, head on over to http://localhost:5601/ and key in your username and password,
After logging in you can use the full potential of Kibana,
Thanks for reading, that’s all folks!