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 備份的數量可以動態的定義