- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
Deploy a Multi-Node Elasticsearch Cluster
Before we can get hands-on with indexing, searching, and aggregating our data with Elasticsearch, we first need to know how to prepare a system and how to deploy and configure Elasticsearch. In this hands-on lab, you will deploy a 3-node Elasticsearch cluster with a specific set of configuration requirements. Specifically, you will: * Deploy Elasticsearch from an RPM * Specify Elasticsearch cluster and node names * Create custom attributes for Elasticsearch nodes * Assign Elasticsearch node roles * Configure the Elasticsearch Java virtual machine (JVM) heap * Bind Elasticsearch to specific network addresses * Configure Elasticsearch node discovery * Configure Elasticsearch cluster bootstrap * Start Elasticsearch * Inspect Elasticsearch cluster logs * `curl` the Elasticsearch node APIs to check status and configuration
Lab Info
Table of Contents
-
Challenge
Install Elasticsearch on each node.
Using the Secure Shell (SSH), log in to each node as
cloud_uservia the public IP address.Become the
rootuser with:sudo su -Import the Elastic GPG key:
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearchDownload the Elasticsearch 7.6 RPM:
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.0-x86_64.rpmInstall Elasticsearch:
rpm --install elasticsearch-7.6.0-x86_64.rpmConfigure Elasticsearch to start on system boot:
systemctl start elasticsearch.service systemctl enable elasticsearch -
Challenge
Configure each node's elasticsearch.yml per instructions.
Log in to each node and become the
rootuser:sudo su -Open the
elasticsearch.ymlfile:vim /etc/elasticsearch/elasticsearch.ymlChange the following line:
#cluster.name: my-applicationto
cluster.name: cluster-1Change the following line on master-1:
#node.name: node-1to
node.name: master-1Change the following line on data-1:
#node.name: node-1to
node.name: data-1Change the following line on data-2:
#node.name: node-1to
node.name: data-2Change the following line on data-1:
#node.attr.rack: r1to
node.attr.temp: hotChange the following line on data-2:
#node.attr.rack: r1to
node.attr.temp: warmAdd the following lines on master-1:
node.master: true node.data: false node.ingest: false node.ml: falseAdd the following lines on data-1:
node.master: false node.data: true node.ingest: true node.ml: falseAdd the following lines on data-2:
node.master: false node.data: true node.ingest: true node.ml: falseChange the following on each node:
#network.host: 192.168.0.1to
network.host: [_local_, _site_]Change the following on each node:
#discovery.seed_hosts: ["host1", "host2"]to
discovery.seed_hosts: ["10.0.1.101"]Change the following on each node:
#cluster.initial_master_nodes: ["node-1", "node-2"]to
cluster.initial_master_nodes: ["master-1"] -
Challenge
Configure the heap for each node per instructions.
Log in to the master node and become the
rootuser:sudo su -Open the
jvm.optionsfile:vim /etc/elasticsearch/jvm.optionsChange the following lines:
-Xms1g -Xmx1gto
-Xms768m -Xmx768mLog in to each data node and become the
rootuser:sudo su -Open the
jvm.optionsfile:vim /etc/elasticsearch/jvm.optionsChange the following lines:
-Xms1g -Xmx1gto
-Xms2g -Xmx2g -
Challenge
Start Elasticsearch on each node.
Log in to each node and become the
rootuser:sudo su -Start Elasticsearch:
systemctl start elasticsearchCheck the startup process:
less /var/log/elasticsearch/cluster-1.logCheck the node configuration:
curl localhost:9200/_cat/nodes?v
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.