Step-by-Step Guide to Installing Elasticsearch 7.x, Elasticsearch‑head, and Sample 6.x Configuration
This article provides a comprehensive tutorial on installing a single‑node Elasticsearch 7.x cluster, configuring its key settings, setting up the Elasticsearch‑head web UI, and includes a reference 6.x configuration file for production environments.
Elasticsearch is currently the most popular search engine, and the first step to learning ES is installation and deployment. This guide is divided into three parts: installing Elasticsearch 7.x (single node), installing Elasticsearch‑head, and providing an online Elasticsearch 6.x configuration.
1. Install Elasticsearch 7.x
Download the Elasticsearch 7.1.1 package from https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-1-1 . Since version 7.0 the JDK is bundled, so a separate JDK installation is optional.
# Create directories and extract Elasticsearch
mkdir /{app,data}
tar zxf elasticsearch-7.1.1-linux-x86_64.tar.gz -C /app
# Create elasticsearch user
useradd elasticsearch
passwd elasticsearch
# Rename directory and change ownership
cd /app
mv elasticsearch-7.1.1 elasticsearch
chown elasticsearch:elasticsearch -R elasticsearch/Elasticsearch must not be started as the root user.
2. Configuration (elasticsearch.yml)
cluster.name: es-cluster
node.name: es-01
path.data: /data
path.logs: /app/elasticsearch/logs
bootstrap.memory_lock: true
bootstrap.system_call_filter: false
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: 192.168.10.130
http.port: 9200
discovery.seed_hosts: ["192.168.10.130"]
cluster.initial_master_nodes: ["es-01"]
node.master: true
node.data: trueFor a single‑node cluster both node.master and node.data are set to true. Adjust these flags for multi‑node clusters.
3. JVM Options (jvm.options)
-Xms4g
-Xmx4gIt is recommended that the heap size not exceed half of the physical memory.
4. Start Elasticsearch ./bin/elasticsearch -d The -d flag runs the process in the background. Verify the startup with: curl -XGET "192.168.10.130:9200/" 5. Install Elasticsearch‑head
Download the master branch from https://github.com/mobz/elasticsearch-head and deploy it to Tomcat (e.g., /app/tomcat-es-head/webapps).
# Unzip to Tomcat webapps
unzip -d /app/tomcat-es-head/webapps elasticsearch-head-master.zip
cd /app/tomcat-es-head/webapps
mv elasticsearch-head-master elasticsearch-headAfter deployment, edit /app/tomcat-es-head/webapps/elasticsearch-head/_site/app.js to set base_uri to the Elasticsearch HTTP address (default port 9200).
Start Tomcat (port 9100 in the example) and access the Head UI to manage indices and view data.
6. Reference Elasticsearch 6.x Configuration
cluster.name: es-prod-cluster
node.name: es-prod-01
path.data: /data01,/data02,/data03
path.logs: ${ES_HOME}/logs
bootstrap.memory_lock: true
bootstrap.system_call_filter: false
http.cors.enabled: true
http.cors.allow-origin: "*"
network.host: ${IP}
http.port: 9200
discovery.zen.ping.unicast.hosts: ["otc-hadoop-es-01","otc-hadoop-es-02","otc-hadoop-es-03","otc-hadoop-es-04","otc-hadoop-es-05","otc-hadoop-es-06"]
discovery.zen.minimum_master_nodes: 3
node.master: true
node.data: trueThis configuration is provided for reference; actual deployments may require adjustments for file descriptor limits, thread limits, virtual memory settings, etc.
Signed-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.
Full-Stack Internet Architecture
Introducing full-stack Internet architecture technologies centered on Java
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.
