Install ES cluster

Install ES cluster steps

  • Install the Java and make sure the java -version worked well
rpm -ivh jdk-8u77-linux-x64.rpm
  • Create the user on the cluster nodes
groupadd elasticsearch  
useradd elasticsearch -g elasticsearch -p passw0rd 
passwd elasticsearch
  • Create folder for es log and data folder
mkdir -p /data/lib/elasticsearch/data
mkdir -p /data/log/elasticsearch
  • Change the owner for es log and data folder
chown -R elasticsearch:elasticsearch /data/lib
chown -R elasticsearch:elasticsearch /data/log
  • Change the system limits
vim /etc/security/limits.conf
  • Add following code in the limits.conf
*  soft nofile 65535
*  hard nofile 65535
*  soft nproc  65535
*  hard nproc  65535

NOTE: If you want to set the specific user, you can change the * to the user

  • Install the elasticsearch
rpm -ivh elasticsearch-2.3.5.rpm
  • Configure the elasticsearch.yml file
vim /etc/elasticsearch/elasticsearch.yml
  • Add following configuration in to the elasticsearch.yml
cluster.name: ockb-es-cluster
node.name: es-node-1
http.port: 9225

network.host: [host1, _local_]
discovery.zen.ping.unicast.hosts: ["host1", "host2", "host2"]

path.data: /data/lib/elasticsearch/data
path.logs: /data/log/elasticsearch

NOTE: node.name should be unique for every cluster node

  • Configure the /etc/sysconfig/elasticsearch file
vim /etc/sysconfig/elasticsearch
  • Add following configuration in to the /etc/sysconfig/elasticsearch
ES_HOME=/usr/share/elasticsearch
CONF_DIR=/etc/elasticsearch
DATA_DIR=/data/lib/elasticsearch/data
LOG_DIR=/data/log/elasticsearch
PID_DIR=/var/run/elasticsearch
ES_USER=elasticsearch
ES_GROUP=elasticsearch
  • Start the elasticsearch cluster
service elasticsearch start
  • Check the elasticsearch worked well
curl -XGET 'http://localhost:9225/_cat/health?pretty'
  • The default replicas is 1, if you want to change the replicas number you can chagne it through REST API
curl -XPUT 'http://localhost:9225/_settings?pretty' -d '{ "number_of_replicas" : node number - 1 }'

Install elasticsearch plugins

  • Here use head plugin as an example

I used elasticsearch 2.3.5 so use following command to install the plugin

/usr/share/elasticsearch/bin install mobz/elasticsearch-head
  • After installed successfully

  • Restart the elasticsearch

  • The access the URL: http://<elasticsearch server>:9225/_plugin/head/

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容