1、Elasticsearch安装
# cd /usr/local
下载:
wgethttps://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/zip/elasticsearch/2.3.2/elasticsearch-2.3.2.zip
# unzip elasticsearch-2.3.2.zip
# mkdir -p /data/logs/elasticsearch
# mkdir -p /data/elasticsearch/{data,work,plugins,scripts}
# useradd elasticsearch -s /bin/bash
# chown -R elasticsearch:elasticsearch /data/logs/elasticsearch /data/elasticsearch
2、Elasticsearch配置
1)主配置(./config/elasticsearch.yml)
qc-hermes-es-1:
cluster.name: qc-hermes-search-cluster
node.name: qc-hermes-es-1 #同hostname cat /etc/hostname
path.data: /data/elasticsearch/data
path.logs: /data/logs/elasticsearch
path.plugins: /data/elasticsearch/plugins
path.scripts: /data/elasticsearch/scripts
bootstrap.mlockall: true
network.host: 192.168.0.10 #本机IP地址
http.port: 9200
discovery.zen.ping.unicast.hosts: ["qc-hermes-es-1:9200", "qc-hermes-es-2:9200"]
node.master: true
node.data: true
index.number_of_shards: 8
index.number_of_replicas: 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2)服务启动
# cd /opt/elasticsearch
# su elasticsearch (注意:root账号会报错)
$ bin/elasticsearch -d
说明:2.x的版本需要以普通用户权限启动,否则会报错,无法正常启动。
3)验证启动成功: