0、什么是Elasticsearch?
【百科】ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。
Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布,是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。
1、Elasticsearch安装
# cd /usr/local
# 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
2)服务启动
# cd /opt/elasticsearch
# su elasticsearch (注意:root账号会报错)
$ bin/elasticsearch -d
说明:2.x的版本需要以普通用户权限启动,否则会报错,无法正常启动。
3)验证启动成功:
查看进程:
[elasticsearch@5b9dbaaa148a yang]$ ps -ef | grep elasticsearch
root 3160 3136 0 09:39 pts/1 00:00:00 su elasticsearch
root 3194 3176 0 09:40 pts/1 00:00:00 su elasticsearch
502 3349 3195 2 10:06 pts/1 00:00:21 /usr/java/jdk1.7.0_71/bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/usr/local/elasticsearch -cp /usr/local/elasticsearch/lib/elasticsearch-2.3.2.jar:/usr/local/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch start
作者:铭毅天下
转载请标明出处,原文地址:http://blog.csdn.net/laoyang360/article/details/51417097