How to Load Balance Kibana
As the user base grows and the use cases expand, the need to scale Kibana becomes increasingly important.
High Availability
Scalability
For deployement, we have used three c6g.large EC2 instances running Debian 12 on AWS.
wget https://artifacts.elastic.co/downloads/kibana/kibana-8.14.1-amd64.deb
sudo dpkg -i kibana-8.14.1-amd64.deb
and bunch of other commands following the official documentation here, we had kibana running and connected to elasticsearch.
For Alerting, kibana requires additional step, i.e. adding encryption key as documented here. The encryption key needs to be added to kibana config, for debian, configuration file is located at:
/etc/kibana/kibana.yml
At the end of above file, add a random key of 32 characters or more example generator.
xpack.encryptedSavedObjects.encryptionKey: <A string of 32 character or more>
Now we have alerting setup done.
Steps to be done before creating a image for load balancing:
领英推荐
1. Add security key to config as we did for encryptedSavedObjects above
xpack.security.encryptionKey: something_at_least_32_characters
This ensures, when a user's request is load balanced, to different kibana instance, the user is not logged out. The details can be found here.
2. Shutdown kibana service
sudo systemctl stop kibana.service
3. Enable kibana service to be started on boot
sudo systemctl enable kibana.service
4. Enable kibana to be accessible to load balancer by changing the key in kibana.yml
server.host: "0.0.0.0"
5. Delete kibana uuid file should be in one of the below locations
sudo rm /var/lib/kibana/uuid
or
sudo rm /usr/share/kibana/data/uuid
6. Now proceed with creating an image, and attaching it to load balancing target group.
Summary
Deleting the uuid file and adding xpack.security.encryptionKey are the only additional steps required to load balance kibana.