Observability is a crucial part of any software product, it helps in
understanding the internal state of a system by collecting and analyzing
metrics, logs, and traces. This information can be used to troubleshoot
issues, identify performance bottlenecks, and make improvements to the
system.
Observability is especially important for complex systems, such as
distributed systems, where it is difficult to track down the root cause of
problems.
There exist several tools out there to help monitor your system's health.
Assuming you have an instrumented system, how could you visualize this
instrumentation information, and get real-time updates on your system
performance?
The topic of observability is divergent and can be spanned across many
posts.
But in this post, I chose one topic that posed a tough challenge to me, and
that is setting up the APM Server of Elasticsearch, given how scattered
their documentation is, and the lack of community support, the challenge was
real, hopefully for someone trying to fi I'm going to set up the Elastic APM
Server, one of the popular tools to analyze metrics.
Let's get straight to it...
Setting up Elasticsearch
docker run --name es01 --net elastic -p 9200:9200 -it -m 1GB docker.elastic.co/elasticsearch/elasticsearch:8.10.4
ToFor information, please refer to:
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_start_a_single_node_cluster
Run this command, and make sure the container es01 is running:
docker ps
For Rancher Desktop Users
If you are using Rancher Desktop instead of Docker Desktop, you might face
this problem:
If the container has stopped unexpectedly (please use
docker logs es01 to
inspect the reason), you may see this error:
node validation exception\n[1] bootstrap checks failed.
You must address the points described in the following [1] lines before starting Elasticsearch.\n
bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]", "ecs.version"
For information, please see
https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html#vm-max-map-count
To fix, enter Rancher Desktop shell:
rdctl shell
Then run this command:
sysctl -w vm.max_map_count=262144
To exit the shell, run:
exit
Then restart Rancher Desktop (make sure Rancher Desktop GUI is activated):
rdctl shutdown
Then restart Rancher Desktop (make sure Rancher Desktop GUI is activated):
rdctl shutdown
rdctl start