elasticsearch学习1:安装

elasticsearch权威指南

https://es.xiaoleilu.com/

elasticsearch中文社区

https://elasticsearch.cn/

   

http://www.jianshu.com/p/8ab9fe3d3481

   

一.关键字约定

index:索引

type:类型

token:表征

filter:过滤器

analyser:分析器

   

二.介绍

elasticsearch是一个实时分布式搜索 和 分析引擎.

用于 全文搜索,结构和搜索,分析

使用Java开发,基于Lucene作为其核心实现索引和搜索功能

特点:

分布式 实时文件存储,每个字段均可被搜索

分布式 实时分析搜索引擎

可扩展到上百台服务器,处理PB级 结构化 或 非结构化数据

   

三.安装

1.启动

elasticsearch学习1:安装

(1)报错

http://blog.****.net/wang_zhenwei/article/details/49358357

原因:

elasticsearch学习1:安装

   

(2)报错

原因:不允许使用root运行

elasticsearch学习1:安装

   

(3)报错

Exception in thread "main" BindTransportException[Failed to bind to [9300-9400]]; nested: ChannelException[Failed to bind to: /10.64.25.225:9400]; nested: BindException[Cannot assign requested address];

端口 绑定异常

elasticsearch学习1:安装

   

netstat -apn|grep 9400发现无端口占用

修改conf

elasticsearch学习1:安装

修改host

elasticsearch学习1:安装

   

启动日志[xxx]started

elasticsearch学习1:安装

   

查看是否启动

elasticsearch学习1:安装

   

四.集群和节点

节点(node)是一个运行着的Elasticsearch实例。集群(cluster)是一组具有相同cluster.name的节点集合

   

来自 <https://es.xiaoleilu.com/010_Intro/10_Installing_ES.html>

1.检查集群健康

curl '192.168.144.129:9200/_cat/health?v'

elasticsearch学习1:安装

集群名:elasticsearch

集群状态:yellow(所有数据可用,但某些复制没有被分配),red(数据不可用),green(一切正常)

   

2.获取集群的节点列表

curl '192.168.144.129:9200/_cat/nodes?v'

elasticsearch学习1:安装

目前就一个Spider-Man节点

   

3.列出所有索引

curl '192.168.144.129:9200/_cat/indices?v'

elasticsearch学习1:安装

index(索引)包含5个主分片,1个复制,

黄色意味着某些复制没有(或者还未)被分配。这个索引之所以这样,是因为Elasticsearch默认为这个索引创建一份复制。由于现在我们只有一个节点在运行,那一份复制就分配不了了(为了高可用),直到当另外一个节点加入到这个集群后,才能分配。一旦那份复制在第二个节点上被复制,这个节点的健康状态就会变成绿色。

   

来自 <http://blog.****.net/cnweike/article/details/33736429>

   

4.索引查询一个文档