11. Elasticsearch 簡介
◈ Elasticsearch = Lucene + REST api
◈ 建立索引以達到快速查詢資料
1 , Mark , 25 , Taipei
2 , Eric , 30 , Taipei
3 , Lucas , 25 , Taipei
Name ID
Mark 1
Eric 2
Lucas 3
Age ID
25 1,3
30 2
City ID
Taipei 1,2,3
Index
ID Name Age City
1 Mark 25 Taipei
2 Eric 30 Taipei
3 Lucas 25 Taipei
DB
14. Sharding 機制
◈ 分散儲存資料機制
◈ 資料分散成不同區塊儲存
◈ 分散存取加速運算
Data
1
Data
2
Data
1
Data
2
Node1
Node3
Data
3
Data
3
Node2Data
15. Replica 機制
◈ 重複儲存機制
◈ 把每份資料複製一份以上
◈ 避免叢集間機器損壞導致資料遺失
Data
1
Data
2
Data
2
Data
3
Data
3
Data
1
Node1
Node2
Node3
Data
1
Data
2
Data
2
Data
3
Node1
Node2
16. Shard機制
◈ REST api 方便資料管理
URI分為3個區塊
Localhost:9200 / index / type / id
分別對應傳統資料庫的
DB / table / primary key
傳統SQL資料庫 Elasticsearch
DB Index
Table Type
Primary key Id
Row Document
Column ( Schema ) Field
20. 修改設定檔
◈ Cluster Name
◈ 檔案在 /config/elasticsearch.yml
# ---------------------------------- Cluster -----------------------------------#
# Use a descriptive name for your cluster:
#
# cluster.name: my-application
#
# ---------------------------------- Cluster -----------------------------------#
# Use a descriptive name for your cluster:
#
cluster.name: MarkES
#