Master Elasticsearch 7.10 on CentOS: Complete Install & Config Guide
This guide walks you through downloading, installing, and configuring Elasticsearch 7.10 on CentOS, covering environment setup, user creation, service start options, essential settings like paths, heap size, system limits, and troubleshooting tips for a production‑ready deployment.
Environment
Download the CentOS 7 DVD ISO and the Elasticsearch 7.10 tarball from the official mirrors:
https://mirrors.aliyun.com/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-2009.iso
https://www.elastic.co/cn/downloads/past-releases/elasticsearch-7-10-0
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.0-linux-x86_64.tar.gz
Installation
# mkdir -p /usr/local/elasticsearch
# chown esuser:esuser /usr/local/elasticsearch
# useradd esuser
# passwd esuser
# su - esuser
$ mv elasticsearch-7.10.0-linux-x86_64.tar.gz /usr/local/elasticsearch/
$ cd /usr/local/elasticsearch/
$ tar -xvzf elasticsearch-7.10.0-linux-x86_64.tar.gz
$ cd elasticsearch-7.10.0
$ lsDo not run Elasticsearch as root; it will fail with a runtime exception.
Foreground Run
$ ./bin/elasticsearchVerify the node is up with: $ curl localhost:9200/ The address must match the network.host setting in config/elasticsearch.yml.
Background Run
Run as a daemon using the -d flag and record the PID with -p: $ ./bin/elasticsearch -d -p pid Stop the daemon by killing the PID stored in the pid file:
$ pkill -F pidConfiguration
Important Elasticsearch Settings
Path Settings
Data is written to the data directory and logs to the logs directory under $ES_HOME. In production, move path.data and path.logs outside $ES_HOME:
path:
data: /var/data/elasticsearch
logs: /var/log/elasticsearchMultiple data paths can be defined for Unix‑style systems:
path:
data:
- /mnt/elasticsearch_1
- /mnt/elasticsearch_2
- /mnt/elasticsearch_3Cluster Name
Set a descriptive cluster.name (default is elasticsearch) in elasticsearch.yml:
cluster.name: logging-prodNode Name
Define node.name for easier identification. By default it uses the host name:
node.name: prod-data-2Network Host
Bind to a non‑loopback address for clustering. Example: network.host: 192.168.1.10 Special values like _local_, _site_, and _global_ are also supported.
Discovery Settings
Configure seed hosts and initial master nodes for cluster bootstrapping:
discovery.seed_hosts:
- 192.168.1.10:9300
- 192.168.1.11
- seeds.mydomain.com
- [0:0:0:0:0:ffff:c0a8:10c]:9301
cluster.initial_master_nodes:
- master-node-a
- master-node-b
- master-node-cHeap Size
Set Xms and Xmx to the same value, typically 50% of physical RAM, in config/jvm.options.d/ or via ES_JAVA_OPTS:
-Xms2g
-Xmx2gJVM Heap Dump Path
Configure -XX:HeapDumpPath=… in jvm.options if the default location is unsuitable.
GC Logging
Default GC logs are enabled in jvm.options. To customize, use JEP 158 options, e.g.:
-Xlog:disable
-Xlog:all=warning:stderr:utctime,level,tags
-Xlog:gc*,gc+age=trace,safepoint:file=/opt/my-app/gc.log:utctime,pid,tags:filecount=32,filesize=64mTemporary Directory
Elasticsearch creates a private temp directory under /tmp. For long‑running services, set $ES_TMPDIR to a dedicated location.
Memory Lock
Enable bootstrap.memory_lock: true in elasticsearch.yml and grant the user unlimited memlock via ulimit -l unlimited or MAX_LOCKED_MEMORY=unlimited in system config.
Swap Disable
Disable swap on Linux with sudo swapoff -a and comment out swap lines in /etc/fstab. Set vm.swappiness=1 for minimal swapping.
File Descriptors
Increase the limit to at least 65535 for the Elasticsearch user using ulimit -n 65535 or esuser - nofile 65535 in /etc/security/limits.conf.
Thread Limits
Ensure the user can create at least 4096 threads ( ulimit -u 4096 or nproc 4096 in limits.conf).
Virtual Memory
Set vm.max_map_count=262144 (permanent via /etc/sysctl.conf) to avoid mmap failures.
TCP Retransmission
Reduce Linux TCP retransmission attempts to speed up failure detection: sysctl -w net.ipv4.tcp_reres2=5 Make it permanent by adding net.ipv4.tcp_reres2=5 to /etc/sysctl.conf.
Reference Links
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/install-elasticsearch.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/targz.html#install-linux
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/important-settings.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/setup-configuration-memory.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/file-descriptors.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/vm-max-map-count.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/networkaddress-cache-ttl.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/executable-jna-tmpdir.html
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.
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.
