Elasticsearch In Production

Install Elasticsearch with RPM manually

sudo rpm --install elasticsearch-6.6.0.rpm
sudo chkconfig --add elasticsearch

Configure Elasticsearch

/etc/elasticsearch/elasticsearch.yml

/etc/sysconfig/elasticsearch #SysV init

/etc/elasticsearch/jvm.options #Xmx <= 32G

sed -n '/^#/!p' /etc/elasticsearch/elasticsearch.yml
####
cluster.name: crs2-es
node.name: ${HOSTNAME}
path.data: /data3/elasticsearch/data
path.logs: /data3/elasticsearch/log

bootstrap.system_call_filter: false #set to false as SecComp fails on CentOS 6
bootstrap.memory_lock: true
network.host: [10.0.0.1, 127.0.0.1]
http.port: 9200
discovery.zen.ping.unicast.hosts: ["10.0.0.1", "10.0.0.2", "10.0.0.3"]
#########################################

sed -n '/^#/!p' /etc/sysconfig/elasticsearch
####
JAVA_HOME=/opt/apps/java/jdk1.8.0_171
ES_PATH_CONF=/etc/elasticsearch
ES_STARTUP_SLEEP_TIME=5
MAX_LOCKED_MEMORY=unlimited
#########################################

sed -n '/^#/!p'  /etc/elasticsearch/jvm.options |egrep Xm[sx]
####
-Xms24g
-Xmx24g
mkdir -p  /data3/elasticsearch/{data,log}
chmod -R 775 /data3/elasticsearch/
chown elasticsearch:elasticsearch /data3/elasticsearch/{data,log}

Run Elasticsearch

sudo -i service elasticsearch start

Check status(cluster)

curl -XGET 'localhost:9200/_cluster/state?pretty'

Reference

Last updated