elasticsearch入门简介

Elasticsearch是一个高扩展的、开源的、全文检索的搜索引擎,它提供了近实时的索引、搜索、分析功能。

There are a few concepts that are core to Elasticsearch. Understanding these concepts from the outset will tremendously help ease the learning process.

以下是Elasticsearch几个核心概念

1、Near RealTime(NRT)

Elasticsearch is a near real time search platform. What this means is there is a slight latency (normally one second) from the time you index a document until the time it becomes searchable.

2、Cluster(集群)

在ES中,对用户来说集群是很透明的。你只需要指定一个集群的名字(默认是elasticsearch),启动的时候,凡是集群是这个名字的,都会默认加入到一个集群中。

你不需要做任何操作,选举或者管理都是自动完成的。

对用户来说,仅仅是一个名字而已!

3、Node(节点)

跟集群的概念差不多,ES启动时会设置这个节点的名字,一个节点也就是一个ES得服务器。

默认会自动生成一个名字,这个名字在后续的集群管理中还是很有作用的,因此如果想要手动的管理或者查看一些集群的信息,最好是自定义一下节点的名字

4、Index(索引)

5、Type(类型)

6、Document(文档)

7、Shareds&Repicas(分片和备份)

Sharding is important for two primary reasons:

  • It allows you to horizontally split/scale your content volume

  • 允许你水平分割和扩展你的内容

  • It allows you to distribute and parallelize operations across shards (potentially on multiple nodes) thus increasing performance/throughput

  • 它允许你分配和并行操作分片(可能在多个节点上),从而提高性能/吞吐量

Replication is important for two primary reasons:

  • It provides high availability in case a shard/node fails. For this reason, it is important to note that a replica shard is never allocated on the same node as the original/primary shard that it was copied from.

  • It allows you to scale out your search volume/throughput since searches can be executed on all replicas in parallel.

  • 1 当一个分片失败或者下线时,备份的分片可以代替工作,提高了高可用性。

  • 2 备份的分片也可以执行搜索操作,分摊了搜索的压力。

ES默认在创建索引时会创建5个分片,这个数量可以修改。

不过需要注意:

1 分片的数量只能在创建索引的时候指定,不能在后期修改

2 备份的数量可以动态的定义



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章