Step-by-Step Guide: Install and Configure ElasticSearch 7.17.x Cluster on Ubuntu
This tutorial walks you through installing a binary ElasticSearch 7.17.x cluster on Ubuntu 22.04, covering environment setup, JDK installation, hostname and hosts configuration, time synchronization, system tuning, user creation, ES download and configuration, service creation, cluster startup, and verification.
Overview
This article explains how to install a binary ElasticSearch 7.17.x cluster on Ubuntu 22.04, covering environment preparation, JDK installation, hostname and hosts configuration, time synchronization, system tuning, user creation, ES download, configuration, service setup, and cluster verification.
Environment Information
Three nodes are used: ELK01 (10.0.0.40), ELK02 (10.0.0.41), ELK03 (10.0.0.42), all running Ubuntu 22.04.
Practical Steps
Install JDK (required on all nodes)
ElasticSearch runs on Java, so JDK 11 is installed.
Installation guide: https://www.cnblogs.com/huangSir-devops/p/18919758
ElasticSearch 7.17.x is compatible with JDK 11.
wget https://mirrors.huaweicloud.com/openjdk/11.0.2/openjdk-11.0.2_linux-x64_bin.tar.gz
tar -xvf openjdk-11.0.2_linux-x64_bin.tar.gz
ln -s /root/jdk-11.0.2 /usr/local/jdk11
vim /etc/profile
export JAVA_HOME=/usr/local/jdk11
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
java -versionConfigure Hostname and /etc/hosts
# ELK01
hostnamectl set-hostname ELK01
hostname
# ELK02
hostnamectl set-hostname ELK02
hostname
# ELK03
hostnamectl set-hostname ELK03
hostname
# Add hosts on all nodes
vim /etc/hosts
10.0.0.40 ELK01
10.0.0.41 ELK02
10.0.0.42 ELK03Configure Time Synchronization
ln -svf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
apt -y install ntpdate
ntpdate ntp.aliyun.com
echo "*/5 * * * * /usr/sbin/ntpdate ntp.aliyun.com" > /var/spool/cron/crontabs/rootSystem Configuration
Increase file descriptors, virtual memory, and network parameters.
vim /etc/sysctl.conf
fs.file-max = 655360
vm.max_map_count = 2147483642
vm.swappiness = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_intvl = 60
net.ipv4.tcp_keepalive_probes = 10
net.ipv4.tcp_max_syn_backlog = 4096
net.core.somaxconn = 4096
net.core.netdev_max_backlog = 16384
net.core.rmem_max = 262144
net.core.wmem_max = 262144
sysctl -p /etc/sysctl.conf
sysctl -q vm.max_map_countCreate ES Directories and User
mkdir -p /data/elasticsearch/
mkdir -p /var/log/elasticsearch/
useradd elasticsearch
chown elasticsearch:elasticsearch -R /data/elasticsearch/
chown elasticsearch:elasticsearch -R /var/log/elasticsearch/
vim /etc/security/limits.conf
elasticsearch hard nofile 655360
elasticsearch soft nofile 655360
elasticsearch hard nproc 8192
elasticsearch soft nproc 8192
elasticsearch hard memlock unlimited
elasticsearch soft memlock unlimitedDownload and Configure ElasticSearch
Official download: https://www.elastic.co/downloads/past-releases#elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.26-linux-x86_64.tar.gz
tar -xvf elasticsearch-7.17.26-linux-x86_64.tar.gz
mv elasticsearch-7.17.26 /data/
chown elasticsearch:elasticsearch -R /data/elasticsearch-7.17.26/
ln -s /data/elasticsearch-7.17.26 /usr/local/es7
vim /usr/local/es7/config/elasticsearch.yml
cluster.name: es7
path.data: /data/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["ELK01","ELK02","ELK03"]
cluster.initial_master_nodes: ["ELK01","ELK02","ELK03"]
node.name: ELK03Create systemd Service and Start Cluster
vim /lib/systemd/system/es.service
[Unit]
Description=elasticsearch service
Documentation=https://www.cnblogs.com/huangSir-devops
After=network.target auditd.service
[Service]
LimitMEMLOCK=infinity
User=elasticsearch
ExecStart=/usr/local/es7/bin/elasticsearch
TimeoutStopSec=0
TimeoutStartSec=0
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start es
systemctl status esCheck Cluster Nodes
curl 10.0.0.40:9200/_cat/nodes
curl 10.0.0.40:9200/_cat/health?vSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
